ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Classic Lists → Create lists → NEW-PAGE
NEW-PAGE - spool_options
Other versions: 7.31 | 7.40 | 7.54
Syntax
... { PRINT ON [NEW-SECTION] PARAMETERS pri_params
[ARCHIVE PARAMETERS arc_params]
NO DIALOG }
| { PRINT OFF } ... .
Extras
1. ... PRINT ON [NEW-SECTION]
2. ... PARAMETERS pri_params
3. ... ARCHIVE PARAMETERS arc_params
4. ... NO DIALOG
5. ... PRINT OFF
Effect
The addition PRINT ON
writes all subsequent output statements to a
print list. The additions [ARCHIVE] PARAMETERS
are used to define the print parameters and the archiving parameters of the
spool request. The addition
PRINT OFF
closes a print list that has been started with the addition PRINT ON
.
Addition 1
... PRINT ON [NEW-SECTION]
Effect
The addition PRINT ON
creates a new
print list level. The first output statement after NEW-PAGE PRINT ON
opens a new
spool request and writes to a
print list in the
SAP spool system.
The number of the spool request is passed to sy-spono
by the first output statement. While it is being created, the print list is sent page by page to the SAP spool system.
- If the current list is a screen list, its creation is interrupted and the new print list level is stacked in it.
-
If the current list is a print list not created with
NEW-PAGE PRINT ON
, its creation is interrupted and the new print list level is stacked in it. -
If the current list is a print list created using NEW-PAGE
PRINT ON and the addition
NEW-SECTION
is not used, a handleable exception of the class CX_SY_NESTED_PRINT_ON is raised. -
If the current list is a print list created using NEW-PAGE
PRINT ON, the addition
NEW-SECTION
is used, the specified print parameters match those of the newly created list, and the print parameter PRNEW in the structurepri_params
is initial, no new spool request is opened and the output is written to the current print list. If the print parameters define the output of a cover sheet, the cover sheet is printed again before the following output as a spacer sheet. -
If the current list is a print list created using NEW-PAGE
PRINT ON, the addition
NEW-SECTION
is used, and the specified print parameters do not match those of the newly created list or the print parameter PRNEW in structure pri_params is not initial, the current spool request is closed implicitly byNEW-PAGE PRINT OFF
and a new spool request is created.
It is not possible to use NEW-PAGE PRINT ON
to stack another print list level directly on to a print list level created using NEW-PAGE PRINT ON
.
A print list level created using NEW-PAGE PRINT ON
can be closed by either
NEW-PAGE PRINT OFF
, NEW-PAGE PRINT ON NEW-SECTION
, the end of the program, or by leaving a screen sequence.
Notes
-
Each statement
NEW-PAGE PRINT ON
should be closed explicitly usingNEW-PAGE PRINT OFF
before the program end or before leaving a screen sequence. -
The addition
NEW-SECTION
can be used to avoid the exception CX_SY_NESTED_PRINT_ON. When usingNEW-SECTION
, the output can also be continued into the previous print list, which is not possible when an exception is handled withCATCH
. -
As well as the addition
NEW-SECTION
, the obsolete statementNEW-SECTION
can also be used outside of classes. However it does not allow you specify print parameters.
Addition 2
... PARAMETERS pri_params
Addition 3
... ARCHIVE PARAMETERS arc_params
Addition 4
... NO DIALOG
Effect
These additions provide the spool request with print parameters and archiving parameters. The latter are required if the print list is to be archived using ArchiveLink.
The addition PARAMETERS
passes the print parameters in a structure
pri_params of data type PRI_PARAMS from ABAP Dictionary. If archiving
is specified in pri_params
, you must pass archiving parameters using the
addition ARCHIVE PARAMETERS
in a structure arc_params
of data type ARC_PARAMS from ABAP Dictionary.
Structures of data types PRI_PARAMS and ARC_PARAMS must be filled by the function module
GET_PRINT_PARAMETERS. When calling the
function module, you can set individual or all print parameters in the program and/or display a print
dialog window. The function module creates a set of valid print and archiving parameters for use as pri_params
and arc_params
and adds these to its output parameters.
If the structures pri_params
or arc_params
are
initial, the print parameters or archiving parameters created by a call of the function modules GET_PRINT_PARAMETERS with initial input values are used.
The addition NO DIALOG
suppresses the dialog window that by default appears when using the PRINT ON
addition.
Notes
- These additions must always be used as indicated here. It is particularly important that the standard print dialog box be suppressed. When using the default print dialog window, the Back function is not available because the system can not return to a point before a statement after printing has been switched on by such a statement. You can only exit printing using Exit, which ends the entire program. If the user exits the window by choosing Cancel, inconsistent parameters can be produced. Instead, the print dialog box can be displayed when the function module GET_PRINT_PARAMETERS is executed. This function module has an output parameter VALID that indicates the consistency of the print parameters created.
-
The use of the addition
NO DIALOG
without simultaneously passing print parameters is allowed only outside of ABAP Objects and produces a warning in the syntax check. In other objects, the print parameters are derived from the user master record, if possible. -
As well as the additions shown here, there is a range of other additions for an
obsolete specification of print parameters, which should no longer be used.
Example
Creating print lists during the list event AT LINE-SELECTION. The print parameters are defined by the function module GET_PRINT_PARAMETERS before the basic list is created.
REPORT demo NO STANDARD PAGE HEADING.
DATA: spfli_wa TYPE spfli,
sflight_wa TYPE sflight.
DATA: print_parameters TYPE pri_params,
valid_flag TYPE c LENGTH 1.
START-OF-SELECTION.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
out_parameters = print_parameters
valid = valid_flag
EXCEPTIONS
invalid_print_params = 2
OTHERS = 4.
IF valid_flag = 'X' AND sy-subrc = 0.
SELECT carrid connid
FROM spfli
INTO CORRESPONDING FIELDS OF spfli_wa.
WRITE: / spfli_wa-carrid, spfli_wa-connid.
HIDE: spfli_wa-carrid, spfli_wa-connid.
ENDSELECT.
ELSE.
...
ENDIF.
AT LINE-SELECTION.
NEW-PAGE PRINT ON PARAMETERS print_parameters
NO DIALOG.
SELECT *
FROM sflight
INTO sflight_wa
WHERE carrid = spfli_wa-carrid AND
connid = spfli_wa-connid.
WRITE: / sflight_wa-carrid, sflight_wa-connid,
sflight_wa-fldate ...
ENDSELECT.
NEW-PAGE PRINT OFF.
Addition 5
... PRINT OFF
Effect
The addition PRINT OFF
closes a
print list level created
using NEW-PAGE PRINT ON
, sends the current page to the SAP spool system,
and releases the associated spool request. Output statements that follow NEW-PAGE PRINT OFF
write to the screen list or print list where the print list level closed by PRINT OFF
was
stacked. The system field sy-spono
is not modified directly but only with the next output statement into a print list.
NEW-PAGE PRINT OFF
has no effect on print list levels that have not been created using NEW-PAGE PRINT ON
.
Note
At the end of the program and at every list event
AT LINE-SELECTION, AT PFnn
,
and AT USER-COMMAND
, the statement NEW-PAGE PRINT OFF
is executed implicitly.
Exceptions
Catchable Exceptions
CX_SY_NESTED_PRINT_ON
-
Cause: Stacked
NEW-PAGE PRINT ON
.
Runtime Error:NESTED_PRINT_ON