Dec
Macros in HR-ABAP programming
Most commonly used Macros in HR ABAP ?
Macro contains some part of source code which it will be useful for number of applications.( Like function modules )
Generally we use two macros in HR ABAP
RP-PROVIDE-FROM-LAST
RP-PROVIDE-FROM-FRST
The macro RP-PROVIDE-FROM-LAST retrieves the last(latest) data record which is valid in the data selection period.
The macro RP-PROVIDE-FROM-FRST retrieves the first(start)data record which is valid in the data selection period.
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)
The macro RP-READ-INFOTYPE retrieves all the data record(s) which is valid in the data selection period.
If SY-SUBRC = 0 , then the process is successful.
All the Macros are stored in table TRMAC
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.
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.
