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

Print Report automatically without dialog

Former Member
0 Likes
3,865

Hi,

I have requirement to print output of report from another program automatically. Below is mycode.My problem is that it is displaying Print dialog although I have set No dialog as X in GET_PRINT_PARAMETERS.Am I doing something wrong ?

Any help appericiated.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

DESTINATION = USR01-SPLD

IMMEDIATELY = 'X'

LAYOUT = iv_paart

LINE_COUNT = iv_linct

LINE_SIZE = iv_linsz

NO_DIALOG = 'X'

IMPORTING

OUT_ARCHIVE_PARAMETERS = gs_arc_par

OUT_PARAMETERS = gs_pri_par

VALID = gv_valid

  • VALID_FOR_SPOOL_CREATION =

EXCEPTIONS

ARCHIVE_INFO_NOT_FOUND = 1

INVALID_PRINT_PARAMS = 2

INVALID_ARCHIVE_PARAMS = 3

OTHERS = 4

.

SUBMIT Ztest WITH SELECTION-TABLE lt_param

TO SAP-SPOOL

SPOOL PARAMETERS gs_pri_par

ARCHIVE PARAMETERS gs_arc_par

WITHOUT SPOOL DYNPRO

AND RETURN.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks,

Reksap

1 ACCEPTED SOLUTION
Read only

brunobex
Active Participant
0 Likes
2,373

Hi Reksap,

I could not see anything wrong. See the test I did on a local printer.

Main program:


REPORT  zprog_spool.

DATA:
      w_param      TYPE pri_params,
      w_arc_params TYPE arc_params,
      v_valid      TYPE c LENGTH 1.

DATA: t_param TYPE STANDARD TABLE OF rsparams.

FIELD-SYMBOLS: <f_param> LIKE LINE OF t_param.

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
  EXPORTING
    curr_report     = 'ZIMPRIMI_SPOOL'
  TABLES
    selection_table = t_param
  EXCEPTIONS
    OTHERS          = 1.

LOOP AT t_param ASSIGNING <f_param>.
  <f_param>-low = 'A'.
ENDLOOP.

WRITE: /001 'START'.

CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    copies                 = 1
    destination            = 'LOCL'
    immediately            = 'X'
    layout                 = 'X_65_200'
    line_count             = 10
    line_size              = 255
    no_dialog              = 'X'
  IMPORTING
    out_archive_parameters = w_arc_params
    out_parameters         = w_param
    valid                  = v_valid
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

SUBMIT zimprimi_spool WITH SELECTION-TABLE t_param
TO SAP-SPOOL
SPOOL PARAMETERS w_param
ARCHIVE PARAMETERS w_arc_params
WITHOUT SPOOL DYNPRO
AND RETURN.

WRITE: /001 'END'.

Program Print:


REPORT  ZIMPRIMI_SPOOL.

PARAMETERS: P_FIELD TYPE C.

write: /001 'Value Field:', p_field.

Regards

Bruno Xavier.

Hi,

I have requirement to print output of report from another program automatically. Below is mycode.My problem is that it is displaying Print dialog although I have set No dialog as X in GET_PRINT_PARAMETERS.Am I doing something wrong ?

Any help appericiated.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

DESTINATION = USR01-SPLD

IMMEDIATELY = 'X'

LAYOUT = iv_paart

LINE_COUNT = iv_linct

LINE_SIZE = iv_linsz

NO_DIALOG = 'X'

IMPORTING

OUT_ARCHIVE_PARAMETERS = gs_arc_par

OUT_PARAMETERS = gs_pri_par

VALID = gv_valid

  • VALID_FOR_SPOOL_CREATION =

EXCEPTIONS

ARCHIVE_INFO_NOT_FOUND = 1

INVALID_PRINT_PARAMS = 2

INVALID_ARCHIVE_PARAMS = 3

OTHERS = 4

.

SUBMIT Ztest WITH SELECTION-TABLE lt_param

TO SAP-SPOOL

SPOOL PARAMETERS gs_pri_par

ARCHIVE PARAMETERS gs_arc_par

WITHOUT SPOOL DYNPRO

AND RETURN.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks,

Reksap

8 REPLIES 8
Read only

brunobex
Active Participant
0 Likes
2,374

Hi Reksap,

I could not see anything wrong. See the test I did on a local printer.

Main program:


REPORT  zprog_spool.

DATA:
      w_param      TYPE pri_params,
      w_arc_params TYPE arc_params,
      v_valid      TYPE c LENGTH 1.

DATA: t_param TYPE STANDARD TABLE OF rsparams.

FIELD-SYMBOLS: <f_param> LIKE LINE OF t_param.

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
  EXPORTING
    curr_report     = 'ZIMPRIMI_SPOOL'
  TABLES
    selection_table = t_param
  EXCEPTIONS
    OTHERS          = 1.

