04-05-2005 9:28 AM
Does anyone have a solution for the following problem:
I have a screen with 3 ALV grids. I would like to offer the user the possibility to have one button to print the ALV grids. Is this possible?
Kind regards,
John.
05-01-2014 7:50 AM
04-05-2005 9:57 AM
Hi,
I have also used three grids at once but u can print one grid at a time.
Printing all at once is not possible I guess.
Regards,
Judith
04-05-2005 4:26 PM
If it is worth the time, you can add a button to the application tool bar. When the user hits the button to print all 3 ALV grids, the data for all 3 grids are in your internal tables so you can do your own WRITE commands to print whatever you want.
You could also experiment with the BEFORE_USER_COMMAND event in CL_GUI_ALV_GRID. This event gives you access the the command that the user requested before it is executed. You can trap the print request, blank out the user command so that it is not executed, and then do your own printing.
04-05-2005 7:12 PM
Hi Charles,
Thanks for your answer.The idea was to use to the standard print functionality of the grids. However the method used for printing is a private method of the class, so I can't get access to it. Any ideas how to solve this?
Kind regards,
John.
11-09-2005 8:09 AM
Hello John,
Did you solve th problem? I got stuck in the same point. The method I found in cl_gui_alv_grid to print the grid is private... How did you solve it?
Regards,
Didem GUNDOGDU
Didem@ddmcon.com
06-18-2005 7:56 AM
Hi John,
I do have the same requirement but with 2 alv grids.
Did you get the solution?
If so can you please tel me how did u achieve it?
Thanks,
Bhavani
05-01-2014 7:47 AM
05-01-2014 7:50 AM
05-01-2014 8:11 AM
Hi,
first place three CUSTOM CONTROLLERS in one screen layout.
try this code.
DATA: O_CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_CONT2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_CONT3 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: O_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
O_GRID2 TYPE REF TO CL_GUI_ALV_GRID,
O_GRID3 TYPE REF TO CL_GUI_ALV_GRID.
DATA: IT_VBRK LIKE VBRK OCCURS 1 WITH HEADER LINE,
IT_VBRP LIKE VBRP OCCURS 1 WITH HEADER LINE.
PARAMETERS: P_VBELN LIKE VBRK-VBELN.
START-OF-SELECTION.
PERFORM GET_DATA.
SET SCREEN 100.
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM GET_DATA .
SELECT *
FROM VBRK
INTO TABLE IT_VBRK
WHERE VBELN = P_VBELN.
SELECT *
FROM VBRP
INTO TABLE IT_VBRP
WHERE VBELN = P_VBELN.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
PERFORM SHOW_GRIDS.
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
*&---------------------------------------------------------------------*
*& Form SHOW_GRIDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM SHOW_GRIDS .
IF O_CONT1 IS INITIAL.
CREATE OBJECT O_CONT1
EXPORTING
CONTAINER_NAME = 'HEAD_CONT'.
CREATE OBJECT O_CONT2
EXPORTING
CONTAINER_NAME = 'ITEM_CONT'.
CREATE OBJECT O_CONT3
EXPORTING
CONTAINER_NAME = 'CUS'.
CREATE OBJECT O_GRID1
EXPORTING
I_PARENT = O_CONT1.
CREATE OBJECT O_GRID2
EXPORTING
I_PARENT = O_CONT2.
CREATE OBJECT O_GRID3
EXPORTING
I_PARENT = O_CONT3.
*--SHOW GRIDS
CALL METHOD O_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRK'
CHANGING
IT_OUTTAB = IT_VBRK[].
CALL METHOD O_GRID2->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRP'
CHANGING
IT_OUTTAB = IT_VBRP[].
CALL METHOD O_GRID3->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRP'
CHANGING
IT_OUTTAB = IT_VBRP[].
ENDIF.
ENDFORM.