REPORT Y_UNAPPROVED_POS_REPORT. TYPE-POOLS : SLIS. " SLIS is the type library for ALV grid Tables: EKPO, EKKN, EKKO, t16fd, t16fc. Types : BEGIN OF itab, EBELN LIKE EKPO-EBELN , " PO No PS_PSP_PNR LIKE EKKN-PS_PSP_PNR , " WBSE NPLNR LIKE EKKN-NPLNR , " Network Activity PROJN LIKE EKKN-PROJN , " Porject No TXZ01 LIKE EKPO-TXZ01 , " Item Description WERKS LIKE EKPO-WERKS , " Plant Code SAKTO LIKE EKKN-SAKTO , " GL Account KOSTL LIKE EKKN-KOSTL , " Cost Center FIPOS LIKE EKKN-FIPOS , " Commitment Item AUFNR LIKE EKKN-AUFNR , " Maintenance Order BEDAT LIKE EKKO-BEDAT , " PO DATE FRGGR LIKE T16FS-FRGGR , " Release group FRGSX LIKE T16FS-FRGSX , " Release strategy FRGC1 LIKE T16FS-FRGC1 , " Release code 1 FRGC2 LIKE T16FS-FRGC2 , " Release code 2 FRGC3 LIKE T16FS-FRGC3 , " Release code 3 FRGC4 LIKE T16FS-FRGC4 , " Release code 4 FRGC5 LIKE T16FS-FRGC5 , " Release code 5 FRGC6 LIKE T16FS-FRGC6 , " Release code 6 FRGC7 LIKE T16FS-FRGC7 , " Release code 7 FRGC8 LIKE T16FS-FRGC8 , " Release code 8 FRGCO LIKE T16FC-FRGCO , " Release Strategy Code REL_CODE TYPE STRING , " CONCATENATED Release code REL_CODE_DESC TYPE STRING , " CONCATENATED Release code DESCRIPTIONS AGE1 LIKE VTBBEWE-ATAGE, AGE2 LIKE VTBBEWE-ATAGE, AGE3 LIKE VTBBEWE-ATAGE, AGE4 LIKE VTBBEWE-ATAGE, END OF itab. data: it_itab TYPE STANDARD TABLE of itab INITIAL SIZE 0 , wa_itab type itab. data: fieldcatalog type slis_t_fieldcat_alv with header line, gd_tab_group type slis_t_sp_group_alv, gd_layout type slis_layout_alv, gd_repid like sy-repid, gt_events type slis_t_event, gd_prntparams type slis_print_alv. Selection-screen begin of block B3 with frame title text-001. SELECT-OPTIONS: EBELN FOR EKPO-EBELN, PS_PNR FOR EKKN-PS_PSP_PNR, NPLNR FOR EKKN-NPLNR, PROJN FOR EKKN-PROJN, TXZ01 FOR EKPO-TXZ01, WERKS FOR EKPO-WERKS, SAKTO FOR EKKN-SAKTO, KOSTL FOR EKKN-KOSTL, FIPOS FOR EKKN-FIPOS, AUFNR FOR EKKN-AUFNR, BEDAT FOR EKKO-BEDAT. Selection-screen end of block B3. Select: distinct EKPO~EBELN EKKN~PS_PSP_PNR EKKN~NPLNR EKKN~PROJN EKPO~TXZ01 EKPO~WERKS EKKN~SAKTO EKKN~KOSTL EKKN~FIPOS EKKN~AUFNR EKKO~BEDAT T16FS~FRGGR " Release code 1 T16FS~FRGC1 " Release code 1 T16FS~FRGC2 " Release code 2 T16FS~FRGC3 " Release code 3 T16FS~FRGC4 " Release code 4 T16FS~FRGC5 " Release code 5 T16FS~FRGC6 " Release code 6 T16FS~FRGC7 " Release code 7 T16FS~FRGC8 " Release code 8 T16FC~FRGCO " Release Strategy Code INTO CORRESPONDING FIELDS OF wa_itab from EKPO INNER join EKKN on EKPO~EBELN = EKKN~EBELN INNER join EKKO on EKPO~EBELN = EKKO~EBELN INNER join T16FS on EKKO~FRGGR = T16FS~FRGGR AND EKKO~FRGSX = T16FS~FRGSX INNER join T16FC on EKKO~FRGGR = T16FC~FRGGR **UP TO 500 ROWS WHERE EKPO~EBELN IN EBELN AND EKKN~PS_PSP_PNR IN PS_PNR AND EKKN~NPLNR IN NPLNR AND EKKN~PROJN IN PROJN AND EKPO~TXZ01 IN TXZ01 AND EKPO~WERKS IN WERKS AND EKKN~SAKTO IN SAKTO AND EKKN~KOSTL IN KOSTL AND EKKN~FIPOS IN FIPOS AND EKKN~AUFNR IN AUFNR AND EKKO~BEDAT IN BEDAT AND EKKO~frgke Not IN ('Y','R') . APPEND WA_ITAB TO IT_ITAB. Endselect. *&---------------------------------------------------------------------* *& Data fields to store number of days, months and years from specified date to current date *&---------------------------------------------------------------------* DATA: EDAYS LIKE VTBBEWE-ATAGE, EMONTHS LIKE VTBBEWE-ATAGE, EYEARS LIKE VTBBEWE-ATAGE, DESC_TEMP type String, " Release code 8. FRGC1_TEMP LIKE T16FS-FRGC1 , " Release code 1 FRGC2_TEMP LIKE T16FS-FRGC2 , " Release code 2 FRGC3_TEMP LIKE T16FS-FRGC3 , " Release code 3 FRGC4_TEMP LIKE T16FS-FRGC4 , " Release code 4 FRGC5_TEMP LIKE T16FS-FRGC5 , " Release code 5 FRGC6_TEMP LIKE T16FS-FRGC6 , " Release code 6 FRGC7_TEMP LIKE T16FS-FRGC7 , " Release code 7 FRGC8_TEMP LIKE T16FS-FRGC8. " Release code 8. data: FROMDATE LIKE VTBBEWE-DBERVON. *&---------------------------------------------------------------------* *& Looping at internal table to process the Document Date in Document *& inorder to calculate total number of days, months and years from specified date to current date *&---------------------------------------------------------------------* LOOP AT IT_ITAB INTO WA_ITAB. FROMDATE = wa_itab-BEDAT. IF wa_itab-FRGC1 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC1. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC1 ',' INTO wa_itab-REL_CODE. CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ' , ' INTO wa_itab-REL_CODE_DESC. CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. IF wa_itab-FRGC2 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC2. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC2 ', ' space INTO wa_itab-REL_CODE . CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' space INTO wa_itab-REL_CODE_DESC . CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. IF wa_itab-FRGC3 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC3. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC3 ', ' INTO wa_itab-REL_CODE . CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC . CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. IF wa_itab-FRGC4 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC4. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC4 ', ' INTO wa_itab-REL_CODE . CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC . CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. IF wa_itab-FRGC5 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC5. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC5 ', ' INTO wa_itab-REL_CODE . CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC . CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. IF wa_itab-FRGC6 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC6. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC6 ', ' INTO wa_itab-REL_CODE . CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC . CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. IF wa_itab-FRGC7 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC7. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC7 ', ' INTO wa_itab-REL_CODE . CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC . CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. IF wa_itab-FRGC8 ne ''. SELECT T16FD~FRGCT into DESC_TEMP from T16FD where T16FD~FRGGR = wa_itab-FRGGR and T16FD~FRGCO = wa_itab-FRGC8. endselect. CONCATENATE wa_itab-REL_CODE wa_itab-FRGC8 ', ' INTO wa_itab-REL_CODE . CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE. CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC . CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY SPACE . endif. call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS' exporting i_date_from = FROMDATE i_date_to = sy-datum IMPORTING E_DAYS = EDAYS E_MONTHS = EMONTHS E_YEARS = EYEARS. if EDAYS < 31. wa_itab-age1 = EDAYS. ELSEIF EDAYS < 61. wa_itab-age2 = EDAYS. ELSEIF EDAYS < 91. wa_itab-age3 = EDAYS. ELSE. wa_itab-age4 = EDAYS. endif. MODIFY it_itab INDEX sy-tabix FROM wa_itab. ENDLOOP. **perform data_retrieval. perform build_fieldcatalog. perform build_layout. perform build_events. *perform build_print_params. perform display_alv_report. *&---------------------------------------------------------------------* *& Form BUILD_FIELDCATALOG *&---------------------------------------------------------------------* * Build Fieldcatalog for ALV Report *----------------------------------------------------------------------* form build_fieldcatalog. * There are a number of ways to create a fieldcat. * For the purpose of this example i will build the fieldcatalog manualy * by populating the internal table fields individually and then * appending the rows. This method can be the most time consuming but can * also allow you more control of the final product. * Beware though, you need to ensure that all fields required are * populated. When using some of functionality available via ALV, such as * total. You may need to provide more information than if you were * simply displaying the result * I.e. Field type may be required in-order for * the 'TOTAL' function to work. fieldcatalog-fieldname = 'EBELN'. " field Name fieldcatalog-seltext_m = 'PO No'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'PS_PSP_PNR'. " field Name fieldcatalog-seltext_m = 'WBSE'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'NPLNR'. " field Name fieldcatalog-seltext_m = 'Network Activity'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'PROJN'. " field Name fieldcatalog-seltext_m = 'Project No'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'TXZ01'. " field Name fieldcatalog-seltext_m = 'Item Description'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'WERKS'. " field Name fieldcatalog-seltext_m = 'Plant Code'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'SAKTO'. " field Name fieldcatalog-seltext_m = 'GL Account'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'KOSTL'. " field Name fieldcatalog-seltext_m = 'Cost Center'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'FIPOS'. " field Name fieldcatalog-seltext_m = 'Commitment Item'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AUFNR'. " field Name fieldcatalog-seltext_m = 'Maintenance Order'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'BEDAT'. " field Name fieldcatalog-seltext_m = 'Document Creation Date'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC1'. " field Name "fieldcatalog-seltext_m = 'RC 1'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC2'. " field Name "fieldcatalog-seltext_m = 'RC 2'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC3'. " field Name "fieldcatalog-seltext_m = 'RC 3'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC4'. " field Name "fieldcatalog-seltext_m = 'RC 4'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC5'. " field Name "fieldcatalog-seltext_m = 'RC 5'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC6'. " field Name "fieldcatalog-seltext_m = 'RC 6'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC7'. " field Name "fieldcatalog-seltext_m = 'RC 7'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGC8'. " field Name "fieldcatalog-seltext_m = 'RC 8'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. "fieldcatalog-fieldname = 'FRGCO'. " field Name "fieldcatalog-seltext_m = 'Release Strategy Code'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. fieldcatalog-fieldname = 'REL_CODE'. " field Name fieldcatalog-seltext_m = 'Release Code'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'REL_CODE_DESC'. " field Name fieldcatalog-seltext_m = 'Release Code Description'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AGE1'. " field Name fieldcatalog-seltext_m = 'Pending since 0-30 Days'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AGE2'. " field Name fieldcatalog-seltext_m = 'Pending since 31-60 Days'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AGE3'. " field Name fieldcatalog-seltext_m = 'Pending since 61-90 Days'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AGE4'. " field Name fieldcatalog-seltext_m = 'Pending since More than 90 Days'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. endform. " BUILD_FIELDCATALOG *&---------------------------------------------------------------------* *& Form BUILD_LAYOUT *&---------------------------------------------------------------------* * Build layout for ALV grid report *----------------------------------------------------------------------* form build_layout. gd_layout-no_input = 'X'. gd_layout-colwidth_optimize = 'X'. gd_layout-totals_text = 'Totals'(201). * gd_layout-totals_only = 'X'. * gd_layout-f2code = 'DISP'. "Sets fcode for when double * "click(press f2) * gd_layout-zebra = 'X'. * gd_layout-group_change_edit = 'X'. * gd_layout-header_text = 'helllllo'. endform. " BUILD_LAYOUT *&---------------------------------------------------------------------* *& Form DISPLAY_ALV_REPORT *&---------------------------------------------------------------------* * Display report using ALV grid *----------------------------------------------------------------------* form display_alv_report. gd_repid = sy-repid. call function 'REUSE_ALV_GRID_DISPLAY' exporting i_callback_program = gd_repid i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM * i_callback_user_command = 'USER_COMMAND' * i_grid_title = outtext is_layout = gd_layout it_fieldcat = fieldcatalog[] * it_special_groups = gd_tabgroup it_events = gt_events is_print = gd_prntparams i_save = 'X' * is_variant = z_template tables t_outtab = it_itab exceptions program_error = 1 others = 2. if sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. endif. endform. " DISPLAY_ALV_REPORT *-------------------------------------------------------------------* * Form TOP-OF-PAGE * *-------------------------------------------------------------------* * ALV Report Header * *-------------------------------------------------------------------* Form top-of-page. *ALV Header declarations data: t_header type slis_t_listheader, wa_header type slis_listheader, t_line like wa_header-info, ld_lines type i, ld_linesc(10) type c. * Title wa_header-typ = 'H'. wa_header-info = 'Review of Unapproved POs Report'. append wa_header to t_header. clear wa_header. * Date wa_header-typ = 'S'. wa_header-key = 'Date: '. CONCATENATE sy-datum+6(2) '.' sy-datum+4(2) '.' sy-datum(4) INTO wa_header-info. "todays date append wa_header to t_header. clear: wa_header. * Total No. of Records Selected describe table it_itab lines ld_lines. ld_linesc = ld_lines. concatenate 'Total No. of Records Selected: ' ld_linesc into t_line separated by space. wa_header-typ = 'A'. wa_header-info = t_line. append wa_header to t_header. clear: wa_header, t_line. call function 'REUSE_ALV_COMMENTARY_WRITE' exporting it_list_commentary = t_header. * i_logo = 'Z_LOGO'. endform. *------------------------------------------------------------------* * FORM USER_COMMAND * *------------------------------------------------------------------* * --> R_UCOMM * * --> RS_SELFIELD * *------------------------------------------------------------------* *FORM user_command USING r_ucomm LIKE sy-ucomm * rs_selfield TYPE slis_selfield. * ** Check function code * CASE r_ucomm. * WHEN '&IC1'. ** Check field clicked on within ALVgrid report * IF rs_selfield-fieldname = 'EBELN'. ** Read data table, using index of row user clicked on * READ TABLE itab INTO wa_EKPO INDEX rs_selfield-tabindex. ** Set parameter ID for transaction screen field * SET PARAMETER ID 'BES' FIELD wa_EKPO-EBELN. ** Sxecute transaction ME23N, and skip initial data entry screen * CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN. * ENDIF. * ENDCASE. *ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_EVENTS *&---------------------------------------------------------------------* * Build events table *----------------------------------------------------------------------* form build_events. data: ls_event type slis_alv_event. call function 'REUSE_ALV_EVENTS_GET' exporting i_list_type = 0 importing et_events = gt_events[]. read table gt_events with key name = slis_ev_end_of_page into ls_event. if sy-subrc = 0. move 'END_OF_PAGE' to ls_event-form. append ls_event to gt_events. endif. read table gt_events with key name = slis_ev_end_of_list into ls_event. if sy-subrc = 0. move 'END_OF_LIST' to ls_event-form. append ls_event to gt_events. endif. endform. " BUILD_EVENTS *&---------------------------------------------------------------------* *& Form BUILD_PRINT_PARAMS *&---------------------------------------------------------------------* * Setup print parameters *----------------------------------------------------------------------* form build_print_params. gd_prntparams-reserve_lines = '3'. "Lines reserved for footer gd_prntparams-no_coverpage = 'X'. endform. " BUILD_PRINT_PARAMS *&---------------------------------------------------------------------* *& Form END_OF_PAGE *&---------------------------------------------------------------------* form END_OF_PAGE. data: listwidth type i, ld_pagepos(10) type c, ld_page(10) type c. write: sy-uline(50). skip. write:/40 'Page:', sy-pagno . endform. *&---------------------------------------------------------------------* *& Form END_OF_LIST *&---------------------------------------------------------------------* form END_OF_LIST. data: listwidth type i, ld_pagepos(10) type c, ld_page(10) type c. skip. write:/40 'Page:', sy-pagno . endform.