SAP HR ABAP, HCM Training Material and Tutorials

22
Dec

Macros in HR-ABAP programming

Bookmark and Share


Most commonly used Macros in ABAP-HR ?

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 ABAP-HR or SAP-HR
RP-PROVIDE-FROM-LAST
RP-PROVIDE-FROM-FRST

Ex:
RP-PROVIDE-FROM-LAST P0000 SPACE PN-BEGDA PN-ENDDA.
IF PN-SW-FOUND = 1.
WRITE YOUR CONDITION.
ENDIF.

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.

Related Posts

One Response to “Macros in HR-ABAP programming”

  1. 1
    Avinash Says:

    hi,i am willing to do ABAP HR module,i would like to know o that extent coding comes in SAP HR module,as i have already done ABAP finding dificuly in writing code,so i want to move to functinal side of SAP in HR module.id SAP HR modules is same as ABAP HR ??
    kindly reply thanks

Leave a Reply

© 2012 SAP HR ABAP, HCM Training Material and Tutorials | Entries (RSS) and Comments (RSS)

Design by Web4 Wordpress Themes, © SAP HR ABAP, HCM Training Material and Tutorials 2012 | Theme design by Data sub systems.
SAP is a registered Trademark of SAP AG. Abaphr.com is not affiliated to SAP AG or any of its subsidiaries.