*----------------------------------------------------------------------* * DECLARATIONS * *----------------------------------------------------------------------* DATA: gr_dref TYPE REF TO data, gr_alv TYPE REF TO cl_salv_table. FIELD-SYMBOLS: <gf_tab> TYPE STANDARD TABLE. *----------------------------------------------------------------------* * LAYOUT * *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001. PARAMETERS: pa_tab TYPE tabname OBLIGATORY. SELECTION-SCREEN END OF BLOCK b1. *----------------------------------------------------------------------* * PROGRAM BODY * *----------------------------------------------------------------------* START-OF-SELECTION. CREATE DATA gr_dref TYPE TABLE OF (pa_tab). ASSIGN gr_dref->* TO <gf_tab>. SELECT * FROM (pa_tab) INTO TABLE <gf_tab>. END-OF-SELECTION. PERFORM output_alv. *----------------------------------------------------------------------* * FORM OUTPUT_ALV * *----------------------------------------------------------------------* FORM output_alv. TYPE-POOLS slis. DATA: ls_fieldcat TYPE slis_fieldcat_alv, lt_fieldcat TYPE slis_t_fieldcat_alv, ls_layout TYPE slis_layout_alv, ls_glay TYPE lvc_s_glay. CLEAR lt_fieldcat[]. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_program_name = sy-cprog i_structure_name = pa_tab i_inclname = sy-cprog CHANGING ct_fieldcat = lt_fieldcat. ls_fieldcat-edit = 'X'. MODIFY lt_fieldcat FROM ls_fieldcat TRANSPORTING edit WHERE col_pos > 0. ls_layout-colwidth_optimize = 'X'. ls_layout-zebra = 'X'. ls_glay-edt_cll_cb = 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = sy-cprog i_callback_pf_status_set = 'PF_STATUS_SET' i_callback_user_command = 'USER_COMMAND' i_callback_top_of_page = 'TOP_OF_PAGE' i_background_id = 'ALV_BACKGROUND' i_grid_settings = ls_glay is_layout = ls_layout it_fieldcat = lt_fieldcat i_save = 'A' TABLES t_outtab = <gf_tab>. ENDFORM. "output_alv *----------------------------------------------------------------------* * FORM PF_STATUS_SET * *----------------------------------------------------------------------* FORM pf_status_set USING p_extab TYPE slis_t_extab. SET PF-STATUS 'ZSTANDARD' EXCLUDING p_extab. ENDFORM. "pf_status_set *----------------------------------------------------------------------* * FORM USER_COMMAND * *----------------------------------------------------------------------* FORM user_command USING p_ucomm LIKE sy-ucomm p_selfield TYPE slis_selfield. FIELD-SYMBOLS: <lf_line> TYPE any. CASE p_ucomm. WHEN '&SAVE'. DELETE FROM (pa_tab). LOOP AT <gf_tab> ASSIGNING <lf_line>. MODIFY (pa_tab) FROM <lf_line>. ENDLOOP. WHEN '&APPEND'. APPEND INITIAL LINE TO <gf_tab>. p_selfield-refresh = 'X'. WHEN '&DEL'. DELETE <gf_tab> INDEX p_selfield-tabindex. p_selfield-refresh = 'X'. ENDCASE. ENDFORM. "user_command *----------------------------------------------------------------------* * FORM TOP_OF_PAGE * *----------------------------------------------------------------------* FORM top_of_page. DATA: lt_listheader TYPE slis_t_listheader, ls_listheader TYPE slis_listheader. ls_listheader-typ = 'H'. ls_listheader-info = pa_tab. APPEND ls_listheader TO lt_listheader. ls_listheader-typ = 'A'. CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum+0(4) INTO ls_listheader-info SEPARATED BY '/'. CONCATENATE ':' ls_listheader-info INTO ls_listheader-info SEPARATED BY space. CONCATENATE 'Data'(a01) ls_listheader-info INTO ls_listheader-info. APPEND ls_listheader TO lt_listheader. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = lt_listheader i_logo = 'BENETTON_LOGO'. ENDFORM. "top_of_page *----------------------------------------------------------------------*
giovedì 2 febbraio 2017
SM30 custom
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento