11-02-2009 9:19 AM
Hi all,
i hope there is someone that can help me.
My question is: is possible to display in the same dynpro two ALV grid table?
Thanks a lots,
Alex.
11-02-2009 10:07 AM
Hi Alex,
<li>It is possible to include two Grids on one dynpro screen.
<li>Define two Custom containers on Screen G_CCONTROL1 and G_CCONTROL2.
<li>We use two classes cl_gui_custom_container and cl_gui_alv_grid.
<li>Try like below program
<li>Create a standard screen and mark an area for the custom container control in the graphical Screen Painter (icon identified by letter 'C'). Assign name G_CCONTROL1 to this area and another with G_CCONTROL2.
REPORT ztest_notepad.
DATA: g_grid_control TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
DATA: it_t100 TYPE TABLE OF t100.
*start-of-selection
START-OF-SELECTION.
CALL SCREEN 1001."Double click on the screen and write flow logic
*&---------------------------------------------------------------------*
*& Module INITIALIZE_DATA OUTPUT
*&---------------------------------------------------------------------*
MODULE initialize_data OUTPUT.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'G_CCONTROL1'.
CREATE OBJECT g_grid_control
EXPORTING
i_parent = g_custom_container.
ENDIF.
IF it_t100[] IS INITIAL.
SELECT * FROM t100 INTO TABLE it_t100 UP TO 20 ROWS WHERE sprsl = sy-langu.
ENDIF.
CALL METHOD g_grid_control->set_table_for_first_display
EXPORTING
i_structure_name = 'T100'
CHANGING
it_outtab = it_t100.
ENDMODULE. " INITIALIZE_DATA OUTPUT
Thanks
Venkat.OPROCESS BEFORE OUTPUT.
MODULE initialize_data.
PROCESS AFTER INPUT.
" MODULE user_command_1001.
11-02-2009 9:25 AM
Hi,
Yes it is very much possible to have 2 ALV Grids on the same screen.
In SE51 Create 2 custom controls and name those 2.Through those custom controls you can define the areas where you want your ALV Grid display.
and use it like this below:-
*reference varaible for object for ALV GRID
DATA:oref TYPE REF TO cl_gui_alv_grid,
*Custom Control container Class reference
g_custom_container TYPE REF TO cl_gui_custom_container,
*Custom Control in screen painter
g_container TYPE scrfname VALUE 'TEST', "Any name you want to give for custom control
ok_code TYPE sy-ucomm.
CREATE OBJECT g_custom_container
EXPORTING
container_name = g_container.
*for that custom control screen area create and object
*of ALV GRID
CREATE OBJECT oref
EXPORTING
i_parent = g_custom_container.
*Call the display method for displaying ALV Data
CALL METHOD oref->set_table_for_first_display
EXPORTING
is_layout = wa_layout "Layout
CHANGING
it_fieldcatalog = t_fc "Field Catalog
it_outtab = t_table. "Final Table
Repeat the same thing for second one.
11-02-2009 9:31 AM
Yes if we use function REUSE_ALV_LIST_DISPLAY it is possible.
Other wise using container abs CL_GUI_ALV_GRID that is using classes and object we can create 2 container on the same screen. And bind each ALV with the each container.
11-02-2009 9:33 AM
Hi vijetasap ,
how can use FM REUSE_ALV_LIST_DISPLAY to display twon output tables?
Regards,
Alex.
11-02-2009 9:34 AM
11-02-2009 9:38 AM
Just include two screens in two different subscreen areas of a main screen or use a docking container.
BR
Thomas
11-02-2009 10:07 AM
Hi Alex,
<li>It is possible to include two Grids on one dynpro screen.
<li>Define two Custom containers on Screen G_CCONTROL1 and G_CCONTROL2.
<li>We use two classes cl_gui_custom_container and cl_gui_alv_grid.
<li>Try like below program
<li>Create a standard screen and mark an area for the custom container control in the graphical Screen Painter (icon identified by letter 'C'). Assign name G_CCONTROL1 to this area and another with G_CCONTROL2.
REPORT ztest_notepad.
DATA: g_grid_control TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
DATA: it_t100 TYPE TABLE OF t100.
*start-of-selection
START-OF-SELECTION.
CALL SCREEN 1001."Double click on the screen and write flow logic
*&---------------------------------------------------------------------*
*& Module INITIALIZE_DATA OUTPUT
*&---------------------------------------------------------------------*
MODULE initialize_data OUTPUT.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'G_CCONTROL1'.
CREATE OBJECT g_grid_control
EXPORTING
i_parent = g_custom_container.
ENDIF.
IF it_t100[] IS INITIAL.
SELECT * FROM t100 INTO TABLE it_t100 UP TO 20 ROWS WHERE sprsl = sy-langu.
ENDIF.
CALL METHOD g_grid_control->set_table_for_first_display
EXPORTING
i_structure_name = 'T100'
CHANGING
it_outtab = it_t100.
ENDMODULE. " INITIALIZE_DATA OUTPUT
Thanks
Venkat.OPROCESS BEFORE OUTPUT.
MODULE initialize_data.
PROCESS AFTER INPUT.
" MODULE user_command_1001.
11-02-2009 2:02 PM
Hi Venkat.O,
thanks a lots, i've solved my problem with your example-code.
Thanks, thanks