ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Classic Lists → printing lists
Switching Printing On and Off
While printing is switched off, all list output is written to the list buffer for the current screen list. If printing is switched on, a print list is created. You can switch on printing as follows:
- Use statement
NEW-PAGE PRINT ON
.
- Choose function Execute + Print on the standard selection screen of an executable program.
- Call an executable program with the addition
TO SAP-SPOOL of statement
SUBMIT
.
- Schedule an executable program in a background job using the additions
VIA JOB
and TO SAP-SPOOL of statementSUBMIT
.
When using NEW-PAGE PRINT ON
, printing is switched on explicitly in the program.
With the other three options, printing is switched on as soon as an executable program starts running. Switching on printing opens a new
print list level.
Only printing switched on using NEW-PAGE PRINT ON
can be switched off again
using NEW-PAGE PRINT OFF
. Printing that is switched on at the start of a program cannot be switched off within this same program. When a program is executed in
background processing, printing is always switched on.
Other versions: 7.31 | 7.40 | 7.54
Examples
Switching printing on explicitly
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.