Help on ALV GRID display outputting format for 2 internal tables

Hi,
    I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
Regards,
Mira

Hi,
U can try out this code
REPORT zzz_test NO STANDARD PAGE HEADING
                       MESSAGE-ID zz.
The Data Declarations
INCLUDE zzm_test_alv_data.
The Selection Screen Definition
INCLUDE zzm_test_alv_selscrn.
The definition and implementation of the event reciever class
INCLUDE zzm_test_alv_class.
START-OF-SELECTION
START-OF-SELECTION.
  PERFORM f1000_load_itabs.
END-OF-SELECTION
END-OF-SELECTION.
  IF NOT cb_disp IS INITIAL.
    CALL SCREEN 9001.
  ENDIF.
Include for getting data
  INCLUDE zzm_test_alv_forms.
Include for PAI and PBO of screen
  INCLUDE zzm_test_alv_screen.
  INCLUDE ZZM_TEST_ALV_DATA                                          *
This include has all the data declaration defined
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
Table Declarations:
TABLES: mara,
        makt.
Internal Tables:
The following structure type must be defined in the data dictionary
DATA:  i_fieldcat  TYPE lvc_t_fcat,
       i_fieldcat1 TYPE lvc_t_fcat,
       i_output1   TYPE STANDARD TABLE OF mara,
       i_output2   TYPE STANDARD TABLE OF makt,
Work Areas:
       w_output1   TYPE STANDARD TABLE OF mara,
       w_output2   TYPE STANDARD TABLE OF makt.
Variable:
DATA: lv_repid    LIKE sy-repid.
lv_repid = sy-repid.
  INCLUDE ZZM_TEST_ALV_SELSCRN                                       *
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS: cb_disp AS CHECKBOX.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK b_main.
  INCLUDE ZZM_TEST_ALV_CLASS                                         *
This include has all the data declaration defined for ALV
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
INCLUDE <icon>.
Predefine a local class for event handling to allow the
declaration of a reference variable before the class is defined.
DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
       o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
       cont_for_cognos1   TYPE scrfname VALUE 'BCALC_GRID_01_9100',
       cont_for_cognos2   TYPE scrfname VALUE 'BCALC_GRID_01_9200',
       custom_container1 TYPE REF TO cl_gui_custom_container,
       custom_container2 TYPE REF TO cl_gui_custom_container,
      Work Area
       w_layout TYPE lvc_s_layo ,
       w_variant TYPE disvariant.
      Constants
CONSTANTS : c_lay(1) TYPE c VALUE 'A' .                  " All Layouts
CONSTANTS: BEGIN OF c_main_tab,
           tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1',   "
           tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2',   "
           END OF c_main_tab.
  INCLUDE ZZM_TEST_ALV_FORMS                                         *
This Include has the various forms used in the program
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
*&      Form  f9001_build_field_cat
      To Build Field Catalog
     -->P_I_FIELDCAT  text
     -->P_0021   text
FORM f9001_build_field_cat TABLES   p_fieldcat STRUCTURE lvc_s_fcat
                      USING value(p_structure).
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name       = p_structure
       CHANGING
            ct_fieldcat            = p_fieldcat[]
       EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
  IF sy-subrc <> 0.
    MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
                                                            " text-e05.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.                    " f9001_build_field_cat
*&      Form  f9000_objects_create
      For creating Custom Containers
-->  p1        text
<--  p2        text
FORM f9000_objects_create.
  CREATE OBJECT custom_container1
      EXPORTING
          container_name = cont_for_cognos1
      EXCEPTIONS
          cntl_error = 1
          cntl_system_error = 2
          create_error = 3
          lifetime_error = 4
          lifetime_dynpro_dynpro_link = 5.
  CREATE OBJECT custom_container2
      EXPORTING
          container_name = cont_for_cognos2
      EXCEPTIONS
          cntl_error = 1
          cntl_system_error = 2
          create_error = 3
          lifetime_error = 4
          lifetime_dynpro_dynpro_link = 5.
  IF sy-subrc NE 0.
add your handling, for example
    CALL FUNCTION 'POPUP_TO_INFORM'
         EXPORTING
              titel = lv_repid
              txt2  = sy-subrc
              txt1  = 'The control could not be created'(510).
  ENDIF.
  CREATE OBJECT o_alvgrid1
       EXPORTING i_parent = custom_container1.
  CREATE OBJECT o_alvgrid2
       EXPORTING i_parent = custom_container2.
ENDFORM.                    " f9000_objects_create
*&      Form  f9003_layout
      To define the layout
     -->P_SY_TITLE  text
     -->P_0030   text
     -->P_0031   text
     -->P_0032   text
FORM f9003_layout USING  value(ptitle)
                         value(pzebra)
                         value(pmode)
                         value(pwidth).
  w_layout-grid_title  = ptitle.
  w_layout-zebra       = pzebra.
  w_layout-sel_mode    = pmode.
  w_layout-cwidth_opt  = pwidth.
  w_variant-report     = sy-repid.
