Here is an outline of my code that submits a background job:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = v_jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
IMPORTING
jobcount = v_jobcount.
SUBMIT (gc_report) AND RETURN
USING SELECTION-SET gc_variant
WITH SELECTION-TABLE t_seltab
USER sy-uname
VIA JOB v_jobname
NUMBER v_jobcount.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = v_jobcount
jobname = v_jobname
strtimmed = abap_true.
The users have default printers which are required for other tasks:
So when this code runs it automatically prints the spool to their default printer.
How can I change my SUBMIT
statement to stop the spool being printed but still keep it viewable in SM37? I found one way to do it which was to submit the report using a system user but some users don't have the authorisations to schedule jobs for other users so that method doesn't work.
First call the function module GET_PRINT_PARAMETERS
with no_dialog
, mode
and immediately
parameters:
DATA: ls_print_parameters TYPE pri_params,
lc_valid_prt_param TYPE flag.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
mode = 'BATCH'
immediately = ' '
IMPORTING
out_parameters = ls_print_parameters
valid = lv_valid_prt_param
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
and pass the received structure ls_print_parameters
via SPOOL PARAMETERS
to SUBMIT
call:
SUBMIT (gc_report) TO SAP-SPOOL
SPOOL PARAMETERS ls_print_parameters
WITHOUT SPOOL DYNPRO
...