Skip to Content
Author's profile photo Former Member

Call two ALV tables in fullscreen

Issue: Create a Report with 2 ALV tables. These should open in full screen and take the maximum amount of space available on the screen. This one is for ABAP beginners.

There is a Report by Ruchi Tiwari which do nearly the same, but use a fixed sized custom control.

  • Create an empty Dynpro with screen number 2000. Create the PBO (status_2000) and PAI (user_command_2000) within forward navigation. I didn’t change the names. You can use includes but is quiet a god idea for real life use, but in this example I’ll put all code in my program “file”.
  • Add a status, because there will be a point in time, where you wish to leave the program( or not 🙂 )

/wp-content/uploads/2015/02/1_652500.png

  • Add the PAI code for the exit. Your PBO and PAi should now look like this./wp-content/uploads/2015/02/2_652501.png

          Now you should be able to call the programm and leave it with the exit button.

  • Add the code to the Programm:

“Data for output
DATA: gr_container TYPE REF TO cl_gui_docking_container.   “The carrier for the split container
DATA: lv_splitter TYPE REF TO cl_gui_splitter_container“The splitter itself
DATA: lv_parent1 TYPE REF TO cl_gui_container.           “parent 1 and 2
DATA: lv_parent2 TYPE REF TO cl_gui_container.

DATA ref_grid1 TYPE REF TO cl_gui_alv_grid.
DATA ref_grid2 TYPE REF TO cl_gui_alv_grid.
DATA: gr_table1 TYPE REF TO cl_salv_table.
DATA: gr_table2 TYPE REF TO cl_salv_table.

“Some data used for DB query
DATA: gt_mara TYPE STANDARD TABLE OF mara.
DATA: gt_mard TYPE STANDARD TABLE OF mard.

START-OF-SELECTION.

SELECT * FROM mara INTO TABLE gt_mara UP TO 200 ROWS.
SELECT * FROM mard INTO TABLE gt_mard UP TO 200 ROWS.

CALL SCREEN 2000.

*&———————————————————————*
*&      Module STATUS_2000  OUTPUT
*&———————————————————————*
MODULE status_2000 OUTPUT.
SET PF-STATUS ‘STATUS’.

“Now we create a docking container which will use the hole screen. So the Dynpro 2000 can’t be seen anymore.
CREATE OBJECT gr_container
EXPORTING
*     parent                      = g_grid_main
repid                       = syrepid                                  “needs report id
dynnr                       = sydynnr                                  “need dynpro number
side                        = cl_gui_docking_container=>dock_at_bottom  “we want to add the docking on the bottom of the screen 2000
extension                   = cl_gui_docking_container=>ws_maximizebox “The Dockingcontainer should use the hole screen
*     style                       =
*     lifetime                    = lifetime_default
*     caption                     =
*     metric                      = 0
*     ratio                       = 70
*     no_autodef_progid_dynnr     =
*     name                        =
EXCEPTIONS
cntl_error                  = 1
cntl_system_error           = 2
create_error                = 3
lifetime_error              = 4
lifetime_dynpro_dynpro_link = 5
OTHERS                      = 6.
IF sysubrc <> 0.
MESSAGE ID symsgid TYPE symsgty NUMBER symsgno
WITH symsgv1 symsgv2 symsgv3 symsgv4.
ENDIF.

**   create splitter container in which we’ll place the alv table
CREATE OBJECT lv_splitter
EXPORTING
parent  = gr_container
rows    = 2
columns = 1
align   = 15. ” (splitter fills the hole custom container)
**   get part of splitter container for 1st table
CALL METHOD lv_splitter->get_container
EXPORTING
row       = 1
column    = 1
RECEIVING
container = lv_parent1.
**   get part of splitter container for 2nd table
CALL METHOD lv_splitter->get_container
EXPORTING
row       = 2
column    = 1
RECEIVING
container = lv_parent2.

***  Display first ALV
PERFORM set_display.
***  Display second ALV
PERFORM set_display1.

ENDMODULE.                 ” STATUS_2000  OUTPUT
*&———————————————————————*
*&      Module USER_COMMAND_2000  INPUT
*&———————————————————————*
MODULE user_command_2000 INPUT.
IF syucomm = ‘EXIT’.
LEAVE PROGRAM.
ENDIF.
ENDMODULE.                 ” USER_COMMAND_2000  INPUT
*&———————————————————————*
*&      Form SET_DISPLAY
*&———————————————————————*
FORM set_display .
*… Create Instance
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container  = lv_parent1
IMPORTING
r_salv_table = gr_table1
CHANGING
t_table      = gt_mara.

*… Display table
gr_table1->display( ).
ENDFORM. ” SET_DISPLAY

FORM set_display1 .
*… Create Instance
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container  = lv_parent2
IMPORTING
r_salv_table = gr_table2
CHANGING
t_table      = gt_mard.

*… Display table
gr_table2->display( ).
ENDFORM.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Gabriela Soria Aguilar
      Gabriela Soria Aguilar

      Thanks for this code! I'll try it and check is works for me!

      Have a great day!