How to display two ALV grid in one screen?

Hello everyone. Its another topic I want to discuss with you today. Pause for a moment and take a look with this simple ALV grid below. Do you see it? Its two ALV Grid in just one screen. Have you been asked to do to display such? If not yet, then its time for you to take this sample codes I provided below.


REPORT  YYZZYY_TWO_ALV.


DATA: ok_code LIKE sy-ucomm,
      gt_sflight TYPE TABLE OF sflight,
      grid1  TYPE REF TO cl_gui_alv_grid,
      grid2  TYPE REF TO cl_gui_alv_grid.

* splitter control
DATA splitter TYPE REF TO cl_gui_easy_splitter_container.
* container for the splitter control
DATA container TYPE REF TO cl_gui_custom_container.

* containers created by the splitter control
DATA container_1 TYPE REF TO cl_gui_container.
DATA container_2 TYPE REF TO cl_gui_container.
* load control framework definition
TYPE-POOLS cndp.
*---------------------------------------------------------------------*
*       MAIN                                                          *
*---------------------------------------------------------------------*

SELECT * FROM sflight INTO TABLE gt_sflight.

CALL SCREEN 100.


*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
 SET PF-STATUS 'MAIN100'.
  set TITLEBAR '100'.
  IF  container_1 IS INITIAL.

* create a container for the splitter control
    CREATE OBJECT container
                  EXPORTING container_name = 'CUSTOM'.
* create the splitter control
    CREATE OBJECT splitter
                  EXPORTING parent = container
                            orientation    = 1"0-horizontal; 1-vertical
* get the containers of the splitter control
    container_1 = splitter->top_left_container.
    container_2 = splitter->bottom_right_container.
* create the picture controls inside the containers of the splitter

    CREATE OBJECT GRID1
           EXPORTING I_PARENT =  container_1.
    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
         CHANGING  IT_OUTTAB        = GT_SFLIGHT.


    CREATE OBJECT GRID2
           EXPORTING I_PARENT =  container_2.
    CALL METHOD GRID2->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
         CHANGING  IT_OUTTAB        = GT_SFLIGHT.
endif.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CALL METHOD container->free.
  LEAVE PROGRAM.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
 

No comments:

Post a Comment

How to download the data structure of tables in SE11?

Good morning people around the world. Its me again doing some blogs. Sharing to you some tips and tricks in the SAP world. Well, before I s...