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: 

Controlling printer formatting from within program

Former Member
0 Kudos

Hi Experts,

I have a requirement in which the user wants to that the printer's default setting of format 'X_65_1024' should be changed to 'X_65_255' in case of if he executes this perticular report.

The output of the report is ALV list display.

Is it possible to control printer's setting from within the program?

I serached and found two FMs.

'SET_PRINT_PARAMETERS' and 'GET_PRINT_PARAMETERS' .

But I am unable to understand how to use these FMs.

Is there any other way to achieve this?

Any pointers to resolve this issue would be very helpful.

4 REPLIES 4

former_member611006
Active Participant
0 Kudos

Hi,

look here:

http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dba56d35c111d1829f0000e829fbfe/content.htm

All Print Parameters are described.

And a little code example:

CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      destination    = lv_pdest
      copies         = lv_count
      list_name      = lv_lnam
      list_text      = lv_prtxt
      immediately    = lv_flg_prn
      release        = ' '
      new_list_id    = 'X'
      expiration     = lv_days
      line_size      = 255
      line_count     = 65
      layout         = 'X_65_255'
      sap_cover_page = ' '
      cover_page     = ' '
      receiver       = lv_prrec
      department     = lv_prabt
      no_dialog      = 'X'
    IMPORTING
      out_parameters = ls_params
      valid          = lv_valid.

  IF lv_valid <> space.
    NEW-PAGE PRINT ON
      PARAMETERS ls_params NEW-SECTION NO DIALOG.
ENDIF.

Hope it helps.

Regards,

David

0 Kudos

Thanks for you reply.

Can you tell me how to use GET_PRINT_PARAMETERS in case of ALV list display?

When the user clicks on Print button on menu bar, I want the dialog box to be pre-populated with default settings.

The code given is useful in case of write statement but not in case of ALV.

0 Kudos

Hi,

try to set your parameters at the beginning:

CALL FUNCTION 'SET_PRINT_PARAMETERS'
      EXPORTING
           immediately           = 'X'
           layout                = 'X_65_255'
         line_count              = 65.

Regards,

David

Pawan_Kesari
Active Contributor
0 Kudos

Try

REPORT xxxxxx LINE-SIZE 255 LINE-COUNT 65 .