LOOP AT t_param ASSIGNING <f_param>.
  <f_param>-low = 'A'.
ENDLOOP.

WRITE: /001 'START'.

CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    copies                 = 1
    destination            = 'LOCL'
    immediately            = 'X'
    layout                 = 'X_65_200'
    line_count             = 10
    line_size              = 255
    no_dialog              = 'X'
  IMPORTING
    out_archive_parameters = w_arc_params
    out_parameters         = w_param
    valid                  = v_valid
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

SUBMIT zimprimi_spool WITH SELECTION-TABLE t_param
TO SAP-SPOOL
SPOOL PARAMETERS w_param
ARCHIVE PARAMETERS w_arc_params
WITHOUT SPOOL DYNPRO
AND RETURN.

WRITE: /001 'END'.

Program Print:


REPORT  ZIMPRIMI_SPOOL.

PARAMETERS: P_FIELD TYPE C.

write: /001 'Value Field:', p_field.

Regards

Bruno Xavier.

Read only

Former Member
0 Likes
2,373

Hi Bruno,

Thanks for replying.I copy your code also but it still display me dialog for printer. the dialog box is not for asking output device but printer.I couldn't paste screen here.Giving details below.

Printer : name,status,type where,and Properties pushbutton

Print Range

Copies.

REPORT  ZPRINTTEST.

DATA:
      w_param      TYPE pri_params,
      w_arc_params TYPE arc_params,
      v_valid      TYPE c LENGTH 1.

DATA: t_param TYPE STANDARD TABLE OF rsparams.

FIELD-SYMBOLS: <f_param> LIKE LINE OF t_param.

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
  EXPORTING
    curr_report     = 'ZPRINTTEST1'
  TABLES
    selection_table = t_param
  EXCEPTIONS
    OTHERS          = 1.

LOOP AT t_param ASSIGNING <f_param>.
  <f_param>-low = 'A'.
ENDLOOP.

WRITE: /001 'START'.


CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    copies                 = 1
    destination            = 'FRON'
    immediately            = 'X'
    layout                 = 'X_65_255'
    line_count             = 10
    line_size              = 255
    no_dialog              = 'X'
  IMPORTING
    out_archive_parameters = w_arc_params
    out_parameters         = w_param
    valid                  = v_valid
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.
IF sy-subrc <> 0.
*  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

SUBMIT ZPRINTTEST1 WITH SELECTION-TABLE t_param
TO SAP-SPOOL
SPOOL PARAMETERS w_param
ARCHIVE PARAMETERS w_arc_params
WITHOUT SPOOL DYNPRO
AND RETURN.

WRITE: /001 'END'.

REPORT  ZPRINTTEST1.



PARAMETERS: P_FIELD TYPE C.

write: /001 'Value Field:', p_field.

Thanks,

Reksap

Read only

Former Member
0 Likes
2,373

Hi,

I think the problem is not with the print program but with the printer settings in SPAD transaction code.

Please check the printer/spool/device settings in SPAD.

Btw are you using a frontend printer i.e. it should create a spool and also print it directly on the local printer? If yes then maybe your local printer is not properly configured to SAP output device. Generally, we use LOCL as local printer but I think you are using different option 'FRON'.

Regards,

Saba

Edited by: Saba Sayed on Mar 7, 2012 7:40 PM

Read only

Former Member
0 Likes
2,373

Hi Saba,

I also feel the same but don't know which setting need to bechanged in SPAD.The ouput device is FRON in our system.Spool is getting created and also printing it to default printer but this print dialog is not suppressed.

In SPAD for Output device FRON do we need to change Access method.In our case it is G : Front End Printing with control Tech.

Thanks,

Rekha.

Read only

Former Member
0 Likes
2,373

Hi Rekha,

Try changing the access method to F: Printing on Front End Computer.

Let me know if this works.

- Saba

Read only

Former Member
0 Likes
2,373

Thanks Saba.

It worked now.

Thanks,

Reksap.

Read only

former_member195421
Participant
0 Likes
2,373

Hi ,

Can you check in run time if the destination printer is getting passsed to the function module , in smartforms If you do not specify an output device, SAP Smart Forms opens the spool dialog even if NO_DIALOG is set. Dont know if it is applicable in your scenario , please do a check .

Regards,

Ratheesh BS

Read only

Former Member
0 Likes
2,373

Hi,

I cannot see anything wrong in your code. Just try giving the mode as CURRENT in the import parameter.


CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    mode                   = 'CURRENT' " Give the mode as CURRENT
    destination            = 'LOCL'
    immediately            = 'X'
    layout                 = 'X_65_200'
    line_count             = 10
    line_size              = 255
    no_dialog              = 'X'
  IMPORTING
    out_archive_parameters = wa_arc_params
    out_parameters         = wa_out_params
    valid                  = p_valid
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.
IF sy-subrc NE 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

Regards,

Danish