Printing from Within a Program

To start the printing process from within the program while creating a list, use the NEW-PAGE statement with the PRINT ON: addition:

Syntax

NEW-PAGE PRINT ON [NEW-SECTION]
  [PARAMETERS pripar]
  [ARCHIVE PARAMETERS arcpar]
  [NO DIALOG]. 

This statement causes all subsequent output to be placed on a new page and the system interprets any subsequent output statements as print statements.

If you use the NEW-SECTION addition, reset the pagination (sy-pagno system field) to 1. The other additions determine the print parameters (see below).

If the list created by this point is a screen list, it is buffered. Starting from NEW-PAGE PRINT ON, the system no longer creates the list for display but for the spool system.

If the system is already creating a list for the spool system, and the NEW-SECTION addition is not used, no new spool request is created: The specified print parameters only apply for the subsequent spool request.

If a list has already been created for the spool system, and the NEW-SECTION addition is used, there are two possibilities:

  • If the print parameters specified match the parameters of the current list and the print parameter PRNEW equals SPACE, the system does not create a new spool request.

  • If the print parameters specified do not match the parameters of the current list or the print parameter PRNEW is unequal to SPACE, the system closes the current spool request and creates a new spool request.

A statement block started with NEW-PAGE PRINT ON should be finished with the PRINT OFF addition to the NEW-PAGE statement.

Syntax

NEW-PAGE PRINT OFF.

This statement creates a page break and sends the last page to the spool system.

If the preceding list was a screen list, it is retrieved from the buffer and the following output statements are reinserted.

If the preceding list was a print list, a new spool request is created and the following output statements are reinserted into the print list. If print parameters were specified for NEW-PAGE PRINT ON without the NEW-SECTION addition, these parameters apply.

The statement blocks NEW-PAGE PRINT ON - NEW-PAGE PRINT OFF must not be nested and should be completed within a processing block.

Setting the Print Parameters

To determine the print parameters for printed output following the NEW- PAGE PRINT ON statement, use the following additions for this statement.

Enter the print parameters using the PARAMETERS addition instead, and, if required, use the ARCHIVE PARAMETERS addition for archiving. To create the corresponding arguments pripar and arcpar, use the export parameters of the function module GET_PRINT_PARAMETERS. This serves to guarantee that the print parameters are set in their entirety and that the print request is executable. Since the function module GET_PRINT_PARAMETERS has its own user dialog, always use the NO DIALOG addition in the NEW-PAGE PRINT ON statement.