ENDFORM.                    " f9003_layout
*&      Form  f9006_error_handle
     To handle event
     -->P_PTEXT  text
FORM f9006_error_handle USING value(ptext).
  IF sy-subrc NE 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
         EXPORTING
              titel = text-e03 " Error Note
              txt2  = sy-subrc
              txt1  = ptext.
  ENDIF.
ENDFORM.                    " f9006_error_handle
      FORM EXIT_PROGRAM                                             *
FORM exit_program.
  CALL METHOD custom_container1->free.
  CALL METHOD custom_container2->free.
  CALL METHOD cl_gui_cfw=>flush.
  IF sy-subrc NE 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
         EXPORTING
              titel = lv_repid
              txt2  = sy-subrc
              txt1  = 'Error in FLush'(500).
  ENDIF.
ENDFORM.
*&      Form  f1000_load_itabs
      Select from Database
-->  p1        text
<--  p2        text
form f1000_load_itabs.
  SELECT * FROM mara
           INTO TABLE i_output1
           UP TO 50 rows.
  SELECT * FROM makt
           INTO TABLE i_output2
           UP TO 50 rows.
endform.                    " f1000_load_itabs
  INCLUDE ZZM_TEST_ALV_SCREEN                                        *
2/ Description / Include functions
This include contains PBO and PAI events for the screen of report
ZZZJJ_TEST_ALV
3/ Responsibility
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
DATA FOR TABSTRIP 'MAIN_TAB'
CONTROLS:  main_tab TYPE TABSTRIP.
DATA:      BEGIN OF i_main_tab,
             subscreen   LIKE sy-dynnr,
             prog        LIKE sy-repid VALUE
                              'ZZZ_TEST',
             pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
           END OF i_main_tab.
*&      Module  STATUS_9001  OUTPUT
      text
MODULE status_9001 OUTPUT.
IF custom_container1 IS INITIAL.
  SET PF-STATUS 'ZSTATUS'.
  SET TITLEBAR 'ZTITLE'.
  Creating Object
    PERFORM f9000_objects_create.
  Building the field catalog
    PERFORM f9001_build_field_cat TABLES i_fieldcat
                            USING 'MARA'.
    PERFORM f9001_build_field_cat TABLES i_fieldcat1
                            USING 'MAKT'.
  Modifying the field catalog
   PERFORM f9002_modify_field_cat TABLES i_fieldcat.
  For Layout
    PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
ENDIF.
ENDMODULE.                 " STATUS_9001  OUTPUT
*&      Module  MAIN_TAB_ACTIVE_TAB_SET  OUTPUT
      Call method to display in the output grid
MODULE main_tab_active_tab_set OUTPUT.
  main_tab-activetab = i_main_tab-pressed_tab.
  CASE i_main_tab-pressed_tab.
    WHEN c_main_tab-tab1.
  To display report
     i_main_tab-subscreen = '9100'.
      CALL METHOD o_alvgrid1->set_table_for_first_display
      EXPORTING
         is_variant                    = w_variant
         i_save                        = c_lay
         is_layout                     = w_layout
      CHANGING
         it_outtab                     = i_output1[]
         it_fieldcatalog               = i_fieldcat[]
      EXCEPTIONS
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         OTHERS                        = 4.
  IF sy-subrc <> 0.
    MESSAGE i000 WITH text-e06."Error in ALV report display
    LEAVE LIST-PROCESSING.
  ENDIF.
    WHEN c_main_tab-tab2.
  To display report
      i_main_tab-subscreen = '9200'.
      CALL METHOD o_alvgrid2->set_table_for_first_display
      EXPORTING
         is_variant                    = w_variant
         i_save                        = c_lay
         is_layout                     = w_layout
      CHANGING
         it_outtab                     = i_output2[]
         it_fieldcatalog               = i_fieldcat1[]
      EXCEPTIONS
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         OTHERS                        = 4.
  IF sy-subrc <> 0.
    MESSAGE i005 WITH text-e06."Error in ALV report display
    LEAVE LIST-PROCESSING.
  ENDIF.
WHEN OTHERS.
     DO NOTHING
  ENDCASE.
ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET OUTPUT
*&      Module MAIN_TAB_ACTIVE_TAB_GET INPUT
      Check & Process the selected Tab
MODULE main_tab_active_tab_get INPUT.
  CASE sy-ucomm.
    WHEN c_main_tab-tab1.
      i_main_tab-pressed_tab = c_main_tab-tab1.
    WHEN c_main_tab-tab2.
      i_main_tab-pressed_tab = c_main_tab-tab2.
    WHEN OTHERS.
     DO NOTHING
  ENDCASE.
ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_GET INPUT
*&      Module USER_COMMAND_9001 INPUT
      User Command
