Rather than reading the payroll results in traditional way using FM's we can process the same using Payroll reader class which was designed to use with PNP logical database. SAP recommends that not to use GET PAYROLL event. Instead sap had provided the below PRR class i.e. Payroll Results Reader class.
REPORT ZHR_1. TABLES PERNR. ** Payroll results realted data declarations DATA: GO_PRR TYPE REF TO CL_HRPAY99_PRR_4_PNP_REPS, GT_PERNR_PR TYPE H99_HR_PAY_RESULT_TAB. *** Field Symbols. FIELD-SYMBOLS: <PERNR_PR> TYPE REF TO CL_HR_PAY_RESULT. START-OF-SELECTION. ** Create an instance to the payroll results reader class . CONSTANTS: LV_CO_MOLGA(2) VALUE '40'. ** Generate/ Create an instance of payroll reader class. CALL METHOD CL_HRPAY99_PRR_4_PNP_REPS=>GET_INSTANCE EXPORTING IM_PN_BEGDA = PN-BEGDA IM_PN_ENDDA = PN-ENDDA IM_MOLGA = LV_CO_MOLGA IM_PNPDISBD = PN-BEGDA IMPORTING EX_PRR = GO_PRR EXCEPTIONS INVALID_ENTRIES = 1 OTHERS = 2. IF SY-SUBRC <> 0. ** Error message can be raised ENDIF. ******** GET PERNR EVENT ************** GET PERNR. ********* START READING OF INDIVIDUAL EMPLOYEE PAYROLL RESULTS AFTER GET PERNR EVENT ************* CALL METHOD GO_PRR->GET_PERNR_PAYR_RESULTS_ALLIN1 EXPORTING IM_PERNR = PERNR-PERNR IMPORTING EX_PERNR_PAYROLL_RESULTS = GT_PERNR_PR EXCEPTIONS COUNTRY_VERSION_NOT_AVAILABLE = 1 NO_AUTHORIZATION = 2 NO_ENTRIES_FOUND = 3 READ_ERROR = 4 OTHERS = 5. IF SY-SUBRC <> 0. ENDIF. *** Payroll results loaded in to GT_PERNR_PR based on the requirement like only regular, only offcycle you can process the results table. ** Identify only the regular payroll results. LOOP AT GT_PERNR_PR ASSIGNING <PERNR_PR>. * GO_PERNR_PR ?= <PERNR_PR>. IF <PERNR_PR>->PERIOD-FPPER NE <PERNR_PR>->PERIOD-INPER OR <PERNR_PR>->PERIOD-FPPER NE PN-PAPER OR <PERNR_PR>->PERIOD-FPPER EQ 'X' OR <PERNR_PR>->PERIOD-FPPER = '000000' . * CLEAR <PERNR_PR>. " Write own logic to mark and process the result record as required ENDIF. ENDLOOP.
Regards,
Mayure