You are on page 1of 15

wo ABAP HR Programs, which are interconnected, the first takes employee numbers which should not be given Petrol

allowance and the other program gives the petrol allowance to employees.
FIRST PRG ********* REPORT ZPETROL_EXCLUDE TABLES SSCRFIELDS. SELECTION-SCREEN BEGIN OF SCREEN 100. SELECTION-SCREEN SKIP 9. PARAMETERS NUMBER(200) TYPE C. SELECTION-SCREEN SKIP 2. SELECTION-SCREEN: BEGIN OF LINE, PUSHBUTTON 2(10) TEXT-001 USER-COMMAND PROC, END OF LINE. SELECTION-SCREEN END OF SCREEN 100. CALL SCREEN 100. AT SELECTION-SCREEN. CASE SSCRFIELDS. WHEN 'PROC'. SET PARAMETER ID: 'NUM' FIELD NUMBER. CALL TRANSACTION 'ZP_PALLOWANCE'. LEAVE TO SCREEN 0. ENDCASE. SECOND PRG ********** REPORT ZPR_PETROL_ALLOWANCE NO STANDARD PAGE HEADING . *-- Infotypes INFOTYPES : 0000, "Actions 0002, "Personal Data 0008. "Basic pay details *-- Tables TABLES : PERNR, PC207, PCL1, PCL2, T510, T549A, T549Q, PA0002. "Standard Selections for HR Master Data Reporting "Payroll Results: Results Table "HR Cluster 1 "HR Cluster 2 "Pay scales "Payroll areas "Payroll Periods "Personal details

.

*-- Internal Tables *-- Internal Table Declaration For Holding The Data

. "Personnel Number "Pay Scale Level "Name of Employee "Petrol Allowance Amount DATA:BEGIN OF INT_PETROL2 OCCURS 0. PERNR LIKE PA0015-PERNR. BEGDA(010). DATA: WA_PET_ALLOWANCE TYPE ZBPETROL_ALL.Internal Table To Store Error Records.DATA: BEGIN OF INT_PETROL OCCURS 0. END OF PA0015_DATA. END OF PER_NO. TRFST LIKE PA0008-TRFST. DATA: BEGIN OF PA0015_DATA OCCURS 0. TRFST LIKE PA0008-TRFST. *-. DATA: FLAG TYPE I VALUE '0'. "Last Name TRFST LIKE PA0008-TRFST. PERNR LIKE PA0008-PERNR. "Pay Scale Level NAME(40). VALUES. "WORKAREA FOR INSERTING *DATA: P_LGART1 LIKE T512T-LGART VALUE '0010'. DATA : TITLE TYPE LVC_TITLE. "CHANGE WAGE TYPE HERE DATA: P_LGART1 LIKE T512T-LGART VALUE '0077'. DIS_FLAG TYPE I VALUE '0'. DATA: INT_PETROL3 LIKE STANDARD TABLE OF INT_PETROL2 INITIAL SIZE 0 WITH HEADER LINE. END OF INT_0015. "Petrol Allowance Amount END OF INT_PETROL2. DATA: BEGIN OF PER_NO OCCURS 0. MSG1(100) TYPE C. END OF INT_PETROL. PALLOWANCE TYPE P DECIMALS 2. "First Name NACHN LIKE PA0002-NACHN. PERNR LIKE PA0008-PERNR. DATA: E_INT_0015 LIKE INT_0015 OCCURS 0 WITH HEADER LINE. END OF MSG. DATA: BEGIN OF MSG OCCURS 0. DATA: INT_PETROL1 LIKE STANDARD TABLE OF INT_PETROL INITIAL SIZE 0 WITH HEADER LINE.Batch Input Data of Single Transaction DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE. "Name of Employee PALLOWANCE TYPE P DECIMALS 2. "Personnel Number VORNA LIKE PA0002-VORNA. *-. NAME(40). "CHANGE WAGE TYPE HERE DATA: BEGIN OF INT_0015 OCCURS 0. BETRG(018). PERNR(038). PERNR LIKE PA0008-PERNR. BETRG LIKE PA0015-BETRG.

