SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → User Dialogs → Classic Lists → Spooling Lists →Switch Spooling On and Off
As long as spooling is switched off, all list output is written to the list buffer for the current screen list. When spooling is switched on, a spool list is created. You can switch on spooling as follows:
When using NEW-PAGE PRINT ON, spooling is explicitly switched on in the program. With the other three options, spooling is switched on from the beginning of executing an executable program. Switching on spooling opens a new spool list level.
Only the spooling switched on with NEW-PAGE PRINT ON can be switched off again using NEW-PAGE PRINT OFF. Spooling that is switched on at the start of a program, cannot be switched off within this same program. In particular, spooling is always switched on when executing a program in background processing.
Examples
Explicitly switching on spooling
DATA: params TYPE pri_params,
valid TYPE c.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING out_parameters = params
valid = valid.
IF valid <> space.
NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.
WRITE / ...
NEW-PAGE PRINT OFF.
ENDIF.
Switching optical archiving on explicitly
DATA: pri_params TYPE pri_params,
arc_params TYPE arc_params,
valid TYPE c.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING out_parameters = pri_params
out_archive_parameters = arc_params
valid = valid.
IF valid <> space.
NEW-PAGE PRINT ON PARAMETERS pri_params
ARCHIVE PARAMETERS arc_params NO DIALOG.
PRINT-CONTROL INDEX-LINE ' '.
WRITE / ....
NEW-PAGE PRINT OFF.
ENDIF.
Program call
DATA: params TYPE pri_params,
valid TYPE c.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING out_parameters = params
valid = valid.
IF valid <> space.
SUBMIT myreport TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS params.
ENDIF.
Scheduling a background job
DATA: params TYPE pri_params,
valid TYPE c.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING mode = 'BATCH'
report = 'MYREPORT'
IMPORTING out_parameters = params
valid = valid.
IF valid <> space.
CALL FUNCTION 'JOB_OPEN' .... EXPORTING jobcount ...
SUBMIT myreport VIA JOB 'MY_JOB' NUMBER jobcount
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS params.
CALL FUNCTION 'JOB_CLOSE' ...
ENDIF.