Monday, 22 December 2014

Display two or more ALVs on one screen using Splitter Control

 

Output:-
Code:-

DATA: CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
      GRAPHIC_PARENT1 TYPE REF TO CL_GUI_CONTAINER,
      GRAPHIC_PARENT2 TYPE REF TO CL_GUI_CONTAINER.
DATA REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA REF_GRID1 TYPE REF TO CL_GUI_ALV_GRID.
**   create container in which to place splitter
**   (place it in the custom control named CONTAINER
**   defined using screenpainter in dynpro 100)
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
 CONTAINER_NAME = 'CONTAINER'. "use uppercase letters!
*
**   create splitter container in which to place graphics
CREATE OBJECT SPLITTER
 EXPORTING
   PARENT  = CUSTOM_CONTAINER
    ROWS    = 2
   COLUMNS = 1
   ALIGN   = 15. " (splitter fills the hole custom container)
**   get part of splitter container for 1st table
CALL METHOD SPLITTER->GET_CONTAINER
  EXPORTING
    ROW       = 1
    COLUMN    = 1
  RECEIVING
    CONTAINER = GRAPHIC_PARENT1.
**   get part of splitter container for 2nd table
CALL METHOD SPLITTER->GET_CONTAINER
  EXPORTING
    ROW       = 2
    COLUMN    = 1
  RECEIVING
    CONTAINER = GRAPHIC_PARENT2.
CREATE OBJECT  REF_GRID EXPORTING I_PARENT = GRAPHIC_PARENT1.
**  Display first ALV
PERFORM SET_DISPLAY.
CREATE OBJECT  REF_GRID1 EXPORTING I_PARENT = GRAPHIC_PARENT2.
**  Display second ALV
PERFORM SET_DISPLAY1.
*&--------------------------------------------------------------------*
*&      Form  set_display
*&--------------------------------------------------------------------*
*       text  Display first ALV
*---------------------------------------------------------------------*
FORM SET_DISPLAY.
  CALL METHOD REF_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IS_VARIANT      = ST_VAR
      I_SAVE          = SAVE
      IS_LAYOUT       = LOYO
    CHANGING
      IT_OUTTAB       = ITAB_FINAL[]
      IT_FIELDCATALOG = FCAT.
ENDFORM.                    "set_display
*&--------------------------------------------------------------------*
*&      Form  set_display1
*&--------------------------------------------------------------------*
*       text Display second ALV
*---------------------------------------------------------------------*
FORM SET_DISPLAY1.
  CALL METHOD REF_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IS_VARIANT      = ST_VAR
      I_SAVE          = SAVE
      IS_LAYOUT       = LOYO1
    CHANGING
      IT_OUTTAB       = ITAB_FINAL1[]
      IT_FIELDCATALOG = FCAT1.
ENDFORM.                    "set_display1

No comments:

Post a Comment