International Include INCLUDE RPC2CD09. SELECTION-SCREEN COMMENT 1(30) TEXT-002. DATA EMPNO LIKE STANDARD TABLE OF EMP_NO INITIAL SIZE 0. LGTXT LIKE T512T-LGTXT. DATA: INT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.*-. *-. DATA EMPNO1 LIKE STANDARD TABLE OF EMP_NO1 INITIAL SIZE 0 WITH HEADER LINE. DATA: BEGIN OF EMP_NO1 OCCURS 0. "Cluster CA Data-Definition INCLUDE RPPPXD00. DATA TEMP_NUM(200) TYPE C. "Buffer Handling routine *-. PARAMETERS: P_RATE TYPE P DECIMALS 2.Initialization INITIALIZATION. DATA: ERR LIKE MESSAGE. INT_LAYOUT TYPE SLIS_LAYOUT_ALV.Country Specific Include INCLUDE PC2RXIN0. *-. "Common part buffer PCL1/PCL2 INCLUDE RPPPXM00.Includes *-. PERNR(4) TYPE C. WS_EVENTS TYPE SLIS_ALV_EVENT. INT_EVENTS TYPE SLIS_T_EVENT. DATA: BEGIN OF EMP_NO OCCURS 0.Internal Table For Export and Import Payroll Results DATA: INT_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE. SELECTION-SCREEN BEGIN OF LINE. *-.ALV Declaration TYPE-POOLS : SLIS. SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. *-. END OF EMP_NO. "Cluster CD data definition INCLUDE RPC2CA00. . WS_REPID = SY-REPID.At Selection-Screen START-OF-SELECTION. END OF EMP_NO1. WS_REPID LIKE SY-REPID. PERNR TYPE I. DATA LEN1 TYPE I. "Cluster IN data definition INCLUDE RPC2RX09. SELECTION-SCREEN POSITION 33. "Data Definition buffer PCL1/PCL2 Buffer INCLUDE RPPPXD10.

SELECTION-SCREEN END OF BLOCK B3. MOVE-CORRESPONDING RGDIR TO INT_RGDIR. RP-IMP-C2-IN. . *-. PARAMETERS: P_DI AS CHECKBOX. SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-003.Wate Type Text SELECT SINGLE LGTXT INTO LGTXT FROM T512T WHERE SPRSL = 'E' AND MOLGA = '40' AND LGART = P_LGART1 . * Read IN Cluster.Data Retrieval From Logical Database PNP GET PERNR. INT_PETROL1-PERNR = P0000-PERNR. SELECTION-SCREEN END OF BLOCK B2. SELECTION-SCREEN END OF BLOCK B1. PARAMETERS: P_UPLOAD AS CHECKBOX. SELECTION-SCREEN BEGIN OF BLOCK B3. *-. CONCATENATE P0002-VORNA P0002-NACHN INTO INT_PETROL1-NAME SEPARATED BY SPACE.Read All The Payroll Runs For An Employee CD-KEY-PERNR = PERNR-PERNR. P_FG RADIOBUTTON GROUP G1. *-. APPEND INT_RGDIR.Clear Data REFRESH: RT. RX-KEY-SEQNO = INT_RGDIR-SEQNR. RP-IMP-C2-CU. INT_RGDIR. *-. RX-KEY-PERNR = PERNR-PERNR. PROVIDE PERNR FROM P0000 VORNA NACHN FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA. SELECTION-SCREEN BEGIN OF BLOCK B4. CHECK RP-IMP-CD-SUBRC EQ 0.Clear Data CLEAR: RGDIR. INT_RGDIR. * Read the last record. LOOP AT RGDIR WHERE FPBEG >= PN-BEGDA AND FPEND <= PN-ENDDA. ENDPROVIDE. REFRESH: RGDIR. AT SELECTION-SCREEN. *-.SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK B4. P_BG RADIOBUTTON GROUP G1. SORT INT_RGDIR BY SEQNR DESCENDING. CHECK RP-IMP-IN-SUBRC EQ 0. ENDLOOP. CLEAR INT_RGDIR. READ TABLE INT_RGDIR INDEX 1.

