Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Docking Container Problem - 2 GRID's in one screen

Former Member
0 Kudos

Hi Friends,

I am not getting any output from the below code. Help me to achieve this.

Regards,

Viji.

REPORT ZTEST_ALV1234567 .
TYPE-POOLS: slis.
* Tables
TABLES: mara.
TYPES: BEGIN OF ty_name,
        name TYPE char10,
        age TYPE i,
       END OF ty_name.
TYPES: BEGIN OF ty_marks,
        sub1 TYPE i,
        sub2 TYPE i,
        total TYPE i,
       END OF ty_marks.
TYPES: BEGIN OF ty_phone,
        phnum TYPE char10,
       END OF ty_phone.
TYPES: BEGIN OF ty_addr,
        address TYPE char20,
       END OF ty_addr .
* Output internal table
DATA: itab TYPE TABLE OF ty_name,
      wa TYPE ty_name,
      itab1 TYPE TABLE OF ty_marks,
      wa1 TYPE ty_marks.
* ALV Grid
DATA: r_grid TYPE REF TO cl_gui_alv_grid,
      r_grid1 TYPE REF TO cl_gui_alv_grid,
      g_dock TYPE REF TO cl_gui_docking_container,
      g_dock1 TYPE REF TO cl_gui_docking_container,
      it_fieldcat TYPE lvc_t_fcat,
      it_fieldcat1 TYPE lvc_t_fcat,
      wa_fieldcat TYPE lvc_s_fcat.

START-OF-SELECTION.
  wa-name = 'TEST01'.
  wa-age = '1'.
  APPEND wa TO itab.
*
  wa-name = 'TEST02'.
  wa-age = '2'.
  APPEND wa TO itab.
*
  wa-name = 'TEST03'.
  wa-age = '3'.
  APPEND wa TO itab.
*
  wa1-sub1 = '11'.
  wa1-sub2 = '22'.
  wa1-total = wa1-sub1 + wa1-sub2.
  APPEND wa1 TO itab1.
*
  wa1-sub1 = '22'.
  wa1-sub2 = '33'.
  wa1-total = wa1-sub1 + wa1-sub2.
  APPEND wa1 TO itab1.
  CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'LISTOUT1'.
  SET TITLEBAR 'LIST1'.
  wa_fieldcat-fieldname = 'NAME'.
  wa_fieldcat-seltext = 'NAME OF THE STUDENT'.
  wa_fieldcat-coltext = 'NAME OF THE STUDENT'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.
  wa_fieldcat-fieldname = 'AGE'.
  wa_fieldcat-seltext = 'AGE OF THE STUDENT'.
  wa_fieldcat-coltext = 'AGE OF THE STUDENT'.
  APPEND wa_fieldcat TO it_fieldcat.
  wa_fieldcat-fieldname = 'SUB1'.
  wa_fieldcat-seltext = 'SUBJECT1'.
  wa_fieldcat-coltext = 'SUBJECT1'.
  APPEND wa_fieldcat TO it_fieldcat1.
  wa_fieldcat-fieldname = 'SUB2'.
  wa_fieldcat-seltext = 'SUBJECT2'.
  wa_fieldcat-coltext = 'SUBJECT2'.
  APPEND wa_fieldcat TO it_fieldcat1.
  wa_fieldcat-fieldname = 'TOTAL'.
  wa_fieldcat-seltext = 'TOTAL'.
  wa_fieldcat-coltext = 'TOTAL'.
  APPEND wa_fieldcat TO it_fieldcat1.
*
  IF g_dock IS INITIAL.
    CREATE OBJECT g_dock
          EXPORTING repid = sy-repid
                    dynnr = sy-dynnr side = g_dock->dock_at_top
                    extension = 300.
    CREATE OBJECT r_grid
          EXPORTING i_parent = g_dock.
  ENDIF.
*
  IF g_dock1 IS INITIAL.
    CREATE OBJECT g_dock1
          EXPORTING repid = sy-repid
                    dynnr = sy-dynnr side = g_dock1->dock_at_bottom
                    extension = 300.
    CREATE OBJECT r_grid1
          EXPORTING i_parent = g_dock1.
  ENDIF.
*
    IF NOT itab[] IS INITIAL.
      CALL METHOD r_grid->set_table_for_first_display
            CHANGING it_outtab = itab
                     it_fieldcatalog = it_fieldcat.
    ENDIF.
*
    IF NOT itab1[] IS INITIAL.
      CALL METHOD r_grid1->set_table_for_first_display
            CHANGING it_outtab = itab1
                     it_fieldcatalog = it_fieldcat1.
    ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE sy-ucomm.
    WHEN 'BACK'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit INPUT.
  CALL METHOD g_dock->free.
  CALL METHOD g_dock1->free.
ENDMODULE. " EXIT INPUT

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Vijayalakshmi,

Why do you have to create two docking containers ? I am not sure, what is your expected output? Is it something like in a screen, you want to display two grids side by side, in two different containers? If yes, then i think you should have a docking container and split container of that with appropriate extension values, then create your grids inside the split containers, say left and right or top and bottom

Thanks,

uma

4 REPLIES 4

Former Member
0 Kudos

Hello Vijayalakshmi,

Why do you have to create two docking containers ? I am not sure, what is your expected output? Is it something like in a screen, you want to display two grids side by side, in two different containers? If yes, then i think you should have a docking container and split container of that with appropriate extension values, then create your grids inside the split containers, say left and right or top and bottom

Thanks,

uma

former_member188685
Active Contributor

I am getting the output.. if you are not getting the output still then ....

The issue is that you didn't uncomment the PBO and PAI modules. try to uncomment them and test it again.

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.

 MODULE USER_COMMAND_0100.

Pawan_Kesari
Active Contributor
0 Kudos

make sure in screen call to your PBO and PAI are not commented.

Former Member
0 Kudos

Thanks a lot.