Application Development and Automation 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: 
Read only

ALV - print - create spool request

Former Member
0 Likes
5,837

Hi all,

We have made SAP Query (The majority and 'was written in ABAP code), a report using ALV grid (function 'REUSE_ALV_GRID_DISPLAY'). There is a 'Print' button on the grid. If the user presses this button the system will send a screen where the user can choose print parameters (name of printer, printing, direct or not, etc..) If the user presses 'Continue' a spool request is then created.

But the users do not want to see the screen parameters.

After pressing the button 'Print' on the grid, the spool request should be immediately created using the parameters seted in the ABAP program, the same program that creates ALV.

Any idea how to do this?

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,511

Hi,

You can set the line size to the value that your require. Maximum is 1023 characters.

Regards,

Aparna Alashe.

9 REPLIES 9
Read only

JerryWang
Product and Topic Expert
Product and Topic Expert
0 Likes
2,511

Hello Friend,

see this post.

Best Regards,

Jerry

Read only

Former Member
0 Likes
2,511

Hi,

Instead of using the standard 'Print' button on the ALV toolbar, create your own button on the ALV toolbar and when the user selects this button, write your code to display the ALV in spool.

This can be done by writing the FM for ALV within the NEW-PAGE PRINT ON (NO DIALOG) and NEW-PAGE PRINT OFF statements. This will also require use of FM GET_PRINT_PARAMETERS.

Regards,

Aparna Alashe.

Read only

0 Likes
2,511

Thank you. Please, could give the ABAP code to do this?

Read only

Former Member
0 Likes
2,511

Hi,

Please refer to the link to add button in the ALV tool bar:

[http://www.sapalv.net/2009/07/sap-alv-tutorial-4-%E2%80%93-add-button-to-toolbar/]

For creating spool on click of this pushbutton you can use the following:

* Set the Spool Parameters
  DATA: lwa_params TYPE pri_params,
        lv_valid TYPE c.

  CLEAR: lwa_params, lv_valid.

  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      in_parameters          = lwa_params
      layout                 = 'X_65_132'
      line_count             = 65
      line_size              = 132
      no_dialog              = 'X'
    IMPORTING
      out_parameters         = lwa_params
      valid                  = lv_valid
    EXCEPTIONS
      archive_info_not_found = 1
      invalid_print_params   = 2
      invalid_archive_params = 3
      OTHERS                 = 4.

  IF sy-subrc EQ 0.
    NEW-PAGE PRINT ON PARAMETERS lwa_params NO DIALOG.

*                  Write code for displaying the ALV here......

    NEW-PAGE PRINT OFF.
  ENDIF.

Regards,

Aparna Alashe.

Read only

0 Likes
2,511

Thank you.

One more question;). In cases where the format 'X_65_132' does not exist, should be created? How? Perhaps with T. SPAD?

Read only

Former Member
0 Likes
2,512

Hi,

You can set the line size to the value that your require. Maximum is 1023 characters.

Regards,

Aparna Alashe.

Read only

vishal_sharda2
Participant
0 Likes
2,511

Hi,

Use FM GET_PRINT_PARAMETERS and pass 'X' for NO_DIALOG parameter.

BR,

Vishal.

Read only

Former Member
0 Likes
2,511

Thanks

Read only

pankaj_mittal
Explorer
0 Likes
2,511

hi serenaaa,

Can you please send me the code to supress the dialog box with printer parameter.

Regards

Pankaj Mittal