ENDIF. SORT INT_PETROL1. CONCATENATE 'From' ' : ' PN-BEGDA+6(2) '.' PNBEGDA+0(4) ' To' ' : ' PN-ENDDA+6(2) '. "TO DISPLAY PETROL ALLOWANCE ONLY IF PNPTIMRA = 'X'. SELECT TRFST PERNR INTO CORRESPONDING FIELDS OF TABLE PER_NO FROM PA0008 WHERE TRFST LIKE 'L%' AND BET01 > 0. ELSE. IF PNPTIMR9 = 'X'.BEGDA AND ENDDA = PN-ENDDA. RATE GIVEN * CURRENT PERIOD UPLOADED BUT PAYROLL NOT WRITTEN SO NO RESULT FROM LDB SELECT RATE INTO P_RATE FROM ZBPETROL_ALL WHERE BEGDA = PN. SORT PER_NO. DELETE ADJACENT DUPLICATES FROM PER_NO.' PN-BEGDA+4(2) '. "CHECK OTHER PERIOD CHECKED DIS_FLAG = 1. END-OF-SELECTION. DELETE ADJACENT DUPLICATES FROM INT_PETROL1. INT_PETROL1-PALLOWANCE = RT-BETRG. CLEAR INT_PETROL1. ENDIF. SELECT PERNR SUM( BETRG ) INTO TABLE PA0015_DATA FROM PA0015 . " PETROL RATE EXSISTS. INT_PETROL-TRFST = PER_NO-TRFST. ENDSELECT. FLAG = 1.READ TABLE RT WITH KEY LGART = P_LGART1. "CHECK TO SEE CURRENT PERIOD SELECTED * CASES .' PN-ENDDA+4(2) '. ENDLOOP. IF SY-SUBRC = 0. "OF SY-DBCNT IF P_RATE > 0 AND FLAG = 1. MESSAGE I455(0) WITH 'NO PETROL RATE EXSISTS'.END-OF-SELECTION. IF SY-DBCNT = 0. LOOP AT INT_PETROL1. IF P_DI = 'X'.' PN-ENDDA+0(4) INTO TITLE. *-. APPEND INT_PETROL1. IF SY-SUBRC = 0. ENDIF. READ TABLE PER_NO WITH KEY PERNR = INT_PETROL1-PERNR. MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING TRFST.NO RATE GIVEN. ENDIF.

SELECT A~PERNR A~TRFST B~VORNA B~NACHN INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3 FROM PA0008 AS A INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR WHERE A~TRFST LIKE 'L%' AND A~BET01 > 0. ENDIF. ENDLOOP. APPEND INT_PETROL TO INT_PETROL1. "TO CONVERT THE FIRST SCREEN PERNR INTO . MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME. REFRESH INT_PETROL1. PERFORM GET_VALUE. MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME. DELETE ADJACENT DUPLICATES FROM INT_PETROL3. "loop to transport employee name CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO INT_PETROL2-NAME SEPARATED BY SPACE. LOOP AT INT_PETROL3 INTO INT_PETROL2. "P_RATE > 0 AND FLAG = 1. REFRESH INT_PETROL1. SORT INT_PETROL3.WHERE BEGDA BETWEEN PN-BEGDA AND PN-ENDDA GROUP BY PERNR. SORT INT_PETROL3. IF SY-SUBRC = 0. "loop to transport one table to another table READ TABLE PA0015_DATA WITH KEY PERNR = INT_PETROL2-PERNR. DELETE ADJACENT DUPLICATES FROM INT_PETROL3. "CURRENT PERIOD AND DATA NOT UPLOADED SELECT A~PERNR A~TRFST B~VORNA B~NACHN INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3 FROM PA0008 AS A INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR WHERE A~TRFST LIKE 'L%' AND A~BET01 > 0. LOOP AT INT_PETROL3 INTO INT_PETROL2. LOOP AT INT_PETROL3 INTO INT_PETROL2. DIS_FLAG = 1. INT_PETROL-PALLOWANCE = PA0015_DATA-BETRG. "loop to transport employee name CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO INT_PETROL2-NAME SEPARATED BY SPACE. IF P_RATE > 0 AND FLAG = 0. INT_PETROL-PERNR = INT_PETROL2-PERNR. ENDLOOP. INT_PETROL-TRFST = INT_PETROL2-TRFST. INT_PETROL-NAME = INT_PETROL2-NAME. ENDLOOP. ENDIF.

