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: 

how to print set of documents without showing print dialog box

divya_nayudu
Participant
0 Kudos

I have created a smartform tht prints a Payment Advice. Its input includes range of Document numbers.

I call the smartform function in loop for all those document numbers. Now my problem is tht everytime tht function is executed the print dialog opens up askin for Printer name and then on pressin 'print', one document is printed and so user has to press print tht many times. To avoid this i added code:

DATA: it_ssfcompop TYPE ssfcompop.

DATA : gst_control_parameters TYPE ssfctrlop.

DATA : gt_job_output_info TYPE ssfcrescl.

it_ssfcompop-tddest = 'LOCL'.

IT_SSFCOMPOP-TDNOPREV = 'X'.

it_ssfcompop-tdnewid = sy-prnew.

it_ssfcompop-tddelete = sy-prrel.

it_ssfcompop-tdimmed = 'X'.

it_ssfcompop-tdnoprint = 'X'.

CLEAR gst_control_parameters.

gst_control_parameters-no_dialog = 'X'.

gst_control_parameters-preview = 'X'. "Deactivate preview!

gst_control_parameters-GETOTF = 'X'.

and called smartform function like this:

CALL FUNCTION FM_NAME

EXPORTING

BUKRS = BUKRS-LOW

BELNR = BELNR

GJAHR = GJAHR-LOW

CONTROL_PARAMETERS = gst_control_parameters

OUTPUT_OPTIONS = it_ssfcompop

IMPORTING

JOB_OUTPUT_INFO = gt_job_output_info.

this shows print preview but still does not print. What could be error. Please help.

7 REPLIES 7

former_member223537
Active Contributor
0 Kudos
DATA: it_ssfcompop TYPE ssfcompop.
DATA : gst_control_parameters TYPE ssfctrlop.
DATA : gt_job_output_info TYPE ssfcrescl.

it_ssfcompop-tddest = 'LOCL'. " Check if its LOCL or LP01
IT_SSFCOMPOP-TDNOPREV = 'X'.
*it_ssfcompop-tdnewid = sy-prnew. " Not required
* it_ssfcompop-tddelete = sy-prrel. " Not required
it_ssfcompop-tdimmed = 'X'.

* it_ssfcompop-tdnoprint = 'X'. " Not required

CLEAR gst_control_parameters.

gst_control_parameters-no_dialog = 'X'.
* gst_control_parameters-preview = 'X'. "Deactivate preview! " Not required
gst_control_parameters-GETOTF = 'X'. " Not required

and called smartform function like this:
CALL FUNCTION FM_NAME
EXPORTING
BUKRS = BUKRS-LOW
BELNR = BELNR
GJAHR = GJAHR-LOW
CONTROL_PARAMETERS = gst_control_parameters
OUTPUT_OPTIONS = it_ssfcompop
IMPORTING
JOB_OUTPUT_INFO = gt_job_output_info.

0 Kudos

i've checked it. LOCL is the default printer and i've tried with various settings, but now i've realised that it goes in Spool instead of getting printed on the spot. And then we have to explicit give print command from the spool.

former_member223537
Active Contributor
0 Kudos
it_ssfcompop-tdimmed = 'X'. " This indicates PRINT IMMEDIATELY

0 Kudos

yes i know. But it doesn't really solve my purpose.

0 Kudos

Try this



* Work Area declarations
w_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
w_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
w_buffer TYPE string,"To convert from 132 to 255
* Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZONE'
importing
fm_name = v_form_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.

CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

Former Member
0 Kudos

hi.

you have to call the function module that has been generated outside the loop.

since you have called the function module inside the loop the spool request is generated for each document.

once you write the function module outside the loop the spool request will be generated for all the documents together and then you can take the print of all the documents.

divya_nayudu
Participant
0 Kudos

created the loop inside the smartform