cancel
Showing results for 
Search instead for 
Did you mean: 

Auto change page size of local printer ?

Former Member
0 Kudos

Dear all,

I have two reports with different output page size.

Those two reports print with the same local printer.

Each time i print report, i need manully select the print page size on the printer setting page (on printer server level, not sap level).

It is possiable that printer server auto select the opportune page for the report.

Please give adivces, thanks .

BR.

Wu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Wu,

Try this piece of code to set print parameters by refering structure PRI_PARAMS Structure for Passing Print Parameters.

 DATA: l_param    TYPE pri_params,
        l_valid(1) TYPE c         .

*Get the parameters user specified
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      mode                   = 'CURRENT'
      no_dialog              = 'X'
    IMPORTING
      out_parameters         = l_param
    EXCEPTIONS
      archive_info_not_found = 1
      invalid_print_params   = 2
      invalid_archive_params = 3
      OTHERS                 = 4.

  CHECK sy-subrc EQ 0.
*If user selected 'print immediately' OR 'delete after print', we need
*to unselect them
  CLEAR v_newspool.
  IF l_param-primm EQ 'X' OR
     l_param-prrel EQ 'X'.
    v_newspool = 'X'.
  ENDIF.

  CHECK v_newspool EQ 'X'.  "skip rest if user param is correct

*Overwrite the ones we care about
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      expiration             = '8'            "keep in spool 8 days
      immediately            = ' '            "don't send to printer
      in_parameters          = l_param
      no_dialog              = 'X'
      release                = ' '            "keep in spool
    IMPORTING
      out_parameters         = l_param
      valid                  = l_valid
    EXCEPTIONS
      archive_info_not_found = 1
      invalid_print_params   = 2
      invalid_archive_params = 3
      OTHERS                 = 4.

  CHECK sy-subrc EQ 0.

*Force subsequent output to spool, with modified print parameters.
*a new spool is created. see also documentation on the option
*'NEW-SECTION'.
  NEW-PAGE PRINT ON NEW-SECTION PARAMETERS l_param NO DIALOG

For auto-settings you can refer the steps described in this link:

[Set printer settings|;

Edited by: K.Manas on Jan 6, 2011 6:40 AM

Former Member
0 Kudos

Hi K.Manas,

Thanks for your advices.

This FM can setting the output request parameter, but it still can't change the frontend printer's default print page size.

Did you have any other suggestion?

By the way, my repost is smartform, and two reposrts has differenct page size.

Best Regards,

Wu

Answers (1)

Answers (1)

aidan_black
Active Contributor
0 Kudos

Hi Wu,

Is this print created via a sapscript or a smartform? If so what page format do you specify in the form?

If you specify page format INCH12 in the form, then no command is sent to the printer to select a page size. The default page size of the printer is used automatically.

Regards,

Aidan