Saturday, December 18, 2010
Use function module REUSE_ALV_COMMENTARY_WRITE in TOP_OF_PAGE event when call function module REUSE_ALV_GRID_DISPLAY.
REPORT zvenkat_alv_2_grid. TYPES: BEGIN OF t_mard, werks TYPE mard-werks, lgort TYPE mard-lgort, matnr TYPE mard-matnr, insme TYPE mard-insme, einme TYPE mard-einme, speme TYPE mard-speme, END OF t_mard. DATA: w_mard TYPE t_mard. DATA: i_mard TYPE STANDARD TABLE OF t_mard. *&---------------------------------------------------------------------* *& ALV Variables *&---------------------------------------------------------------------* TYPE-POOLS :slis. DATA : i_field TYPE slis_t_fieldcat_alv, w_field LIKE LINE OF i_field, i_events TYPE slis_t_event, w_events LIKE LINE OF i_events. *&---------------------------------------------------------------------* *& START-OF-SELECTION *&---------------------------------------------------------------------* START-OF-SELECTION. PERFORM get_data_from_database . *&---------------------------------------------------------------------* *& END-OF-SELECTION *&---------------------------------------------------------------------* END-OF-SELECTION. PERFORM build_fieldcatalog. PERFORM display_data. *&---------------------------------------------------------------------* *& Form build_fieldcatalog *&---------------------------------------------------------------------* FORM build_fieldcatalog . CLEAR : w_field, i_field[]. PERFORM build_fcat USING: 'WERKS' 'I_MARD' 'WERKS', 'LGORT' 'I_MARD' 'LGORT', 'MATNR' 'I_MARD' 'MATNR', 'INSME' 'I_MARD' 'INSME', 'EINME' 'I_MARD' 'EINME', 'SPEME' 'I_MARD' 'SPEME'. ENDFORM. " build_fieldcatalog *&---------------------------------------------------------------------* *& Form display_data *&---------------------------------------------------------------------* FORM display_data . DATA :program LIKE sy-repid VALUE sy-repid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = program i_callback_top_of_page = 'TOP_OF_PAGE' it_fieldcat = i_field TABLES t_outtab = i_mard. 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_data *&---------------------------------------------------------------------* *& Form get_data_from_database *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM get_data_from_database . CLEAR :i_mard, i_mard[]. SELECT werks lgort matnr insme einme speme FROM mard INTO CORRESPONDING FIELDS OF TABLE i_mard UP TO 100 ROWS. ENDFORM. " get_data_from_database *&---------------------------------------------------------------------* *& Form top_of_page *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM top_of_page. DATA : i_header TYPE slis_t_listheader, w_header LIKE LINE OF i_header. DATA:l_date1 TYPE datum, l_date2 TYPE datum. w_header-typ = 'S'. w_header-info = sy-title. APPEND w_header TO i_header. CLEAR w_header. w_header-typ = 'H'. w_header-info = sy-repid. APPEND w_header TO i_header. CLEAR w_header. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = i_header i_logo = 'ENJOYSAP_LOGO'. ENDFORM. "top_of_page *&---------------------------------------------------------------------* *& Form BUILD_FCAT *&---------------------------------------------------------------------* FORM build_fcat USING l_field l_tab l_text. w_field-fieldname = l_field. w_field-tabname = l_tab. w_field-seltext_m = l_text. APPEND w_field TO i_field. CLEAR w_field. ENDFORM. " BUILD_FCAT
Output
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Sending email with pdf attachment
- ABAP - Step by step tutorial on Smart Forms - Template Node
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.