Macro in personnel administration.
RP_PROVIDE_FROM_LAST Pnnnn SPACE PN-BEGDA PN-ENDDA.
or
RP_PROVIDE_FROM_FIRST Pnnnn SPACE PN-BEGDA PN-ENDDA.
Important note for those macros :
- These statements make the most recent or earliest record in the PN/BEGDA to PN/ENDDA data
selection period available in the structure Pnnnn for info type nnnn.
If the infotype has subtypes, replace the SPACE parameter by the appropriate subtype number. - When a record has been successfully read, the return code PNP-SW-FOUND = 1 is returned.
- Use PNP logical database in the attributes of the program.
Get First Record from the Infotype
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
REPORT ZMACRO01 . TABLES: PERNR. INFOTYPES: 0008. GET PERNR. RP_PROVIDE_FROM_FIRST P0008 SPACE PN-BEGDA PN-ENDDA . IF PNP-SW-FOUND eq 1. WRITE: / PERNR-PERNR, PN-BEGDA, PN-ENDDA, P0008-ansal, P0008-lga01, P0008-bet01. ENDIF. |
Get Last Record from the Infotype
1 2 3 4 5 6 7 8 9 10 |
RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA. IF PNP-SW-FOUND eq 1. WRITE: / PERNR-PERNR, PN-BEGDA, PN-ENDDA, P0008-ansal, P0008-lga01, P0008-bet01. ENDIF. |
Macro in applicant data.
Use PAP logical database in the attributes of the program
PAP_PROVIDE_FROM_LAST Pnnnn SPACE PA$BEGDA PA$ENDDA.
or
PAP_PROVIDE_FROM_FIRST Pnnnn SPACE PA$BEGDA PA$ENDDA.
If the infotype has subtypes, replace the SPACE parameter by the appropriate subtype number.
The return code PNP-SW-FOUND = 1 is returned if data is found.
Declare TABLES: APPLICANT to display default selection screen from PAP LDB.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
REPORT ZMACROS02. TABLES: APPLICANT. INFOTYPES: 0001. GET APPLICANT. *--get the first application record PAP_PROVIDE_FROM_FIRST P0001 SPACE PA$BEGDA PA$ENDDA. IF PAP_SW_FOUND eq 1. WRITE: / APPLICANT-APLNO, P0001-BUKRS, P0001-WERKS, P0001-PERSG, PA$BEGDA, PA$ENDDA. ENDIF. PAP_PROVIDE_FROM_LAST P0001 SPACE PA$BEGDA PA$ENDDA. IF PAP_SW_FOUND eq 1. WRITE: / APPLICANT-APLNO, P0001-BUKRS, P0001-WERKS, P0001-PERSG, ENDIF. |
Macro in time management.
You should not load all time infotype records from the earliest because the data is big. This would quickly lead to a memory overload, especially if a front-end time recording system is connected to your HR system.
Use the infotype declaration supplement MODE N to define that the internal time infotype tables
should be declared but not filled at the GET PERNR event.
You can use macro RP_READ_ALL_TIME_ITY to get data from Time Management
Use PNP logical database in the attributes of the program
1 2 3 4 5 6 7 8 9 10 11 12 |
REPORT zmacros_time. TABLES: PERNR. INFOTYPES: 2001 MODE N. GET PERNR. RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA. LOOP AT P2001. WRITE: / P2001-ABWTG. ENDLOOP. |
Macro in payroll.
For repetitive structures( do varying)
When evaluating repeat structures, you must ensure that all fields are entered. In the case of the
Basic Pay infotype, 20 * 5 = 100 fields are queried.
A loop offers a more streamlined method of evaluation. Here, one line of the repeat structure is
evaluated each time the loop is executed.To use this method of evaluation, define a field string whose structure corresponds to the fields inone line of the repetitive structure. In this field string, one line of the basic pay wage types is evaluated each time the loop is executed.
You can use DO .. VARYING to get all value from each of Wage Type
Use PNP logical database in the attributes of the program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
REPORT zmacro_payroll. TABLES: PERNR. INFOTYPES: 0008. DATA: BEGIN OF WAGETYPES, LGA LIKE P0008-LGA01, BET LIKE P0008-BET01, ANZ LIKE P0008-ANZ01, EIN LIKE P0008-EIN01, OPK LIKE P0008-OPK01, END OF WAGETYPES. GET PERNR. RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA. DO 20 TIMES VARYING WAGETYPES FROM P0008-LGA01 NEXT P0008-LGA02. IF WAGETYPES-LGA IS INITIAL. EXIT. ELSE. WRITE: / WAGETYPES-LGA, WAGETYPES-BET. ENDIF. ENDDO. |
Incoming search terms:
- sap rp_provide_from_last logic
- abap RP_PROVIDE_FROM_LAST
- get pernr
- RP-PROVIDE-FROM-LAST
- using repetitive structures along with macros in abap hr
- how to use gat pernr event in sap abap hr
- rp_provide_from_last p0001 space pnpbegda pnpbegda
- repetitive structure hr abap
- rp_provide_from_last
- what is the use of pn-begda and endda in rp-provide from last