MODULE user_command_9001 INPUT.
  CASE sy-ucomm.
    WHEN 'BACK'.
      PERFORM exit_program.
      SET SCREEN '0'.
    WHEN 'EXIT' OR  'CANC'.
      PERFORM exit_program.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.                 “USER_COMMAND_9000 INPUT
*&      Module MAIN_TAB_ACTIVE_TAB_SET INPUT
      Set sunscreen
MODULE main_tab_active_tab_set INPUT.
  main_tab-activetab = i_main_tab-pressed_tab.
  CASE i_main_tab-pressed_tab.
    WHEN c_main_tab-tab1.
        i_main_tab-subscreen = '9100'.
    WHEN c_main_tab-tab2.
        i_main_tab-subscreen = '9200'.
    WHEN OTHERS.
     DO NOTHING
  ENDCASE.
ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET INPUT
Thanks & Regards,
Judith.

Similar Messages

  • Need to add Header  and footer in an alv grid display output.

    How can I add header and footer in an alv grid dispay output.
    For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".

    HI,
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                i_callback_html_end_of_list = 'END_OF_LIST_HTML'
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
      DATA: ls_text TYPE sdydo_text_element,
            l_grid     TYPE REF TO cl_gui_alv_grid,
            f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
      ls_text = 'Footer title'.
    adds and icon (red triangle)
      CALL METHOD end->add_icon
        EXPORTING
          sap_icon = 'IL'.
    adds test (via variable)
      CALL METHOD end->add_text
        EXPORTING
          text         = ls_text
          sap_emphasis = 'strong'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(bold)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Bold text'
          sap_emphasis = 'strong'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(normal)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Nor'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(bold)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Yellow '
          sap_emphasis = 'str'.
    adds and icon (yellow triangle)
      CALL METHOD end->add_icon
        EXPORTING
          sap_icon = 'IC''.
    display text(normal)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Mor'.
    *set height of this section
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = l_grid.
      CALL METHOD l_grid->parent->parent->(f)
        EXPORTING
          id     = 3
          height = 14.
    ENDFORM. "end_of_list_html.
    This will solve  it. Post if you need more help in this.
    Regards,
    Madhu.

  • Problem in linking F4 help in alv grid display.

    Hi,
         I am linking F4 help in my program.My program gets activated properly but i am getting runtime error as : DYNPRO_NOT_FOUND and short text as
    Dynpor existiert nicht.Please help me in removing this error.Below is the simple code in which i am getting the error for ur reference:
    Thanks.
    REPORT  ZALVF4.
    Global data definitions for ALV.......................................
    DATA : alvgrid TYPE REF TO cl_gui_alv_grid,
           custom_container TYPE REF TO cl_gui_custom_container,
           fieldcatalog TYPE lvc_t_fcat.
    table to contain fields that require f4...............................
    DATA : lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
    ok_code declaration...................................................
    DATA : ok_code TYPE sy-ucomm.
    Tables declaration....................................................
    TABLES : zharry.
    Types declaration.....................................................
    TYPES : BEGIN OF ty_emp,
      empid LIKE zharry-student,
      empname LIKE zharry-sname,
    END OF ty_emp.
    Internal table declaration............................................
    DATA : i_emp TYPE TABLE OF ty_emp.
    Workarea declaration..................................................
    DATA : wa_emp TYPE ty_emp.
    Selection screen parameters...........................................
    SELECT-OPTIONS : s_sno FOR zharry-student.
          CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS :
                 handle_on_f1 FOR EVENT onf1 OF cl_gui_alv_grid
                              IMPORTING e_fieldname es_row_no er_event_data,
                 handle_on_f4 for event onf4 of cl_gui_alv_grid
                              importing e_fieldname es_row_no er_event_data
    ENDCLASS.
          CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_on_f1.
    custom f1 help for empid field.......................................
        IF e_fieldname = 'STUDENT'.
          CALL SCREEN 3001.
        ENDIF.
    to prevent processing of standard f1 help............................
        er_event_data->m_event_handled = 'X'.
      ENDMETHOD.
      Method handle_on_f4.
    standard f4 help will be invoked......................................
      endmethod.
    ENDCLASS.
    start of selection....................................................
    START-OF-SELECTION.
      SELECT STUDENT SNAME FROM ZHARRY
                           INTO CORRESPONDING FIELDS OF TABLE i_emp
                           WHERE student IN s_sno.
      CALL SCREEN 3000.
    *&      Module  STATUS_3000  OUTPUT
          text
    MODULE status_3000 OUTPUT.
      SET PF-STATUS 'ZTOOL'.
      SET TITLEBAR 'ZTITLE'.
      IF alvgrid IS INITIAL.
        CREATE OBJECT custom_container
          EXPORTING
            container_name = 'ZCONTAINER'.
        CREATE OBJECT alvgrid
          EXPORTING
            i_parent = custom_container.
        PERFORM prepare_f4.
        CALL METHOD alvgrid->register_f4_for_fields
          EXPORTING
            it_f4  = lt_f4[]
    creating instance for event handler..................................
        DATA : event_handler TYPE REF TO lcl_event_handler.
        CREATE OBJECT event_handler.
        SET HANDLER event_handler->handle_on_f1 FOR alvgrid.
        SET HANDLER event_handler->handle_on_f4 FOR alvgrid.
    preparing field catalog..............................................
        PERFORM prepare_fieldcatalog CHANGING fieldcatalog.
        CALL METHOD alvgrid->set_table_for_first_display
         EXPORTING
           I_BYPASSING_BUFFER            =
           I_BUFFER_ACTIVE               =
           I_CONSISTENCY_CHECK           =
           I_STRUCTURE_NAME              =
           IS_VARIANT                    =
           I_SAVE                        =
           I_DEFAULT                     = 'X'
           IS_LAYOUT                     =
           IS_PRINT                      =
           IT_SPECIAL_GROUPS             =
           IT_TOOLBAR_EXCLUDING          =
           IT_HYPERLINK                  =
           IT_ALV_GRAPHICS               =
           IT_EXCEPT_QINFO               =
          CHANGING
             it_outtab                     = i_emp
             it_fieldcatalog               = fieldcatalog
           IT_SORT                       =
           IT_FILTER                     =
         EXCEPTIONS
           INVALID_PARAMETER_COMBINATION = 1
           PROGRAM_ERROR                 = 2
           TOO_MANY_LINES                = 3
           others                        = 4
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " STATUS_3000  OUTPUT
    preparing field catalog...............................................
    FORM prepare_fieldcatalog CHANGING i_fieldcatalog TYPE lvc_t_fcat.
      DATA : ls_fcat TYPE lvc_s_fcat.
      ls_fcat-fieldname = 'STUDENT'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT NO'.
      APPEND ls_fcat TO i_fieldcatalog.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'SNAME'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT NAME'.
      APPEND ls_fcat TO i_fieldcatalog.
    ENDFORM.
    *&      Module  USER_COMMAND_3000  INPUT
          text
    MODULE user_command_3000 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_3000  INPUT
    *&      Module  USER_COMMAND_3001  INPUT
          text
    MODULE user_command_3001 INPUT.
      CASE ok_code.
        WHEN 'SAVE'.
          LEAVE TO SCREEN 0.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_3001  INPUT
    *&      Module  STATUS_3001  OUTPUT
          text
    MODULE status_3001 OUTPUT.
      SET PF-STATUS 'GUI'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                 " STATUS_3001  OUTPUT
    preparing fields to be registered for f4 help.........................
    FORM prepare_f4.
      lt_f4-fieldname = 'EMPNAME'.
      lt_f4-register = 'X'.
      lt_f4-getbefore = 'X'.
      lt_f4-chngeafter = 'X'.
      APPEND lt_f4.
    ENDFORM.

    Hi,
         I am linking F4 help in my program.My program gets activated properly but i am getting runtime error as : DYNPRO_NOT_FOUND and short text as
    Dynpor existiert nicht.Please help me in removing this error.Below is the simple code in which i am getting the error for ur reference:
    Thanks.
    REPORT  ZALVF4.
    Global data definitions for ALV.......................................
    DATA : alvgrid TYPE REF TO cl_gui_alv_grid,
           custom_container TYPE REF TO cl_gui_custom_container,
           fieldcatalog TYPE lvc_t_fcat.
    table to contain fields that require f4...............................
    DATA : lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
    ok_code declaration...................................................
    DATA : ok_code TYPE sy-ucomm.
    Tables declaration....................................................
    TABLES : zharry.
    Types declaration.....................................................
    TYPES : BEGIN OF ty_emp,
      empid LIKE zharry-student,
      empname LIKE zharry-sname,
    END OF ty_emp.
    Internal table declaration............................................
    DATA : i_emp TYPE TABLE OF ty_emp.
    Workarea declaration..................................................
    DATA : wa_emp TYPE ty_emp.
    Selection screen parameters...........................................
    SELECT-OPTIONS : s_sno FOR zharry-student.
          CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS :
                 handle_on_f1 FOR EVENT onf1 OF cl_gui_alv_grid
                              IMPORTING e_fieldname es_row_no er_event_data,
                 handle_on_f4 for event onf4 of cl_gui_alv_grid
                              importing e_fieldname es_row_no er_event_data
    ENDCLASS.
          CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_on_f1.
    custom f1 help for empid field.......................................
        IF e_fieldname = 'STUDENT'.
          CALL SCREEN 3001.
        ENDIF.
    to prevent processing of standard f1 help............................
        er_event_data->m_event_handled = 'X'.
      ENDMETHOD.
      Method handle_on_f4.
    standard f4 help will be invoked......................................
      endmethod.
    ENDCLASS.
    start of selection....................................................
    START-OF-SELECTION.
      SELECT STUDENT SNAME FROM ZHARRY
                           INTO CORRESPONDING FIELDS OF TABLE i_emp
                           WHERE student IN s_sno.
      CALL SCREEN 3000.
    *&      Module  STATUS_3000  OUTPUT
          text
    MODULE status_3000 OUTPUT.
      SET PF-STATUS 'ZTOOL'.
      SET TITLEBAR 'ZTITLE'.
      IF alvgrid IS INITIAL.
        CREATE OBJECT custom_container
          EXPORTING
            container_name = 'ZCONTAINER'.
        CREATE OBJECT alvgrid
          EXPORTING
            i_parent = custom_container.
        PERFORM prepare_f4.
        CALL METHOD alvgrid->register_f4_for_fields
          EXPORTING
            it_f4  = lt_f4[]
    creating instance for event handler..................................
        DATA : event_handler TYPE REF TO lcl_event_handler.
        CREATE OBJECT event_handler.
        SET HANDLER event_handler->handle_on_f1 FOR alvgrid.
        SET HANDLER event_handler->handle_on_f4 FOR alvgrid.
    preparing field catalog..............................................
        PERFORM prepare_fieldcatalog CHANGING fieldcatalog.
        CALL METHOD alvgrid->set_table_for_first_display
         EXPORTING
           I_BYPASSING_BUFFER            =
           I_BUFFER_ACTIVE               =
           I_CONSISTENCY_CHECK           =
           I_STRUCTURE_NAME              =
           IS_VARIANT                    =
           I_SAVE                        =
           I_DEFAULT                     = 'X'
           IS_LAYOUT                     =
           IS_PRINT                      =
           IT_SPECIAL_GROUPS             =
           IT_TOOLBAR_EXCLUDING          =
           IT_HYPERLINK                  =
           IT_ALV_GRAPHICS               =
           IT_EXCEPT_QINFO               =
          CHANGING
             it_outtab                     = i_emp
             it_fieldcatalog               = fieldcatalog
           IT_SORT                       =
           IT_FILTER                     =
         EXCEPTIONS
           INVALID_PARAMETER_COMBINATION = 1
           PROGRAM_ERROR                 = 2
           TOO_MANY_LINES                = 3
           others                        = 4
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " STATUS_3000  OUTPUT
    preparing field catalog...............................................
    FORM prepare_fieldcatalog CHANGING i_fieldcatalog TYPE lvc_t_fcat.
      DATA : ls_fcat TYPE lvc_s_fcat.
      ls_fcat-fieldname = 'STUDENT'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT NO'.
      APPEND ls_fcat TO i_fieldcatalog.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'SNAME'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT NAME'.
      APPEND ls_fcat TO i_fieldcatalog.
    ENDFORM.
    *&      Module  USER_COMMAND_3000  INPUT
          text
    MODULE user_command_3000 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_3000  INPUT
    *&      Module  USER_COMMAND_3001  INPUT
          text
    MODULE user_command_3001 INPUT.
      CASE ok_code.
        WHEN 'SAVE'.
          LEAVE TO SCREEN 0.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_3001  INPUT
    *&      Module  STATUS_3001  OUTPUT
          text
    MODULE status_3001 OUTPUT.
      SET PF-STATUS 'GUI'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                 " STATUS_3001  OUTPUT
    preparing fields to be registered for f4 help.........................
    FORM prepare_f4.
      lt_f4-fieldname = 'EMPNAME'.
      lt_f4-register = 'X'.
      lt_f4-getbefore = 'X'.
      lt_f4-chngeafter = 'X'.
      APPEND lt_f4.
    ENDFORM.

  • F4 help in ALV grid display

    hi,
    I need to allow F4 help to an alv field.
    The alv is designed using cl_gui_alv_grid.
    the reference values are in an internal table. how can i get these values for the help?
    thanks,
    Arindam.

    Hi,
    Refer to this link..Re: F4 help for OO ALV Grid

  • Alternative UI Output formats for BAPI table

    Hi Experts,
    Can I display the output of a BAPI table in any other format apart from a table.
    Regards
    Abdullah

    Abdullah,
    In web dynpro you cannot have tables with scrollbar. A workaround for that may be a use of ScrollContainer UI element with fixed height and display all table rows via setting visibleRowsCount=-1.but problem here is , table headers will be scrolled as well. So it is better not to have them like that.
    I would suggest take use of existing table UI element and dont alter its functionality.
    Regarding incorporating the application using web dynpro I guess that you must be knowing(not sure but think that you need to get rid of COM DCOM).
    hope it helps
    regards,

  • To display Title In ALV Grid Display on first line of table

    Hi SAP Experts,
             Here is one Issue..
    I have some check boxes on selection screens,
    When i have selected one,
    The related title should be display on the first line of Itab[]...
    and if once collect is used to suppress the data
    with the same itab can we print normal itab and how...
    Waiting for Your Reply.....
    Thanks In Advance

    Hi Krishna,
    I can't imagine what you want.
    In ALV grid object, you can change the title text for each column displayed. This is done via field catalog or, in SALV, column object methods.
    In ALV fullscreen, you can define a TOP-OF-PAGE area where you may have what ever you want independent from the grid table content. I think you can not use this because you have the grid in a container.
    You may define it as a docking or splitter container and place the grid in lower and the title in upper area. But this will need some experience with container controls and a certain level of coding abilities.
    Regards,
    Clemens

  • ALV grid refresh while fcat and internal table change

    Hi,
       I am displaying an ALV output using OOPS ALV grid. It is displaying data from internal table t1.
    Later I am changing fieldcat table content and I want to display with internal table t2. how can I do this.
    It is not refreshing the fieldcat values in the ALV.
    Which method I should call to refresh the ALV.
    Thanks and regards,
    Venkat.

    hi,
    to refresh the alv display.
    you can use the method refresh_table_display
    of the class cl_gui_alv_grid.
    regards.

  • Fields missing in ALV grid display output

    Hello  Friends,
    I have done customer enhancement to VF04 tcode and i have added 2 new additional fields to the existing output.The program is working fine and its displaying the 2 new additional fields in the output display in development server.
    But when i transported the program to Q server and i have observed that the 2 new additonal fields are not displayed in the output display but when I  am selecting  'choose detail' push button on application tool bar it's showing the 2 new additional fields.In development server in the output 40 fields are displayed but in Q server only 9 fields are displayed.
    Could you please help me regarding this.
    Thanks in advance,
    Arvind.

    register the enhancementy to the project in Q server .. might be it is not transferred

  • Update all alv (grid) displayed records to internal table

    Hi all,
    i want to update the records into the internal table which are changed by the user in the edit field.
    after he select save button.
    i  have to save the ALV grid displayed records in the internal table.
    hw can i do this ?

    ALV with EDIT and SAVE functionality
    Code:REPORT z_demo_alv_jg.*******************************************************************
    TYPE-POOLS                                                      *
    TYPE-POOLS: slis. *******************************************************************
    INTERNAL TABLES/WORK AREAS/VARIABLES     *
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
          w_field TYPE slis_fieldcat_alv,
          p_table LIKE dd02l-tabname,
          dy_table TYPE REF TO data,
          dy_tab TYPE REF TO data,
          dy_line TYPE REF TO data.*******************************************************************
    FIELD-SYMBOLS                                                   *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa> TYPE ANY,
                   <dyn_field> TYPE ANY,
                   <dyn_tab_temp> TYPE STANDARD TABLE.*******************************************************************
    SELECTION SCREEN                                                *
    PARAMETERS: tabname(30) TYPE c,
                lines(5)  TYPE n.*******************************************************************
    START-OF-SELECTION                                              *
    START-OF-SELECTION.* Storing table name
      p_table = tabname.* Create internal table dynamically with the stucture of table name
    entered in the selection screen
      CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_table->* TO <dyn_table>.
      IF sy-subrc <> 0.
        MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.    LEAVE TO LIST-PROCESSING.
      ENDIF.
    Create workarea for the table
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.* Create another temp. table
      CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_tab->* TO <dyn_tab_temp>.  SORT i_fieldcat BY col_pos.* Select data from table
      SELECT * FROM (p_table)
      INTO TABLE <dyn_table>
      UP TO lines ROWS.  REFRESH <dyn_tab_temp>.* Display report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.  IF sy-subrc <> 0.  ENDIF.&----
    *&      Form  SET_PF_STATUS
          Setting custom PF-Status
         -->RT_EXTAB   Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.  SET PF-STATUS 'Z_STANDARD'.ENDFORM.                    "SET_PF_STATUS&----
    *&      Form  user_command
          Handling custom function codes
         -->R_UCOMM      Function code value
         -->RS_SELFIELD  Info. of cursor position in ALV
    FORM user_command  USING    r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.* Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.* Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.* Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.* Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.  CASE r_ucomm.*   When a record is selected
        WHEN '&IC1'.*     Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.      IF sy-subrc = 0.*       Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.*       Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
            IF sy-subrc = 0.*         Make all the fields input enabled except key fields
              w_field-input = 'X'.          MODIFY i_fieldcat FROM w_field TRANSPORTING input
              WHERE key IS INITIAL.        ENDIF.*       Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                i_callback_program    = sy-repid
                i_structure_name      = p_table
                it_fieldcat           = i_fieldcat
                i_screen_start_column = 10
                i_screen_start_line   = 15
                i_screen_end_column   = 200
                i_screen_end_line     = 20
              TABLES
                t_outtab              = <l_tab>
              EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.        IF sy-subrc = 0.*         Read the modified data
              READ TABLE <l_tab> INDEX 1 INTO <l_wa>.*         If the record is changed then track its index no.
            and populate it in an internal table for future
            action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.      ENDIF.*   When save button is pressed
        WHEN 'SAVE'.*     Sort the index table
          SORT i_index.*     Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.      LOOP AT i_index.*       Find out the changes in the internal table
          and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.      ENDLOOP.*     Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.      IF sy-subrc = 0.*       Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.        REFRESH <dyn_tab_temp>.*       Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.      ENDIF.
      ENDCASE.  rs_selfield-refresh = 'X'.ENDFORM.                    "user_command

  • Error in field catalog in ALV grid display using classes at do_sum = "X'.

    Hi,
    I'm using classes in ALV Grid display.
    the code for the field catalog is going to dump because of the statement in the field catalog for field 'netwr',do_sum = 'X'.
    that do_sum = 'X' is not working and going to dump when executed.with out that do_sum it is working fine. the error in dump analysys is showing sap standard incude LSLVCF01.
        assign component
               <ls_fieldcat>-fieldname of structure rt_data to <g_field>.
        if sy-subrc ne 0.
          message x000(0k).
        endif.
    sy-subrc is 4 when the program is being executed.
    CODE:
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      ls_fcat-fieldname = 'VBELN1'.
      ls_fcat-ref_field = 'VBELN'.
      ls_fcat-ref_table = 'VBRK'.
      ls_fcat-coltext = 'Invoice No'.
      ls_fcat-seltext = 'Invoice No'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'BUDAT'.
      ls_fcat-ref_table = 'BKPF'.
      ls_fcat-coltext = 'Invoice Date'.
      ls_fcat-seltext = 'Invoice Date'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    ls_fcat-fieldname = 'NETWR'.
      ls_fcat-ref_field = 'NETWR'.
      ls_fcat-ref_table = 'VBRK'.
      ls_fcat-coltext = 'Value of Invoice'.
      ls_fcat-seltext = 'Value of Invoice'.
      ls_fcat-datatype = 'CURR'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    ENDFORM.
    can u please look in the code and rectify the error,
    would appeciate ur response.
    regards,
    veera.

    Hi,
    try this..
    ls_fcat-fieldname = 'NETWR'.
    ls_fcat-ref_field = 'NETWR'.
    ls_fcat-ref_table = 'VBRK'.
    ls_fcat-coltext = 'Value of Invoice'.
    ls_fcat-seltext = 'Value of Invoice'.
    ls_fcat-datatype = 'CURR'.
    ls_fcat-do_sum = 'X'.
    <b>ls_fcat-cfieldname = 'WAERS'.</b>
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    Regards
    vijay

  • Sub columns in alv grid display

    hi everyone,
        can anyone tell me the way in which we can include sub-column headings in alv grid display. i.e., for example as shown below.
        column1             column2              column3 
    scol1   scol2         scol3   scol4        scol5   scol6........................
    thanks in advance. Here we are generating the column headings by using fm field catalog merge.
    regards,
    rajsekhar.k

    check this thread, check the sample code in my post
    Re: multiple headers in ALV.

  • ALV grid display the subtotal not getting for one column at the output

    Hi,
    I am working one report ALV grid display and subtotal is not getting for one paricular coulumn.
    Eventhough that column has some values.
    So can anyone give the proper solution.
    Waiting quick response.
    Best Regards,
    Bansi

    Hi
    see this link .
    https://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTALinALV
    or try this program.
    REPORT zalv.
    DATA:
    t_sflight TYPE TABLE OF sflight,
    fs_sflight TYPE sflight.
    DATA:
    r_container TYPE REF TO cl_gui_custom_container,
    r_grid TYPE REF TO cl_gui_alv_grid.
    *FIELD CATALOG
    DATA:
    t_fcat TYPE lvc_t_fcat,
    fs_fcat TYPE lvc_s_fcat.
    *SORTING THE BASIC LIST
    DATA:
    t_sort TYPE lvc_t_sort,
    fs_sort TYPE lvc_s_sort.
    fs_fcat-fieldname = 'PRICE'.
    fs_fcat-do_sum = 'X'.
    APPEND fs_fcat TO t_fcat.
    fs_sort-spos ='1'.
    fs_sort-fieldname = 'CARRID'.
    fs_sort-down = 'X'.
    fs_sort-group = '*'.
    fs_sort-subtot = 'X'.
    APPEND fs_sort TO t_sort.
    SELECT * FROM sflight INTO TABLE t_sflight.
    CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'SCREEN1'.
    SET TITLEBAR 'TITLE1'.ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    **& Module HANDLER OUTPUT
    MODULE list OUTPUT.
    CREATE OBJECT r_container
    EXPORTING
    container_name = 'CONTAINER'.
    CREATE OBJECT r_grid
    EXPORTING
    i_parent = r_container.
    CALL METHOD r_grid->set_table_for_first_display
    EXPORTING
    i_structure_name = 'SFLIGHT'
    CHANGING
    it_fieldcatalog = t_fcat
    it_outtab = t_sflight
    it_sort = t_sort.
    ENDMODULE. "list OUTPUT
    Regards
    Hareesh Menon

  • Kindly help to develop alv grid display

    Hi ,
    I have a requirement in which I need to display ALV GRID display and in its tool bar 4 butons are required. In the same view down to alv display i want to develop a tabstrip and its functionalities.I have designed classic alv using SALV_WD_TABLE component. I want a good GRID Display, not like flat field names that comes in list display, looking for bulged fields(like what comes for ALV GRID in normal abap)  display with print version etc hidden and buttons at the top of ALV.  Kindly help
    Highly rewarded
    Kindly help
    Regards,
    Lakshmi
    Edited by: Lakshmi Menon on Nov 27, 2008 4:49 PM

    Well Web Dynpro is generally output in HTML so the output formatting is never going to quite look like a desktop application (which is the case with the ALV Grid).  You have very little control over the look of the column headers.  In fact you can only manipulate what is available via the Portal Theme. 
    There is a new Tradeshow Plus theme available in NetWeaver 7.01 which uses a gradiant background for the column headers.  This gives them a little more depth:
    http://www.flickr.com/photos/tjung/3068850120/
    The other option is next year when NetWeaver Business Client version 3.0 comes out, you will be able to render Web Dynpro applications using the NWBC Smart Client Rendering.  This will render Web Dynpro applications using desktop libraries instead of HTML/Browser. This gives Web Dynpro a more SAPGUI/Desktop appears of course.
    http://www.flickr.com/photos/tjung/2685619882/in/set-72157606418550143/

  • Downloading format breaking line in ALV Grid display

    Dear All,
    When i am downloading data from from table or using spool request, why after few line item many data comes into one cell.
    I have selected ALV Grid display and taking output in *.xls format.
    Please find the attached screen shot for your reference
    Regards
    Sanjeet Kumar

    Hi,
    Check these links for more details -
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    ashish

  • Two  ALV Grid Display  format on the Single page

    Hi guru's
    I have two plant details. I want to be  display these two plant details in the single page with ALV Grid display format.. like
    plant no 1(Details):
    xxxx  xxxx xxxx xxxx with ALV Grid Display format
    plant no 2 (Details):
    xxx  xxxx xxxx xxxx ALV Grid Display format
    Can any body help on the .. if you have sample code pls paste.
    Thanks in Advance
    Surendra

    hi,
    Grid display is not possible but u can display two list on same page by Block ALV....
    TYPE-POOLS : slis.
    TABLES : mara,
             makt.
    SELECT-OPTIONS : mat FOR mara-matnr.
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,
            maktx LIKE makt-maktx,
            matkl LIKE mara-matkl,
            mtart LIKE mara-mtart,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1.
    DATA : BEGIN OF itab1_col OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1_col.
    DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
           t_fcat2 TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv,
           t_eve TYPE slis_t_event,
           wa_eve TYPE slis_alv_event,
           t_layout TYPE slis_layout_alv.
    DATA : v_repid LIKE sy-repid,
           t_mat LIKE mara-matnr.
    DEFINE create_fcat.
      clear wa_fcat.
      wa_fcat-fieldname = &1.
      wa_fcat-seltext_l = &2.
      wa_fcat-outputlen = &3.
      append wa_fcat to t_fcat1.
    END-OF-DEFINITION.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM dis_data.
    *&      Form  get_data
          text
    FORM get_data.
      SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara AS a INNER JOIN makt AS b ON
      amatnr = bmatnr
      WHERE a~matnr IN mat.
      LOOP AT itab.
        itab1-mtart = itab-mtart.
        itab1-count = 1.
        APPEND itab1.
      ENDLOOP.
      SORT itab1 BY mtart.
      LOOP AT itab1.
        MOVE-CORRESPONDING itab1 TO itab1_col.
        COLLECT itab1_col.
      ENDLOOP.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program      = v_repid.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE1'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MATNR' 'Material' '10',
      'MAKTX' 'Material Description' '40',
      'MTART' 'Type' '10',
      'MATKL' 'Group' '10'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB'
          it_events   = t_eve
        TABLES
          t_outtab    = itab.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE2'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MTART' 'Type' '10',
      'COUNT' 'Total' '5'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB1_COL'
          it_events   = t_eve
        TABLES
          t_outtab    = itab1_col.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    ENDFORM.                    "dis_data
    *&      Form  top_of_page1
          text
    FORM top_of_page1.
      FORMAT COLOR COL_POSITIVE.
      WRITE:/ 'First Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    *&      Form  top_of_page2
          text
    FORM top_of_page2.
      FORMAT COLOR COL_NEGATIVE.
      WRITE /5 'Second Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    reward if usefull....

Maybe you are looking for