"CHECK OTHER PERIOD CHECKED MESSAGE I455(0) WITH 'Petrol Allowance cannot be uploaded'. WA_PET_ALLOWANCE-CURR = 'INR'. MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME. IF P_RATE > 0. WA_PET_ALLOWANCE-RATE = P_RATE. *----BDC IF P_UPLOAD = 'X'. INT_PETROL-NAME = INT_PETROL2-NAME. 'L3') AND A~BET01 > 0. PERFORM CAL_ALLOWANCE. LEAVE SCREEN. "loop to transport employee name CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO INT_PETROL2-NAME SEPARATED BY SPACE. ENDIF. " OF P_RATE > 0 DIS_FLAG = 1. ENDIF. IF SY-SUBRC <> 0. INT_PETROL-PERNR = INT_PETROL2-PERNR. ENDIF. ENDLOOP. DELETE ADJACENT DUPLICATES FROM INT_PETROL3. INSERT INTO ZBPETROL_ALL VALUES WA_PET_ALLOWANCE. INT_PETROL-TRFST = INT_PETROL2-TRFST. NUMBER FORMATE "TO CONVERT THE FIRST SCREEN PERNR INTO . SELECT A~PERNR A~TRFST B~VORNA B~NACHN INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3 FROM PA0008 AS A INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR WHERE A~TRFST IN ('L1' . WA_PET_ALLOWANCE-ENDDA = PN-ENDDA. IF PNPTIMRA = 'X'. PERFORM GET_VALUE. ENDLOOP. "CHECK TO SEE CURRENT PERIOD SELECTED WA_PET_ALLOWANCE-BEGDA = PN-BEGDA. SORT INT_PETROL3. * IF P_RATE > 0 OR P_RATE = 0. IF PNPTIMR9 = 'X'. REFRESH INT_PETROL1. APPEND INT_PETROL TO INT_PETROL1. " OF CHECK DISPLAY. ENDIF. ENDIF. " OF CURRENT PERIOD CHECK. LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport one table to another table READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR. 'L2' .NUMBER FORMATE LOOP AT INT_PETROL3 INTO INT_PETROL2.

LOOP AT INT_PETROL3 INTO INT_PETROL2.Handling Error records. MOVE: INT_PETROL1-PERNR TO INT_0015-PERNR. ENDLOOP. ELSE. CALL TRANSACTION 'PA30' USING BDCDATA MODE 'A' UPDATE 'S'. REFRESH BDCDATA. CONCATENATE PN-ENDDA+6(2) PN-ENDDA+4(2) PN-ENDDA+0(4) INTO INT_0015-BEGDA SEPARATED BY '. IF SY-SUBRC <> 0. INT_PETROL1-PALLOWANCE TO INT_0015-BETRG. CLEAR E_INT_0015. INT_PETROL-PERNR = INT_PETROL2-PERNR. "loop to transport one table to another table READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR. ENDIF. APPEND INT_0015.'. ENDLOOP. ENDIF. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING FILENAME = 'C:\Errors. LOOP AT INT_PETROL1. CLEAR INT_0015. DIS_FLAG = 1. IF P_FG = 'X'. *-. INT_PETROL-NAME = INT_PETROL2-NAME. ENDLOOP.Downloading Error Records. ENDIF. CALL TRANSACTION 'PA30' USING BDCDATA MODE 'N' UPDATE 'S'.Txt' FILETYPE = 'ASC' TABLES DATA_TAB = E_INT_0015. INT_PETROL-TRFST = INT_PETROL2-TRFST. IF SY-SUBRC <> 0. SORT INT_PETROL1. MOVE-CORRESPONDING INT_0015 TO E_INT_0015. PERFORM F_BDCDATA. *-. LOOP AT INT_0015.Handling Error Messages PERFORM ERROR_MSG. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING FILENAME = 'C:\Err_Msg. *-. APPEND INT_PETROL TO INT_PETROL1. PERFORM CAL_ALLOWANCE.Downloading Error Messages. *-.Txt' . APPEND E_INT_0015.

*&-------------------------------------------------------------------* *& Form GET_VALUE *&-------------------------------------------------------------------* * text *--------------------------------------------------------------------* FORM GET_VALUE. ELSE. " FOR PETROL RATE ENDIF. PERFORM GET_EVENTS_ALV. LEN1 = STRLEN( TEMP_NUM ). APPEND TEMP_NUM TO EMPNO. IF TEMP_NUM <> ''. PERFORM FILL_FIELDCAT. IF SY-SUBRC <> 0. ENDIF. " FOR UPLOAD IF DIS_FLAG = 1. * ENDIF. INT_LAYOUT-ZEBRA = 'X'. CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS' . MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. MESSAGE I455(0) WITH 'Enter Petrol Rate'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = WS_REPID IS_LAYOUT = INT_LAYOUT IT_FIELDCAT = INT_FIELDCAT[] I_DEFAULT = 'X' I_SAVE = 'X' IT_EVENTS = INT_EVENTS TABLES T_OUTTAB = INT_PETROL1 EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. LEAVE TO SCREEN 0.FILETYPE = 'ASC' TABLES DATA_TAB = MSG. PERFORM GET_PERNR. INT_LAYOUT-TOTALS_TEXT = TEXT-004. LOOP AT EMPNO INTO EMP_NO. " FOR CURRENT PERIOD ENDIF. ENDIF. ENDIF. INT_LAYOUT-SUBTOTALS_TEXT = TEXT-004. GET PARAMETER ID: 'NUM' FIELD TEMP_NUM.

' = 'STRING' = ' ' = EMP_NO-PERNR = ' ' = ' ' = '0' = = EMP_NO1-PERNR = ERR = IF ( ERR-MSGID = '' ).* * * * * * * .' INTO EMP_NO TEMP_NUM. PERFORM GET_PERNR. ENDIF. CLEAR EMP_NO. ENDFORM. IF SY-SUBRC = 0. APPEND EMP_NO TO EMPNO. ENDLOOP. ELSE. ENDIF. ENDIF. APPEND EMP_NO1 TO EMPNO1.'. MESSAGE I455(0) WITH 'Could not convert employee number'. EXPORTING DFELD DMZEI DTYPE DYPNO EFELD FNAME PROGR IMP_DECIMALS IMPORTING ERROR IFELD MESSG MSGLN = ' ' = '. LEAVE TO SCREEN 0. "GET_VALUE *&-------------------------------------------------------------------* *& Form GET_PERNR *&-------------------------------------------------------------------* * text *--------------------------------------------------------------------* FORM GET_PERNR.p2 text *---------------------------------------------------------------------* . SPLIT TEMP_NUM AT '. "GET_PERNR *&--------------------------------------------------------------------* *& Form ERROR_MSG *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * --> p1 text * <-. ENDFORM. SEARCH TEMP_NUM FOR '. CLEAR EMP_NO1-PERNR.

"CHANGE WAGE TYPE HERE USING 'Q0015-BETRG' INT_0015-BETRG.FORM ERROR_MSG. USING 'MP001500' '2000'. USING 'BDC_CURSOR' 'RP50G-CHOIC'. USING 'P0015-BEGDA' INT_0015-BEGDA. USING 'P0015-LGART' '0077'. USING 'BDC_CURSOR' 'Q0015-BETRG'. CALL FUNCTION 'FORMAT_MESSAGE' EXPORTING LANG = SY-LANGU IMPORTING MSG = MSG-MSG1. PERFORM BDC_DYNPRO PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_DYNPRO PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_FIELD ALSO PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_DYNPRO PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_FIELD ALSO USING 'SAPMP50A' '1000'. USING 'RP50G-TIMR6' 'X'. USING 'P0015-LGART' '0077'. USING 'MP001500' '2000'. ENDIF. "CHANGE WAGE TYPE HERE . "ERROR_MSG *&-------------------------------------------------------------------* *& Form F_BDCDATA *&-------------------------------------------------------------------* * text *--------------------------------------------------------------------* FORM F_BDCDATA. USING 'BDC_OKCODE' '=INS'. USING 'BDC_OKCODE' '/00'. CLEAR MSG. USING 'BDC_OKCODE' '=UPD'. ENDFORM. USING 'BDC_CURSOR' 'P0015-LGART'. USING 'RP50G-PERNR' INT_0015-PERNR. APPEND MSG. USING 'RP50G-CHOIC' '0015'. IF SY-SUBRC <> 0. USING 'P0015-WAERS' 'INR'.

USING 'P0015-WAERS' 'INR'. BDCDATA-DYNBEGIN = 'X'. BDCDATA-FVAL = P_0756. " BDC_DYNPRO *&--------------------------------------------------------------------* *& Form BDC_FIELD *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * -->P_0755 text * -->P_0756 text *---------------------------------------------------------------------* FORM BDC_FIELD USING VALUE(P_0755) TYPE C VALUE(P_0756) TYPE C. CLEAR BDCDATA. ENDFORM. "F_BDCDATA *&--------------------------------------------------------------------* *& Form BDC_DYNPRO *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * -->P_0732 text * -->P_0733 text *---------------------------------------------------------------------* FORM BDC_DYNPRO USING VALUE(P_0732) TYPE C VALUE(P_0733) TYPE C. BDCDATA-PROGRAM = P_0732. ENDFORM. USING 'P0015-BEGDA' INT_0015-BEGDA. BDCDATA-FNAM = P_0755. CLEAR BDCDATA. APPEND BDCDATA. APPEND BDCDATA. " BDC_FIELD *&-------------------------------------------------------------------* *& Form CAL_ALLOWANCE *&-------------------------------------------------------------------* . BDCDATA-DYNPRO = P_0733. USING 'Q0015-BETRG' INT_0015-BETRG.PERFORM BDC_FIELD PERFORM BDC_FIELD PERFORM BDC_FIELD ENDFORM.

ELSEIF INT_PETROL-TRFST = 'L5'. ENDFORM. INT_FIELDCAT-COL_POS = 2. ELSEIF INT_PETROL-TRFST = 'L3'. INT_FIELDCAT-COL_POS = 1. INT_FIELDCAT-TABNAME = 'INT_PETROL1'. INT_FIELDCAT-COL_POS = 3. LOOP AT INT_PETROL1 INTO INT_PETROL.* text *--------------------------------------------------------------------* FORM CAL_ALLOWANCE. * INT_PETROL-PALLOWANCE = P_RATE * 200. INT_FIELDCAT-OUTPUTLEN = 10. IF INT_PETROL-TRFST = 'L1'. * INT_PETROL-PALLOWANCE = P_RATE * 250. INT_FIELDCAT-TABNAME = 'INT_PETROL1'. INT_FIELDCAT-FIELDNAME = 'PERNR'. MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING PALLOWANCE. INT_PETROL-PALLOWANCE = P_RATE * 150. CLEAR INT_FIELDCAT. ELSEIF INT_PETROL-TRFST = 'L4'. INT_FIELDCAT-TABNAME = 'INT_PETROL1'. INT_FIELDCAT-OUTPUTLEN = 25. ENDLOOP.p2 text *---------------------------------------------------------------------* FORM FILL_FIELDCAT. INT_PETROL-PALLOWANCE = P_RATE * 150. INT_FIELDCAT-KEY = 'X'. INT_FIELDCAT-FIELDNAME = 'TRFST'. "CAL_ALLOWANCE *&--------------------------------------------------------------------* *& Form FILL_FIELDCAT *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * --> p1 text * <-. INT_FIELDCAT-FIELDNAME = 'NAME'. "CHANGE TO SELECT WHEN DISPLAY ELSEIF INT_PETROL-TRFST = 'L2'. INT_FIELDCAT-SELTEXT_L = TEXT-006. APPEND INT_FIELDCAT. . ENDIF. APPEND INT_FIELDCAT. INT_FIELDCAT-SELTEXT_L = TEXT-005. INT_PETROL-PALLOWANCE = P_RATE * 100. CLEAR INT_FIELDCAT. INT_FIELDCAT-KEY = 'X'.

ENDIF. " GET_EVENTS_ALV *&-------------------------------------------------------------------* *& Form TOP-OF-PAGE . MODIFY INT_EVENTS FROM WS_EVENTS INDEX SY-TABIX.p2 text *---------------------------------------------------------------------* FORM GET_EVENTS_ALV. INT_FIELDCAT-KEY = 'X'. INT_FIELDCAT-COL_POS = 4. INT_FIELDCAT-OUTPUTLEN = 16. ENDFORM. " FILL_FIELDCAT *&--------------------------------------------------------------------* *& Form GET_EVENTS_ALV *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * --> p1 text * <-. IF SY-SUBRC = 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. READ TABLE INT_EVENTS INTO WS_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE. CLEAR INT_FIELDCAT. INT_FIELDCAT-FIELDNAME = 'PALLOWANCE'.INT_FIELDCAT-SELTEXT_L = TEXT-007. WS_EVENTS-FORM = 'TOP'. ENDFORM. INT_FIELDCAT-SELTEXT_L = TEXT-008. IF SY-SUBRC <> 0. ENDIF. INT_FIELDCAT-TABNAME = 'INT_PETROL1'. CLEAR INT_FIELDCAT. APPEND INT_FIELDCAT. CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING I_LIST_TYPE = 1 IMPORTING ET_EVENTS = INT_EVENTS[] EXCEPTIONS LIST_TYPE_WRONG = 1 OTHERS = 2. INT_FIELDCAT-OUTPUTLEN = 5. APPEND INT_FIELDCAT. INT_FIELDCAT-KEY = 'X'.

CLEAR WA_HEADER.Title WA_HEADER-TYP = 'H'. APPEND WA_HEADER TO WS_HEADER. WA_HEADER-INFO = ' '. CLEAR WA_HEADER. *-. *-. ENDFORM. WA_HEADER-TYP = 'H'. WA_HEADER-INFO = TEXT-009.ALV Declarations DATA: WS_HEADER TYPE SLIS_T_LISTHEADER. "TOP-OF-PAGE . CLEAR WA_HEADER. WA_HEADER-INFO = TITLE. WA_HEADER-INFO = ' '. WA_HEADER-TYP = 'H'. APPEND WA_HEADER TO WS_HEADER. APPEND WA_HEADER TO WS_HEADER. CLEAR WA_HEADER. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING IT_LIST_COMMENTARY = WS_HEADER I_LOGO = 'LOGO'. WA_HEADER-TYP = 'H'.*&-------------------------------------------------------------------* * text *--------------------------------------------------------------------* FORM TOP. WA_HEADER TYPE SLIS_LISTHEADER. APPEND WA_HEADER TO WS_HEADER.