2005 May 16 8:47 AM
Hi,
Can someone tell me if it's possible to display multiple ALV grids on the same window.If so how is it done.Please note that I am talking about Grid Display and not List Display.
Regards,
Swathi Balakrishnan
2005 May 16 8:53 AM
Hi,
This can be done even i have done a report.
Its very simple create three containers as below.
Just repeat three times if u need to create three containers.
See this sample code using custom container.
START-OF-SELECTION.
**----
Begin of process logic
**----
CALL SCREEN '0100'.
END-OF-SELECTION.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS01'.
SET TITLEBAR 'SALESTTL'.
*----
A L V G R I D
*----
IF o_grid_container IS INITIAL.
CREATE OBJECT o_grid_container
EXPORTING
container_name = '<b>CCONTAINER1</b>'.
CREATE OBJECT o_grid
EXPORTING
i_appl_events = 'X'
i_parent = o_grid_container.
*----
<b>FOR first A L V G R I D</b>
*----
PERFORM set_grid_field_catalog
CHANGING i_grid_fcat.
PERFORM modify_grid_fcat_predisplay
CHANGING i_grid_fcat.
PERFORM set_grid_layout_set
CHANGING struct_grid_lset.
PERFORM sort_outtable CHANGING i_sort_fcat.
PERFORM populate_grid_data TABLES i_grid_outs i_grid_outs_pro.
SORT i_grid_outs BY year month.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid_lset
CHANGING
it_outtab = i_grid_outs[]
it_fieldcatalog = i_grid_fcat[]
it_sort = i_sort_fcat. " Period
ENDIF.
IF o_grid1_container IS INITIAL.
CREATE OBJECT o_grid1_container
EXPORTING
container_name = '<b>CCONTAINER2</b>'.
CREATE OBJECT o_grid1
EXPORTING
i_appl_events = 'X'
i_parent = o_grid1_container.
-----------------------------------------------------
*<b> FOR SECOND ALV GRID</b>
-----------------------------------------------------
PERFORM set_grid1_field_catalog
CHANGING i_grid1_fcat.
PERFORM modify_grid1_fcat_predisplay
CHANGING i_grid1_fcat.
PERFORM set_grid1_layout_set
CHANGING struct_grid1_lset.
PERFORM sort_outtable1 CHANGING i_sort_fcat1.
PERFORM populate_grid1_data TABLES i_grid1_outs i_grid1_outs_pro.
SORT i_grid1_outs BY year month.
CALL METHOD o_grid1->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid1_lset
CHANGING
it_outtab = i_grid1_outs[]
it_fieldcatalog = i_grid1_fcat[]
it_sort = i_sort_fcat1. " Period
ENDIF.
IF o_grid2_container IS INITIAL.
CREATE OBJECT o_grid2_container
EXPORTING
container_name = '<b>CCONTAINER3</b>'.
CREATE OBJECT o_grid2
EXPORTING
i_appl_events = 'X'
i_parent = o_grid2_container.
-----------------------------------------------------
<b>FOR THIRD ALV GRID</b>
*----
PERFORM set_grid2_field_catalog
CHANGING i_grid2_fcat.
PERFORM modify_grid2_fcat_predisplay
CHANGING i_grid2_fcat.
PERFORM set_grid2_layout_set
CHANGING struct_grid2_lset.
PERFORM populate_grid2_data TABLES i_grid2_outs i_grid2_outs_pro.
SORT i_grid2_outs BY year month.
PERFORM sort_outtable2 CHANGING i_sort_fcat2.
CALL METHOD o_grid2->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid2_lset
CHANGING
it_outtab = i_grid2_outs[]
it_fieldcatalog = i_grid2_fcat[]
it_sort = i_sort_fcat2. " Period
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE user_command_0100 INPUT.
*----
As the events are registered as application events, control is first
passed to the program's PAI. The call 'cl_gui_cfw=>dispatch' will
forward control to ABAP object event handling and the appropriate
event handler will be called (if present). This allows the user to
selectively process events.
*----
DATA: i_return_code TYPE i .
CALL METHOD cl_gui_cfw=>dispatch
IMPORTING return_code = i_return_code.
save_ok = ok_code.
CASE save_ok.
WHEN 'BACK' OR 'END' OR 'CANC'.
PERFORM exit_program.
ENDCASE.
CLEAR save_ok.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Form EXIT_PROGRAM
&----
text
----
FORM exit_program.
CALL METHOD o_grid_container->free.
CALL METHOD o_grid1_container->free.
CALL METHOD o_grid2_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
Error in FLush
ENDIF.
LEAVE TO SCREEN 0.
ENDFORM. " EXIT_PROGRAM
If u want get more idea revert back to me.
Thanks & Regards,
Judith.
2005 May 16 8:50 AM
Hi,
It is certainly possible. You can either choose to have two custom containers on your screen, or use one custom container and have a splitter control inside that. you can later put your ALV Grids in these splitter containers.
Regards,
Anand Mandalika.
2005 May 16 8:53 AM
Hi,
This can be done even i have done a report.
Its very simple create three containers as below.
Just repeat three times if u need to create three containers.
See this sample code using custom container.
START-OF-SELECTION.
**----
Begin of process logic
**----
CALL SCREEN '0100'.
END-OF-SELECTION.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS01'.
SET TITLEBAR 'SALESTTL'.
*----
A L V G R I D
*----
IF o_grid_container IS INITIAL.
CREATE OBJECT o_grid_container
EXPORTING
container_name = '<b>CCONTAINER1</b>'.
CREATE OBJECT o_grid
EXPORTING
i_appl_events = 'X'
i_parent = o_grid_container.
*----
<b>FOR first A L V G R I D</b>
*----
PERFORM set_grid_field_catalog
CHANGING i_grid_fcat.
PERFORM modify_grid_fcat_predisplay
CHANGING i_grid_fcat.
PERFORM set_grid_layout_set
CHANGING struct_grid_lset.
PERFORM sort_outtable CHANGING i_sort_fcat.
PERFORM populate_grid_data TABLES i_grid_outs i_grid_outs_pro.
SORT i_grid_outs BY year month.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid_lset
CHANGING
it_outtab = i_grid_outs[]
it_fieldcatalog = i_grid_fcat[]
it_sort = i_sort_fcat. " Period
ENDIF.
IF o_grid1_container IS INITIAL.
CREATE OBJECT o_grid1_container
EXPORTING
container_name = '<b>CCONTAINER2</b>'.
CREATE OBJECT o_grid1
EXPORTING
i_appl_events = 'X'
i_parent = o_grid1_container.
-----------------------------------------------------
*<b> FOR SECOND ALV GRID</b>
-----------------------------------------------------
PERFORM set_grid1_field_catalog
CHANGING i_grid1_fcat.
PERFORM modify_grid1_fcat_predisplay
CHANGING i_grid1_fcat.
PERFORM set_grid1_layout_set
CHANGING struct_grid1_lset.
PERFORM sort_outtable1 CHANGING i_sort_fcat1.
PERFORM populate_grid1_data TABLES i_grid1_outs i_grid1_outs_pro.
SORT i_grid1_outs BY year month.
CALL METHOD o_grid1->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid1_lset
CHANGING
it_outtab = i_grid1_outs[]
it_fieldcatalog = i_grid1_fcat[]
it_sort = i_sort_fcat1. " Period
ENDIF.
IF o_grid2_container IS INITIAL.
CREATE OBJECT o_grid2_container
EXPORTING
container_name = '<b>CCONTAINER3</b>'.
CREATE OBJECT o_grid2
EXPORTING
i_appl_events = 'X'
i_parent = o_grid2_container.
-----------------------------------------------------
<b>FOR THIRD ALV GRID</b>
*----
PERFORM set_grid2_field_catalog
CHANGING i_grid2_fcat.
PERFORM modify_grid2_fcat_predisplay
CHANGING i_grid2_fcat.
PERFORM set_grid2_layout_set
CHANGING struct_grid2_lset.
PERFORM populate_grid2_data TABLES i_grid2_outs i_grid2_outs_pro.
SORT i_grid2_outs BY year month.
PERFORM sort_outtable2 CHANGING i_sort_fcat2.
CALL METHOD o_grid2->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid2_lset
CHANGING
it_outtab = i_grid2_outs[]
it_fieldcatalog = i_grid2_fcat[]
it_sort = i_sort_fcat2. " Period
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE user_command_0100 INPUT.
*----
As the events are registered as application events, control is first
passed to the program's PAI. The call 'cl_gui_cfw=>dispatch' will
forward control to ABAP object event handling and the appropriate
event handler will be called (if present). This allows the user to
selectively process events.
*----
DATA: i_return_code TYPE i .
CALL METHOD cl_gui_cfw=>dispatch
IMPORTING return_code = i_return_code.
save_ok = ok_code.
CASE save_ok.
WHEN 'BACK' OR 'END' OR 'CANC'.
PERFORM exit_program.
ENDCASE.
CLEAR save_ok.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Form EXIT_PROGRAM
&----
text
----
FORM exit_program.
CALL METHOD o_grid_container->free.
CALL METHOD o_grid1_container->free.
CALL METHOD o_grid2_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
Error in FLush
ENDIF.
LEAVE TO SCREEN 0.
ENDFORM. " EXIT_PROGRAM
If u want get more idea revert back to me.
Thanks & Regards,
Judith.
2005 May 16 12:29 PM
Hi judith,
Could you please sent the complete code to my email(swathi_bala_2000@yahoo.com).I am not familier with Abap programming using objects and hence what you have posted is not very clear.
Thanks and Regards,
Swathi Balakrishnan
2005 May 16 12:39 PM
Hi Swati,
I had sent u the whole code. Go through the code and get back to me if u need any clarification.
Thanks & Regards,
Judith.
2005 May 17 4:19 PM
Hi Judith,
thanks for the reply..but my problem here is not displaying two ALv grids but i am trying to put standard text's text on the top of the alv, say like a header.
I specefically need to display text which could be around of 20 lines .
I need to know what is the class provided by SAP to make it happen and how do i write the code as i am not too familair with object oriented ABAP.
Thanks
Umang
Message was edited by: Umang tandon
2005 Nov 14 2:31 PM
Hi Judith,
I have the same problem.
Can you send me the complete source
Thnx,
Regards,
GJ van Holland
2005 May 16 11:10 AM
Hi Swathi,
What you need is to use CL_GUI_ALV_GRID to create your ALVs and to use class CL_GUI_EASY_SPLITTER_CONTAINER in order to put them in your splitted screen.
You can see the following example from www.sapgenie.com:
http://www.sapgenie.com/abap/controls/splitter.htm
Hope it helps,
Eyal.