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: 

Print multiple ALV grids at once

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

If you are using oops alv you can use multiple gird.

8 REPLIES 8

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

If you are using oops alv you can use multiple gird.

0 Kudos

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.