*&---------------------------------------------------------------------* *& Report ZHR_PY_EMPLOYEE_CTC *& *&---------------------------------------------------------------------* *& *& *&

---------------------------------------------------------------------* REPORT ZHR_PY_EMPLOYEE_CTC. TABLES : PA0001. TYPE-POOLS:SLIS. SELECT-OPTIONS : S_EMP FOR PA0001-PERNR, S_PERSG FOR PA0001-PERSG, S_BEGDA FOR PA0001-BEGDA. TYPES: BEGIN OF TY_EMP, PERNR TYPE PA0001-PERNR, CNAME TYPE PA0002-CNAME, PERSG TYPE PA0001-PERSG, PTEXT TYPE T501T-PTEXT, PERSK TYPE PA0001-PERSK, PTEXT1 TYPE T503T-PTEXT, LGART TYPE PA0008-LGA01, LGTXT TYPE T512T-LGTXT, BETRG TYPE PA0008-BET01, END OF TY_EMP. TYPES : BEGIN OF TY_0001, PERNR TYPE PA0001-PERNR, PERSG TYPE PA0001-PERSG, PERSK TYPE PA0001-PERSK, END OF TY_0001. TYPES : BEGIN OF TY_0002, PERNR TYPE PA0001-PERNR, vorna TYPE PA0002-vorna, nachn TYPE PA0002-nachn, END OF TY_0002. TYPES : BEGIN OF TY_T501T, PERSG TYPE T501T-PERSG, PTEXT TYPE T501T-PTEXT, END OF TY_T501T. " EMPLOYEE GROUP " Name of Employee Group " " " " " " " " " Emp Number Emp Name Emp Group NAME OF EMP GROUP Emp Sub Group EmpSub Group Name wAGE TYPE WAGE TYPE TEXT AMOUNT

TYPES : BEGIN OF TY_T503T, PERSK TYPE T503T-PERSK, " EMPLOYEE SUB GROUP PTEXT1 TYPE T503T-PTEXT, " Name of Employee SUB Group END OF TY_T503T. TYPES : BEGIN OF TY_T512T, LGART TYPE T512T-LGART, LGTXT TYPE T512T-LGTXT, END OF TY_T512T.

" WAGE TYPE " WAGE TYPE text

WA_0002 TYPE TY_0002. DATA:IT_PAY TYPE TABLE OF BAPIP0008P. WA_EMP TYPE TY_EMP.DATA: IT_EMP TYPE TABLE OF TY_EMP. DATA:it_fieldcat TYPE SLIS_T_FIELDCAT_ALV. WA_0001 TYPE TY_0001. DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV. data: l_lgart TYPE pa0008-lga01. SELECT PERNR PERSG PERSK FROM PA0001 INTO TABLE IT_0001 WHERE PERNR IN S_EMP and begda le S_BEGDA-high and endda ge s_begda-low. WA_0008 TYPE PA0008. WA_T501T TYPE TY_T501T. . WA_PAY TYPE BAPIP0008P. WA_SORT TYPE slis_sortinfo_alv. IT_0008 TYPE TABLE OF PA0008. l_betrg TYPE pa0008-bet01. SELECT PERNR VORNA nachn FROM PA0002 INTO TABLE IT_0002 FOR ALL ENTRIES IN IT_0001 WHERE PERNR = IT_0001-PERNR and begda le S_BEGDA-high and endda ge s_begda-low. IT_0002 TYPE TABLE OF TY_0002. ELSE. IT_0001 TYPE TABLE OF TY_0001. wa_fieldcat TYPE SLIS_FIELDCAT_ALV . if sy-dbcnt = 0. IT_T503T TYPE TABLE OF TY_T503T. READ TABLE s_begda INDEX 1. sort it_0002 by pernr. MESSAGE I000(ZRIZ_MSG) WITH ' NO EMP REC FOUND'. WA_T512T TYPE TY_T512T. IT_T512T TYPE TABLE OF TY_T512T. IT_T501T TYPE TABLE OF TY_T501T. WA_T503T TYPE TY_T503T.

ENDIF. wa_emp-ptext1 = WA_T501T-PTEXT. endif. * DO 40 TIMES varying l_lgart FROM wa_0008-lga01 NEXT wa_0008-lga02 . READ TABLE IT_T503T INTO WA_T503T WITH KEY PERSK = wa_0001-persk. IF SY-subrc = 0. ENDIF. wa_emp-persk = wa_0001-persk. READ TABLE it_0002 into wa_0002 with key pernr = wa_0001-pernr BINARY SEARCH. SELECT PERSG PTEXT FROM T501T INTO TABLE IT_T501T FOR ALL ENTRIES IN IT_0001 WHERE PERSG = IT_0001-PERSG and sprsl = sy-langu. IF SY-subrc = 0. if sy-subrc = 0. wa_emp-persg = wa_0001-persg. SELECT PERSK PTEXT FROM T503T INTO TABLE IT_T503T FOR ALL ENTRIES IN IT_0001 WHERE PERSK = IT_0001-PERSK and sprsl = sy-langu. SELECT LGART LGTXT FROM T512T INTO TABLE IT_T512T WHERE sprsl = sy-langu. IF sy-subrc <> 0. ENDIF. ENDIF. CLEAR wa_emp. wa_emp-ptext = WA_T501T-PTEXT. wa_emp-pernr = wa_0001-pernr. CONCATENATE wa_0002-vorna WA_0002-NACHN INTO WA_EMP-CNAME SEPARATED BY SPACE. READ TABLE it_0008 INTO wa_0008 WITH kEY pernr = wa_0001-pernr. continue.SELECT * FROM PA0008 INTO TABLE IT_0008 FOR ALL ENTRIES IN IT_0001 WHERE PERNR = IT_0001-PERNR AND BEGDA LE S_BEGDA-HIGH AND ENDDA GE S_BEGDA-LOW. LOOP AT IT_0001 INTO WA_0001. READ TABLE IT_T501T INTO WA_T501T WITH KEY PERSG = wa_0001-persg.

