Get Example source ABAP code based on a different SAP table
ABAP_LIST - Spool 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>, the spool parameters are placed in the structure params> by calling function module GET_PRINT_PARAMETERS>. 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 box of the selection screen. The created spool requests, 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 created explicitly using NEW-PAGE PRINT ON> and carries the title Parameter 2>. It contains the lines BBBB> and GGGG>. Its spool list level is stacked on the screen list or on the spool list level with the title Parameter 1>.
The third list is a two-page spool list created implicitly by calling a dynpro sequence using 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 on 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 created explicitly using NEW-PAGE PRINT ON> and carries the title Parameter 3>. It contains the line DDDD>. Its spool list level is stacked on the spool list level of the previous spool list with the title Parameter 2>.
The fifth list is a one-page spool list created explicitly using NEW-PAGE PRINT ON> and carries the title Parameter 4>. It contains the line EEEE>. Its spool list level is stacked on 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.