<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ABAP Tutorials &#187; RP-PROVIDE-FROM-FRST</title>
	<atom:link href="http://www.abap-tutorials.com/tag/rp-provide-from-frst/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abap-tutorials.com</link>
	<description>ABAP Tutorials, Guides, Training, Manuals</description>
	<lastBuildDate>Thu, 17 Nov 2011 07:43:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Macros in ABAP-HR Programming &#8211; I</title>
		<link>http://www.abap-tutorials.com/2009/11/20/macros-in-abap-hr-programming-i/</link>
		<comments>http://www.abap-tutorials.com/2009/11/20/macros-in-abap-hr-programming-i/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 11:32:42 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP HR]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[macros]]></category>
		<category><![CDATA[PNP]]></category>
		<category><![CDATA[PNPCE]]></category>
		<category><![CDATA[RP-PROVIDE-FROM-FRST]]></category>
		<category><![CDATA[RP-PROVIDE-FROM-LAST]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=1081</guid>
		<description><![CDATA[The macros will be used to get the data from the various clusters based on the cluster ID.For Buffering purpose we use macros. For example, when we want to read the data from the cluster RU, we have to pass the cluster ID &#8220;RU&#8221; and Rx-KEY to the particular macro. By using the Rx-key the [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">The macros will be used to get the data from the various clusters based on the cluster ID.For Buffering purpose we use macros.</p>
<p style="text-align: justify;">For example, when we want to read the data from the cluster RU, we have to pass the cluster ID &#8220;RU&#8221; and Rx-KEY to the particular macro. By using the Rx-key the macro will fetch the data from the cluster RU.</p>
<p style="text-align: justify;">Basically we use the macros to IMPORT/EXPORT the data to or from the clusters.</p>
<p style="text-align: justify;"><span id="more-1081"></span></p>
<p style="text-align: justify;">Here is the general naming convension for the IMPORT and EXPORT macros.</p>
<p style="text-align: justify;"><strong><span style="color: #3366ff;">For Import:</span></strong></p>
<p style="text-align: justify;">RP-IMP-Cn-xx</p>
<p style="text-align: justify;">where,</p>
<p style="text-align: justify;">n &#8212;&#8212;&#8211;&gt; No. of PCL file.(ex:1,2,3,4 0r 5)</p>
<p style="text-align: justify;">xx&#8212;&#8212;&#8211;&gt; cluster ID</p>
<p style="text-align: justify;">IMP&#8212;&#8212;&gt; Import</p>
<p style="text-align: justify;"><strong><span style="color: #3366ff;">For Export:</span></strong></p>
<p style="text-align: justify;">RP-EXP-Cn-xx</p>
<p style="text-align: justify;">where,</p>
<p style="text-align: justify;">n &#8212;&#8212;&#8211;&gt; No. of PCL file.(ex:1,2,3,4 0r 5)</p>
<p style="text-align: justify;">xx&#8212;&#8212;&#8211;&gt; cluster ID</p>
<p style="text-align: justify;">EXP&#8212;&#8212;&gt; Export</p>
<p style="text-align: justify;">Macro contains some part of source code which it will be useful for number of applications, just like function modules.</p>
<p style="text-align: justify;"><strong><span style="color: #3366ff;">Generally we use two macros in HR ABAP</span></strong></p>
<ul>
<li>
<div style="text-align: justify;"><strong>RP-PROVIDE-FROM-LAST</strong></div>
</li>
<li>
<div style="text-align: justify;"><strong>RP-PROVIDE-FROM-FRST</strong></div>
</li>
</ul>
<p style="text-align: justify;">The macro RP-PROVIDE-FROM-LAST retrieves the last(latest) data record which is valid in the data selection period.</p>
<p style="text-align: justify;">The macro RP-PROVIDE-FROM-FRST retrieves the first(start)data record which is valid in the data selection period.</p>
<p style="text-align: justify;">For every macro, whether the operation was successful or not will be checked with PNP-SW-FOUND. If PNP-SW-FOUND = 1, then the operation is successful. ( same as sy-subrc but the value is in reverse case)</p>
<p style="text-align: justify;">The macro RP-READ-INFOTYPE retrieves all the data record(s) which is valid in the data selection period. If SY-SUBRC = 0 or initial, then the process is successful.</p>
<p style="text-align: justify;">All the Macros are stored in table TRMAC.</p>
<p style="text-align: justify;">Whenever you are using the macros like RP-PROVIDE-FROM-LAST or RP-PROVIDE-FROM-FRST, check whether you have included logical database PNP in program attributes.</p>
<p style="text-align: justify;">It is not necessary to include logical database PNP/PNPCE in your program when you are using the macro like RP-READ-INFOTYPE A B C D E , where A corresponds to PERNR which describes for which personnel number you require records. B corresponds to INFOTYPE which describes from which infotype you require records. C corresponds to data structure of the declared infotype (internal table like P0000 for infotype 0000) where all the records of the particular personnel number will be stored. D corresponds to Start date. E corresponds to End date.</p>
<p style="text-align: justify;"><strong>Sample Code :</strong></p>
<p style="text-align: justify;">Tables : PERNR.</p>
<p style="text-align: justify;">INFOTYPES : 0001,0002.</p>
<p style="text-align: justify;"> Start-of-selection.</p>
<p style="text-align: justify;">Get PERNR.</p>
<p style="text-align: justify;">RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.</p>
<p style="text-align: justify;"> Write : / P0001-PERNR.</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;"><strong><span style="color: #3366ff;">Note:</span></strong></p>
<p style="text-align: justify;">1. NULL is a macro which contains the value 0 (on most implementations). this is the one used to initialize a pointer to NULL</p>
<p style="text-align: justify;">2. Debugging a MACRO is not really possible, prevent the use of them.</p>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/07/20/macro-an-under-used-modularization-technique/' rel='bookmark' title='MACRO in ABAP &#8211; an under-used Modularization Technique'>MACRO in ABAP &#8211; an under-used Modularization Technique</a></li>
<li><a href='http://www.abap-tutorials.com/2010/01/14/programmers-guide-to-abap-hr/' rel='bookmark' title='Programmer&#8217;s Guide to ABAP HR'>Programmer&#8217;s Guide to ABAP HR</a></li>
<li><a href='http://www.abap-tutorials.com/2009/11/18/abap-vs-abap-hr/' rel='bookmark' title='ABAP Vs. ABAP HR'>ABAP Vs. ABAP HR</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/11/20/macros-in-abap-hr-programming-i/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

