cancel
Showing results for 
Search instead for 
Did you mean: 

I NEED TO PRINT A SMARTFORM AUTOMATICALLY

Former Member
0 Kudos

Hi every one, i need to print a smartform automatically when i push the save botton on standard transacction VA22, i have the user exit and the smartform ready to print, is there any to just call to print the smartform automatically without print screen?

thanks & regards.

luis

Accepted Solutions (0)

Answers (3)

Answers (3)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check my reply in this link.

Kindly reward points if it helps.

raja_thangamani
Active Contributor
0 Kudos

Use this piece of code.It will suppress dialog box & It will Print automatically.

REPORT z_forms NO STANDARD PAGE HEADING MESSAGE-ID zhrt.

* Variable Declaration
DATA : v_form_name TYPE rs38l_fnam,
itab TYPE STANDARD TABLE OF pa0001,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl.

SELECT * FROM pa0001 INTO TABLE itab UP TO 5 ROWS.
SORT itab BY pernr.
DELETE ADJACENT DUPLICATES FROM itab COMPARING pernr.

DATA: control TYPE ssfctrlop,
control_parameters TYPE ssfctrlop,
output_options type SSFCOMPOP.

control-preview = 'X'.
control-no_open = 'X'.
control-no_close = 'X'.
control-no_dialog = 'X'.
control-device = 'PRINTER'.
output_options-tddest = 'LOCL'.
OUTPUT_OPTIONS-TDNOPRINT = 'X'.
OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.

CALL FUNCTION 'SSF_OPEN'
EXPORTING
USER_SETTINGS = ' '
OUTPUT_OPTIONS = output_options
CONTROL_PARAMETERS = control
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.

output_options-tddest = 'LOCL'.
OUTPUT_OPTIONS-TDNOPRINT = 'X'.
OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.

CALL FUNCTION '/1BCDWB/SF00000066'
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = control
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = output_options
USER_SETTINGS = ' '
* IMPORTING
** DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO = w_return
** JOB_OUTPUT_OPTIONS =
TABLES
itab = itab
* 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.
CALL FUNCTION 'SSF_CLOSE'.

Raja T

Message was edited by:

Raja T

Former Member
0 Kudos

hello,

as you said i can see the print preview for a range of documents without the dialog

box being pop up again n again,

but i am not able to take the print of the preview now

and also no spool request is generated

i am giving NEW SPOOL REQUEST option in the OUTPUT OPTIONS, but

still it is not coming in the spool SP01

also when i am tryin to directly print from the preview,

it is showing the error

Error in spool C call: spool overflow

the scenario is for a range of document printing i am looping the SMARTFORM function and for the printer request not to pop up many times i am using ur code.

everything is fine till the preview, but printing is the problem.

please help

i want a spool request to be generated

Former Member
0 Kudos

Yes you can do that.

The reason why that pops up is that we haven't passed the print parameters to it.

In the parameter SSFCTRLOP, pass X for NO_DIALOG and clear the value in PREVIEW.

In the parameter SSFCOMPOP, specify the printer name in TDPRINTER, set TDIMMED to X.

This should fix the problem.

Regards,

Ravi

Note - Please mark all the helpful answers