ENDIF. wa_emp-lgart = l_lgart. ENDDO. ELSE. wa_emp-lgtxt = wa_t512t-lgtxt. APPEND WA_EMP TO IT_EMP. CALL FUNCTION 'BAPI_BASICPAY_GETDETAIL' EXPORTING EMPLOYEENUMBER = WA_0001-PERNR SUBTYPE = WA_0008-SUBTY OBJECTID = WA_0008-OBJPS LOCKINDICATOR = WA_0008-SPRPS VALIDITYBEGIN = WA_0008-BEGDA VALIDITYEND = WA_0008-ENDDA RECORDNUMBER = WA_0008-SEQNR IMPORTING RETURN = PAYSCALETYPE = PAYSCALEAREA = PAYSCALEGROUP = PAYSCALELEVEL = NEXTINCREASE = LOCALALLOWLEVEL = PARTNERSHIP = CURRENCY = COMPARISONPAYSCLTYPE = COMPARISONPAYSCLAREA = COMPARISONPAYSCLGRP = COMPARISONPAYSCLLEVEL = COMPNEXTINCREASE = CAPACITYUTILLEVEL = HOURSWORKEDPERPERIOD = ANNUALSALARY = CASEGROUPCATALOG = CASEGROUP = CURRENCYANNUALSALARY = * * * * * * * * * * * * * * * * * * * * * . SELECT SINGLE BETRG FROM T510 INTO L_BETRG WHERE TRFAR = wa_0008-TRFAR AND TRFGB = wa_0008-TRFGB AND TRFGR = wa_0008-TRFGR AND TRFST = wa_0008-TRFST AND LGART = L_LGART AND BEGDA LE WA_0008-ENDDA AND ENDDA GE WA_0008-BEGDA. ENDIF. IF L_BETRG IS INITIAL.* * * * * * * * * * * * * * * * * * * * * * * * * * * * varying l_betrg FROM wa_0008-bet01 NEXT wa_0008-bet02. EXIT. IF SY-subrc = 0. wa_emp-betrg = l_betrg. ENDIF. READ TABLE IT_T512T INTO WA_T512T WITH KEY LGART = l_lgart. IF l_lgart <> ''.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = SY-REPID * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = * IS_LAYOUT = IT_FIELDCAT = IT_FIELDCAT * IT_EXCLUDING = * IT_SPECIAL_GROUPS = . WA_EMP-lgtxt = WA_PAY-NAMEOFWAGETYPE. WA_EMP-BETRG = WA_PAY-AMOUNT. ENDLOOP. 'LGTXT' 'Wage Type Text'. 'CNAME' 'Employee Name'. 'PERSG' 'Employee Group'. WA_SORT-up = 'X'.* * * * * * REASON NAMEOFBASICPAYTYPE NAMEOFPAYSCALETYPE NAMEOFPAYSCALEAREA NAMEOFCOMPPAYSCLTYPE NAMEOFCOMPPAYSCLAREA TABLES WAGETYPES . 'BETRG' 'Amount'. LOOP AT IT_PAY INTO WA_PAY. APPEND WA_SORT TO IT_SORT. = = = = = = = IT_PAY WA_EMP-LGART = WA_PAY-WAGETYPE. 'LGART' 'Wage Type'. ENDLOOP. PERFORM PREPARE_FIELDCAT USING: 'PERNR' 'Employee name'. 'PTEXT1' 'Employee Sub Group Text'. APPEND WA_EMP TO IT_EMP. 'PTEXT' 'Name Of Employee Group'. WA_SORT-subtot = 'X'. WA_SORT-fieldname = 'PERNR'. 'PERSK' 'Emp Sub Group'.

ENDIF. WA_FIELDCAT-FIELDNAME = G_FLDNAME. IF G_FLDNAME = 'BETRG'. WA_FIELDCAT-SELTEXT_L = G_COL_HEAD. *&---------------------------------------------------------------------* *& Form PREPARE_FIELDCAT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0484 text * -->P_0485 text *----------------------------------------------------------------------* FORM PREPARE_FIELDCAT USING VALUE(G_FLDNAME) TYPE SLIS_FIELDNAME VALUE(G_COL_HEAD) TYPE SCRTEXT_L. " PREPARE_FIELDCAT . WA_FIELDCAT-do_sum = 'X'.IT_SORT = IT_SORT * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = IT_EVENTS * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES T_OUTTAB = it_emp EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2 . ENDFORM. ENDIF. APPEND WA_FIELDCAT TO IT_FIELDCAT. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. CLEAR: WA_FIELDCAT. IF SY-SUBRC <> 0.

Sign up to vote on this title
UsefulNot useful