‎2008 Jan 03 9:32 AM
I tried the following code for printing the form automatically without any process after execute the transaction, but its not working.pls help me on this.
My requirements are dont want to display dialog window, simply execute the transaction it needs to be printed.
DATA : w_formname TYPE tdsfname. "form name
w_formname = 'Z_POLY_ORGINAL'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING DESTINATION = 'LP01'
COPIES = COUNT
LIST_NAME = 'TEST'
LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'
IMMEDIATELY = 'X'
RELEASE = 'X'
NEW_LIST_ID = 'X'
EXPIRATION = DAYS
LINE_SIZE = 79
LINE_COUNT = 23
LAYOUT = 'X_PAPER'
SAP_COVER_PAGE = 'X'
COVER_PAGE = 'X'
RECEIVER = 'SAPSRINIVAS'
DEPARTMENT = 'System'
NO_DIALOG = 'X'
IMPORTING OUT_PARAMETERS = PARAMS
VALID = VALID.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_formname
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = fm_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.
CALL FUNCTION fm_name
EXPORTING
rtim = rtim
mode = mode
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
it_final = it_final
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.
Thanks in advance.
Regards
Rajaram
‎2008 Jan 04 2:04 PM
Hi,
I see that you have commented the parameters 'CONTROL_PARAMETERS' and 'OUTPUT_OPTIONS' of the functiom module to print the smartform. Use the parameter
control_parameters-print_preview and control_parameters-no_dialog to supress the dialog box that appears after you select the print option.
Modify output_option parameters to control the number of pages and printer name etc.
Regards
Ajith