ARTIClE
Spooling Lists
The example demonstrates how to spool lists and how to stack spool list
levels.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
The program creates five lists. If the user chooses Execute on
the selection screen, one screen list and four spool lists are created.
If the user chooses Execute + Print on the selection screen, five
spool lists are created.
In the event block INITIALIZATION , by calling function module
GET_PRINT_PARAMETERS , the spool parameters are placed into the
structure params . By passing the initial value to parameter
IMMEDIATELY , the spool requests are stored in the spool system, but
not spooled immediately. Function module SET_PRINT_PARAMETERS is
used to pre-fill the input fields of the spool dialog window of the
selection screen.
The spool requests created and the content of the spool lists can be
displayed by choosing System - Own Spool Requests .
Depending on the user action, the first list on the selection screen is
either a two-page screen list (basic list) or a two-page spool list with
the title "Parameter 1". The first page contains a line "AAAA" .
The second page contains a line "HHHH" .
The second list is a one-page spool list explicitly created with
NEW-PAGE PRINT ON and carries the title "Parameter 2". It contains
the lines "BBBB" and "GGGG" . Its spool list level is
stacked upon the screen list or upon the spool list level with the title
"Parameter 1".
The third list is a two-page spool list implicitly created by the call
of a screen sequence with CALL SCREEN and carries the title
"Parameter 2". The first page contains a line "CCCC" . The second
page contains a line "FFFF" . Its spool list level is stacked upon
the spool list level of the previous spool list with the title
"Parameter 2", from which the spool parameters are also taken.
The fourth list is a one-page spool list explicitly created with
NEW-PAGE PRINT ON and carries the title "Parameter 3". It contains
the line "DDDD" . Its spool list level is stacked upon the spool
list level of the previous spool list with the title "Parameter 2".
The fifth list is a one-page spool list explicitly created with
NEW-PAGE PRINT ON and carries the title "Parameter 4". It contains
the line "EEEE" . Its spool list level is stacked upon the spool
list level of the previous spool list with the title "Parameter 2".
The fifth list is created in the static method print of class
print_demo . The first attempt to create a new spool list with the
title "Parameter 4" raises the exception CX_SY_NESTED_PRINT_ON ,
because the spool list created with NEW-PAGE PRINT ON and
carrying the title "Parameter 3" is still open. When the exception is
handled, a new spool list is opened using the addition
NEW SECTION
. Since the spool parameters used are different, the opened spool
list is closed and a new spool list is opened, no longer raising an
exception. If identical spool parameters are used, the output is
appended to the existing spool list. Because the spool list opened using
NEW-PAGE PRINT ON is closed already in the method, the statement
NEW-PAGE PRINT OFF in the dialog module status_0100 no
longer has an effect.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved