Displaying ALV in Splitter Container with heading using ABAP OO
Introduction:
Splitter Container can be used to display data either from two or more tables or from a single table based on particular conditions in ALV format using a single container at a time.
The classes that are used for achieving this are as follows,
- CL_GUI_CUSTOM_CONTAINER .
- CL_GUI_SPLITTER_CONTAINER .
- CL_GUI_CONTAINER .
- CL_GUI_ALV_GRID .
- CL_DD_DOCUMENT.
Procedure:
- First we have to design a modulepool screen (Screen No.100 ) with two custom controls, each for ALV and Heading as below,
- Name the first control as "HEADING".
- Name the second control as "MAIN_CONT".
- Save and activate the screen.
- Do the below coding in the report program.
- Here i took a case of displaying the material details of a particular material type ‘ZSEM', in the parent split alv list and the descriptions of those materials that are listed in parent split alv in child split alv.
- The heading being maintained for this ALV is 'Material Master Report'.*****************************Coding********************************
*REPORT ZOOALV_WITH_SPLITTER.
DATA : O_CC TYPE REF TO CL_GUI_CUSTOM_CONTAINER .
DATA : O_SC TYPE REF TO CL_GUI_SPLITTER_CONTAINER .
DATA : O_PART1 TYPE REF TO CL_GUI_CONTAINER .
DATA : O_PART2 TYPE REF TO CL_GUI_CONTAINER .
DATA : ALV_GRID1 TYPE REF TO CL_GUI_ALV_GRID .
DATA : ALV_GRID2 TYPE REF TO CL_GUI_ALV_GRID .
DATA : I_MARA TYPE TABLE OF MARA .
DATA : I_MAKT TYPE TABLE OF MAKT .
DATA : DD TYPE REF TO CL_DD_DOCUMENT.START-OF-SELECTION .
call SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
PERFORM create_objects.
PERFORM spli_main_cont .
PERFORM DISP_HEADING.
PERFORM disp_alv1 .
PERFORM disp_alv2 .
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Form CREATE_OBJECTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* p1 text
* GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = O_PART1.CALL METHOD O_SC->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = O_PART2.
ENDFORM. " SPLI_MAIN_CONT*&---------------------------------------------------------------------*
*& Form DISP_ALV1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
IT_OUTTAB = I_MARA.
ENDFORM . "DISP_ALV1*&---------------------------------------------------------------------*
*& Form DISP_ALV2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'MAKT'
CHANGING
IT_OUTTAB = I_MAKT.ENDFORM. " DISP_ALV2
*&---------------------------------------------------------------------*
*& Form DISP_HEADING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* HEADING .
CALL METHOD DD->ADD_TEXT
EXPORTING
TEXT = 'MATERIAL MASTER REPORT'
SAP_STYLE = HEAD .CALL METHOD DD->DISPLAY_DOCUMENT
EXPORTING
CONTAINER = 'HEADING'.
ENDFORM. " DISP_LOGO - Save and activate the entire program. Execute (F8),
- The result clearly illustrates the purpose and advantage of displaying the ALV in Splitter Container.
6 thoughts on “Displaying ALV in Splitter Container with heading using ABAP OO”
By MOHIT on 26 November 2013 at 11:49
Kindly review he code you hav given.. will it work in any case.. waiting for the updated one..
By Avinash Palavai on 27 November 2013 at 04:23
That is a working code, and will work....
By Rafa on 18 December 2013 at 20:18
No working code. Please update.
By Kartik on 29 December 2015 at 15:32
Not Working,just tried it
By Vetrivel on 7 April 2017 at 08:53
Not working please try it now.
By Sivananda on 8 April 2018 at 18:42
Hiii i want to split the 2nd row of that container again 2 parts ie 2 columns. Pls tell me how can I write.