I have a smartform that will be printed severals times inside a loop, now I want to avoid the print dialog and print preview, and depending of user options, I want to define the device and if the user wants to print inmediatly or just generate a spool order. but for some reason I can't do that.
Here is the code:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = 'Z_MY_FORM' IMPORTING fm_name = l_fm_name EXCEPTIONS no_form = 1 no_function_module = 2 OTHERS = 3. control-no_dialog = 'X'. control-no_open = 'X'. control-no_close = 'X'. output_options-tdnewid = 'X'. output_options-tdimmed = p_device. output_options-tddest = p_printNow. CALL FUNCTION 'SSF_OPEN' EXPORTING control_parameters = control output_options = output_options EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 OTHERS = 5. LOOP AT it_table. CALL FUNCTION l_fm_name EXPORTING control_parameters = control swnes = it_table-swnes laufd = it_table-laufd vblnr = it_table-vblnr lifnr = it_table-lifnr word = it_table-word waers = it_table-waers EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 OTHERS = 5. ENDLOOP. CALL FUNCTION 'SSF_CLOSE' EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 OTHERS = 4. CALL FUNCTION 'SSF_READ_ERRORS' IMPORTING errortab = errtab.
Every time I try to call the FM l_fm_name (the smartform FM) without the print preview option in the control structure I have a sy-subrc return of 3 (Send error) and don't know why...
Any ideas will be welcome and rewarded.