Unlike other modules data processing in SAP , HR module data processing is little bit different. Here the resultant data will be stroed in Clusters , which we can not access directly with normal select satments . One have to use the SAP provided methods only for data accessing. So I thaught the below program will help a little for HR ABAPers who are learning now.
Below is the program to retrieve an employee’s last run payroll results. For this program I used PNP LDB .
|Program Source Code|
DATA: IT_RGDIR TYPE TABLE OF PC261, ” Table for Cluster directory
** Triggering of Get Event.
** Call the function module to import the cluster directory table for the an employee coming in Get pernr Event.
CALL FUNCTION ‘CU_READ_RGDIR’
** Call the FM to get the latest run payroll results Sequnce number.
CALL FUNCTION ‘CD_READ_LAST’
** Once if you are ready with the Sequence number for a particular employee call the FM to import Payroll results into Deep structure ( ST_PAYRESULT).
** Loop the Results table inside Payresults deep structure for Net salary.
** RT table is meant for stroing Result data of the particular Payroll run.
LOOP AT ST_PAYRESULT-INTER-RT INTO WA_RT WHERE lgart = ‘/560’. ” /560 is the wage type for Net Salary.
** End of Program.
And the Final output will be like as below.