Split ALV Sample

그녀는애교쟁이 2013. 9. 5. 10:02

 참고자료 : 

Displaying Two ALV Grid on Screen

In this tutorial I will try to explain how to display multiple ALV Grid on a single screen. This is a very simple concept, to render or to draw a ALV grid on a screen you need a CONTAINER. Usually we create a CONTAINER with class CL_GUI_CUSTOM_CONTAINER and pass this CONTAINER object while creating ALV grid in parameter I_PARENT. Now to display multiple ALV grid you need multiple CONTAINER, here the class CL_GUI_EAST_SPLITTER_CONTAINER comes in the picture. This class divides a particular CONTAINER into two and give you two CONTAINER in return. How it divides depend on the parameter you pass while creating object. You can divide it horizontally by passing argument CL_GUI_EAST_SPLITTER_CONTAINER=>ORIENTATION_HORIZONTAL or vertically by passing argument CL_GUI_EAST_SPLITTER_CONTAINER=>orientation_VERTICAL. Since it will give you two CONTAINER you can further divide resulting CONATINER into two. So each time you create a object of CL_GUI_EAST_SPLITTER_CONTAINER you get one more CONTAINER. Finally you can use these CONATINER to create ALV Grids, or any GUI controls for example CL_GUI_ALV_TREE or CL_GUI_MOVIE (SAP Movie Control.. sounds interesting).


If you are confuse with above explanation then just forgot it and see the example. I have created a SCREEN 100 with custom container name 'CONTAINER'.

REPORT zreport.
TABLES : scarr .
DATA : it_scarr TYPE TABLE OF scarr .
DATA : ob_custom TYPE REF TO cl_gui_custom_container ,
       ob_split1 TYPE REF TO cl_gui_easy_splitter_container ,
       ob_split2 TYPE REF TO cl_gui_easy_splitter_container ,
       ob_grid1  TYPE REF TO cl_gui_alv_grid ,
       ob_grid2  TYPE REF TO cl_gui_alv_grid ,
       ob_grid3  TYPE REF TO cl_gui_alv_grid .
SELECT-OPTIONS : s_carrid FOR scarr-carrid .
    INTO TABLE it_scarr
    FROM scarr
   WHERE carrid IN s_carrid .
*& Module status_0100 OUTPUT
MODULE status_0100 OUTPUT.
* This will create a container
  CREATE OBJECT ob_custom
      container_name = 'CONTAINER'.
* This spit the container OB_CUSTOM into two
  CREATE OBJECT ob_split1
      parent      = ob_custom
      orientation = cl_gui_easy_splitter_container=>orientation_vertical.
* Now we have two container
* Since these two are itself a container we can further devide them into two.
* Let try to divide OB_SPLIT1->BOTTOM_RIGHT_CONTAINER into two
  CREATE OBJECT ob_split2
      parent      = ob_split1->bottom_right_container
      orientation = cl_gui_easy_splitter_container=>orientation_horizontal.
* Now we have total 3 container available with us
* Note that OB_SPLIT1->BOTTOM_RIGHT_CONTAINER is not available because we divided
* that into two.
* Now Put a grid in each container
  CREATE OBJECT ob_grid1
      i_parent = ob_split1->top_left_container.
  CREATE OBJECT ob_grid2
      i_parent = ob_split2->top_left_container.
  CREATE OBJECT ob_grid3
      i_parent = ob_split2->bottom_right_container.
  CALL METHOD ob_grid1->set_table_for_first_display
      i_structure_name = 'SCARR'
      it_outtab        = it_scarr.
  CALL METHOD ob_grid2->set_table_for_first_display
      i_structure_name = 'SCARR'
      it_outtab        = it_scarr.
  CALL METHOD ob_grid3->set_table_for_first_display
      i_structure_name = 'SCARR'
      it_outtab        = it_scarr.
ENDMODULE. " status_0100 OUTPUT
*& Module user_command_0100 INPUT
MODULE user_command_0100 INPUT.
  IF sy-ucomm = 'BACK' OR sy-ucomm = 'EXIT' .
    FREE : ob_grid1 ,
           ob_grid2 ,
           ob_grid3 ,
           ob_split1 ,
           ob_split2 ,
           ob_custom .
ENDMODULE. " user_command_0100 INPUT


'SAP > 스크랩' 카테고리의 다른 글

BADI 생성 예제  (0) 2014.05.17
Split ALV Sample  (0) 2013.09.05
스케쥴 백그라운 작업 생성 ( Batch Job )  (0) 2013.09.05
Events in the object oriented ALV  (0) 2013.03.19
How to implement F4 search help in OO ALV Grid  (0) 2013.01.18
1 2 3 4 5