Hello SAP experts,
Could you help me with the following question?
I have an ABAP report that shows employees being paid over 10% of their bi-weekly pay. Now the user wants a new column in the report with the total hours worked (getting paid – regular hours/overtime hours) .
I am new to ABAP as well as Payroll, so I need your help.
I looked in the payroll results and saw that the taxable hours get cumulated into WT /5UT. How do I include the number shown in WT /5UT in the report? Also, is this wage type the correct one?
Here is the code of the program:
REPORT (SY-REPID)
LINE-COUNT 65(3)
LINE-SIZE 132
MESSAGE-ID ZZ.
************************************************************************
* CHANGE HISTORY *
*STC # Date Level Description Author *
*--------------------------------------------------------------------- *
************************************************************************
* SYSTEM DETAILS *
* Level : SAP R/3 Version 3.0C *
* Module : S Logical DB : N/A *
* ABAP DETAILS *
* Name : ZHXR0520 - Salary Audit report *
* Version : 1.0 *
* *
* *
* Type : Report *
* *
* DESCRIPTION / PROCESSING DETAILS *
* 0001 - Modify to include iT 2,3,40, 50 and 60 for the amount *
* 0002 - Adding Overtime WT for non exempt employees (0020, 0025) *
************************************************************************
TABLES: PERNR, PCL1, PCL2.
INFOTYPES : 0001,0002,0007,0008.
DATA INAME LIKE P0001-ENAME.
DATA SNAME LIKE P0001-SNAME.
DATA: AMOUNT LIKE P0008-ANSAL.
DATA: TOLERRCE LIKE P0008-BET01.
DATA: BEGIN OF ITAB OCCURS 0,
PERNR LIKE PERNR-PERNR,
NAME(30) TYPE C,
BET01 LIKE P0008-BET01,
PAY01 LIKE P0008-ANSAL,
END OF ITAB.
*path and file name
INCLUDE ZSXI0050.
INCLUDE ZHXI0060.
INCLUDE RPC2CD09. "Cluster CD Data-Definition
INCLUDE RPC2CA00. "Cluster CA Data-Definition
INCLUDE RPC2RUU0. "Cluster RU Data-Definition
INCLUDE RPC2RX09. "Cluster RU Data-Definition internat. part
INCLUDE RPPPXD00. "Data befinition buffer PCL1/PCL2
INCLUDE RPPPXD10. "Common part buffer PCL1/PCL2
INCLUDE RPPPXM00. "Buffer handling routine
INCLUDE RPC2PS00.
INCLUDE RPCFDC10.
*INCLUDE RPCFDC09.
*INCLUDE RPC2ROX3. "Data definition RPCLSTRs (only J,K,U)
DATA: IFPPER LIKE RGDIR-FPPER.
AT SELECTION-SCREEN OUTPUT.
DATA: DUMMY TYPE C.
AUTHORITY-CHECK OBJECT 'PLOG'
ID 'PLVAR' FIELD DUMMY
ID 'OTYPE' FIELD DUMMY
ID 'INFOTYP' FIELD DUMMY
ID 'SUBTYP' FIELD DUMMY
ID 'ISTAT' FIELD DUMMY
ID 'PPFCODE' FIELD DUMMY.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ): WITH 'You are not Authorized to run this abap'.
ENDIF.
INITIALIZATION.
PNPXABKR = 'SB'.
PNPABKRS-LOW = 'BW'.
PNPABKRS-SIGN = 'I'.
PNPABKRS-OPTION = 'EQ'.
APPEND PNPABKRS.
PNPABKRS-LOW = 'SB'.
PNPABKRS-SIGN = 'I'.
PNPABKRS-OPTION = 'EQ'.
APPEND PNPABKRS.
************************************************************************
* Start of main program *
************************************************************************
START-OF-SELECTION.
* PERFORM I1000-CHECK-PARROLL USING PNPXABKR PNPDISPP PNPDISPJ STATE.
* IF STATE <> '3'.
* SKIP 3.
* WRITE:/ 'ERROR ERROR PAYROLL STILL ACTIVE'.
* STOP.
* ENDIF.
IF PNPTIMR9 = 'X'.
CONCATENATE PNPDISPJ PNPDISPP INTO IFPPER.
ELSE.
CONCATENATE PNPPABRJ PNPPABRP INTO IFPPER.
ENDIF.
GET PERNR.
PERFORM 1500_EDIT_NAME.
RP-PROVIDE-FROM-LAST P0001 SPACE PN-BEGDA PN-ENDDA.
RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA PN-ENDDA.
RP-PROVIDE-FROM-LAST P0008 SPACE PN-BEGDA PN-ENDDA.
* RP-PROVIDE-FROM-LAST P0008 SPACE PN/BEGDA PN/ENDDA.
CD-KEY-PERNR = PERNR-PERNR.
* this routine gets the number of payroll results for the Employee and
* puts in internal table RGDIR
RP-IMP-C2-CU.
IF RP-IMP-CD-SUBRC <> 0.
MESSAGE I002 WITH:'No payroll results for Employee' PERNR-PERNR.
ELSE.
* DESCRIBE TABLE RGDIR LINES LINES.
LOOP AT RGDIR WHERE FPPER = IFPPER AND
ABKRS IN PNPABKRS AND
SRTZA = 'A' AND
VOID <> 'V'.
* fill the key to read payroll results from cluster 2
PERFORM 0500_READ_PAYROLL_TABLES.
ITAB-NAME = INAME.
ITAB-PERNR = PERNR-PERNR.
ITAB-BET01 = P0008-ANSAL / 26.
APPEND ITAB.
ENDLOOP.
ENDIF.
END-OF-SELECTION.
LOOP AT ITAB.
* multiply biweekly amount by 110%
AMOUNT = ITAB-BET01 * '1.1'.
*subtract actual pay by 110%
TOLERRCE = ITAB-PAY01 - AMOUNT.
* overpayment if the difference is positive amount.
IF TOLERRCE > 0.
WRITE: / ITAB-PERNR,
ITAB-NAME,
ITAB-BET01,
ITAB-PAY01,
TOLERRCE.
ENDIF.
ENDLOOP.
*---------------------------------------------------------------------*
* FORM 0500_READ_PAYROLL_TABLES *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM 0500_READ_PAYROLL_TABLES.
RX-KEY-PERNR = PERNR-PERNR.
UNPACK RGDIR-SEQNR TO RX-KEY-SEQNO.
RP-IMP-C2-RU.
* IF RP-IMP-RU-SUBRC <> 0.
* ENDIF.
CLEAR ITAB.
* LOOP AT RT WHERE LGART = '/170'.
LOOP AT RT WHERE LGART = '0002' OR
LGART = '0003' OR
LGART = '0040' OR
LGART = '0050' OR
LGART = '0060' OR
LGART = '0020' OR "0002
LGART = '0025'. "0002
ITAB-PAY01 = ITAB-PAY01 + RT-BETRG. " wages
ENDLOOP.
ENDFORM. " 0500_READ_PAYROLL_TABLES.
*---------------------------------------------------------------------*
* FORM 1500_EDIT_NAME *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM 1500_EDIT_NAME.
CALL FUNCTION 'RP_EDIT_NAME'
EXPORTING
FORMAT = '05'
LANGU = SPACE
MOLGA = '10'
PP0002 = P0002
* PP0021 = ' '
* PP0148 = ' '
IMPORTING
EDIT_NAME = INAME
* RETCODE =
EXCEPTIONS
OTHERS = 1.
ENDFORM. " 1000_SPECIAL_RUNS.
Thank you!
Iuliana