Printing Lists

The 'printing' of lists means that the list outputs are not transferred to the list buffer for screen lists, they are tranferred page by page to the SAP spool system. After a page has been transferred it is deleted from the ABAP runtime environment and then only exists in the SAP spool system. The size of a print list is therefore only limited by the intake capacity of the spool system, so they can become very large. On the other hand, it is not possible to refer to previous pages during the creation of print lists.

Each printing of list outputs is connected with a spool request. The list pages that are output to a spool request make up a print list. The print list of a spool request can be printed out using a printer or archived using ArchiveLink.

For the printing of lists the switching on and off of list output, as well as the connection with a spool request, are important.

Switching Printing On and Off

As long as printing is switched off, all list outputs are written in the the list buffer for the current screen list. When printing is switched on a print list is created. Printing can be switched on as follows:

The use of NEW-PAGE PRINT ON explicitly switches printing on in the program. In the other three possibilites printing is switched on from the begining of the execution of an executable program. Activating printing opens a new print list level.

Only printing using NEW-PAGE PRINT ON can be switched off using NEW-PAGE PRINT OFF. Printing that is activated at the start of a program cannot be switched off again within the same program. Printing is always activated during the execution of programs that use background processing.

Print List Levels and Spool Requests

Every output in a print list is assigned one spool request. Print parameters are specified for each spool request and these cannot be altered. Print lists can be stacked in print list levels. A print list level is always assigned a spool request.

Print List Levels

The following operations creat a new print list level:

A print list level created with NEW-PAGE PRINT ON can therefore only be stacked on a print list level that was not created with NEW-PAGE PRINT ON or in the creation of a screen list.

Up to 20 print list levels can be stacked.

Opening Spool Requests

The first output statement of a print list level opens a new spool request, the number of which is saved in the system field sy-spono. If a spool request already exists then this remains open and will be used again after the current print list level has been left. In a print list level that is created by the call of a screen sequence the spool request takes on the print parameters of the previous spool request. In the other cases the explicitly specified print parameters are applied.

Closing Spool Requests

The spool request of a print list level that was not created using NEW-PAGE PRINT ON is closed when the print list level is exited, that means either at the end of the program or when a screen sequence is exited. If there is a spool request, that was created using NEW-PAGE PRINT ON and that has not yet been closed using NEW-PAGE PRINT OFF, stacked on the print list level it will also be closed. Further output statements are written either in the print list of the previous spool request or in the current screen list.

The NEW-PAGE PRINT OFF statement only closes spool requests in which printing was activated using NEW-PAGE PRINT ON. If no previous spool request is then opened, printing is also switched off, resulting in all further output statements being written in the screen list. If a previous spool request exists then printing remains active and output statements are written in its print list. NEW-PAGE PRINT OFF has no effect on spool requests that were not activated using NEW-PAGE PRINT ON.

After a spool request has been closed, its number remains in the system field sy-spono until an output statement is written in a print list. This can either be in a new print list or in the print list of a previous spool request. If there is a previous spool request in existence after a spool request has been closed, the number in sy-spono remains different from its number until an output is written to its print list again.

Note

We recommend that a spool request opened using NEW-PAGE PRINT ON should always be explicitly closed using NEW-PAGE PRINT OFF before they are implicitly closed at the end of the program or when a screen sequence is exited.

Print Parameters

Print aparemeters must be set for every spool request. The print parameters are either explicitly specified or implicitly determined. In the ABAP statements NEW-PAGE PRINT ON and SUBMIT TO SAP-SPOOL the print parameters are specified in a type PRI_PARAMS structure from the ABAP Dictionary. Print parameters can be adjusted using archiving parameters if the data of the spool request is to be archived using ArchiveLink. To do this optical archiving (archiving mode 2 or 3) is switched on in the print parameters. Archiving parameters are specified in a type ARC_PARAMS structure from the ABAP Dictionary.

The print and archiving parameters can only be set with the help of the function module GET_PRINT_PARAMETERS. Setting the print parameters directly leads to a runtime error if the parameter is subsequently used in NEW-PAGE PRINT ON or SUBMIT TO SAP-SPOOL. Using the function module GET_PRINT_PARAMETERS the following functions can be carried out:

The most important print parameters are (the corresponding input parameters for GET_PRINT_PARAMETERS are giving in the brackets):

Print Control

Adjustment of Top and Left Margins

Using the SET MARGIN statement it is possible to specify the top and left margin of a print page.

Formating of Print Lists

While printing is active it is possible to write additional format information for the print list in the spool control using the PRINT-CONTROL statement. For the most part this is control statements for the output device (printer) or administration information for optical archiving.

Printing of Screen Lists

In addition to the creation of print lists described previously, it is also possible to send screen lists to the SAP spool system after they have been created. To do this it is possible to select the function Print in the lsit display. This function converts the screen list to a print list. This approach is generally afflicted by the following problems however:

This way of printing a list should not be used for productive purposes. It is only suitable for creating a copy of the screen list for test purposes.