‎2006 Dec 13 6:59 AM
Hi Experts,
I created one program to run one report in background.whenever I am trying to execute it with BACKGROUND user report O/P got disturbed. I think this may occur because I am not supplying print parameters. Does anybody knows how to set the prnt parameters for user background using FM GET_PRINT_PARAMETERS.
I want to set following parameters for this user only while executing my report.
Output device = WINDEFAULT
Format = X_65_512/2
Time of printing = Send to SAP spooler only for now.
Delete Immediately = No
Retention period = 8
New spool request =yes
Do not append print = No
Please advice how can I set all these print parameters for user BACKGROUND while executing my report in background using JOB_OPEN, SUBMIT, and JOB_CLOSE
Thanks in Advance,
Harkamal
‎2006 Dec 13 7:12 AM
Hope below example can help you:
FORM get_print_params USING p_prin LIKE tsp03-padest
p_imm TYPE c
p_text.
DATA: val(1).
DATA: pdest LIKE pri_params-pdest.
DATA: l_list LIKE pri_params-plist.
l_list = p_text.
IF p_prin IS INITIAL.
pdest = 'LOCL'.
ELSE.
pdest = p_prin.
ENDIF.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = pdest
no_dialog = 'X'
immediately = p_imm
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
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.
IF NOT l_list EQ 'Mismatch'.
pripar-linct = 65.
pripar-linsz = 190.
pripar-paart = 'X_65_132'.
ELSE.
pripar-linct = 90.
pripar-linsz = 120.
pripar-paart = 'X_90_120'.
ENDIF.
pripar-prdsn = 'VEN'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = arcpar
in_parameters = pripar
no_dialog = 'X'
list_name = l_list
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS pripar
ARCHIVE PARAMETERS arcpar
NO DIALOG.
ELSE.
CLEAR: it_mess.
CONCATENATE 'UNABLE TO GENERATE SPOOL:' l_list INTO it_mess-mesg.
APPEND it_mess.
ENDIF.
ENDFORM. " GET_PRINT_PARAMSKind Regards
Eswar