Entering content frameProcedure documentation Execute and Print Locate the document in its SAP Library structure

The easiest way of printing a list while creating it, is for the user to choose Execute + print on the report's selection screen. The user can choose between displaying the list on the screen (choosing Execute) or printing it directly without displaying it (choosing Execute + print).

If the user chooses Execute + print on the selection screen of the report, the system displays the Print List Output dialog window before creating the list. The user enters the print parameters. The function module SET_PRINT_PARAMETERS allows you to set default values for the dialog box. For further information, refer to Print Parameters - Setting Default Values.

Consequently, you must program the list in such a way that it can both be displayed and printed. Therefore, in the REPORT statement, do not specify the page width wider than 132 characters (LINE-SIZE option) and do not set the page length (LINE-COUNT option) at all.

Using Execute + print, the user can print only the basic list of the report. To print secondary lists that you create during interactive events on the displayed list, use NEW-PAGE PRINT ON (see Printing from Within the Program).

Example

REPORT SAPMZTST NO STANDARD PAGE HEADING LINE-COUNT 0(2).

PARAMETERS P TYPE I.

INITIALIZATION.

  CALL FUNCTION 'SET_PRINT_PARAMETERS'
       EXPORTING
            ARCHIVE_MODE   = '3'
            COPIES         = '5'
            DEPARTMENT     = 'BASIS'
            DESTINATION    = 'LT50'
            EXPIRATION     = ' '
            IMMEDIATELY    = 'X'
            LAYOUT         = 'X_65_132'
            LINE_COUNT     = 54
            LINE_SIZE      = 20
            LIST_NAME      = 'Test'
            LIST_TEXT      = 'Test for User''s Guide'
            NEW_LIST_ID    = 'X'
            RECEIVER       = 'KELLERH'
            RELEASE        = ' '
            SAP_COVER_PAGE = 'X'.

START-OF-SELECTION.

  DO P TIMES.
    WRITE / SY-INDEX.
  ENDDO.

TOP-OF-PAGE.

  WRITE: 'Page', SY-PAGNO.
  ULINE.

END-OF-PAGE.
  ULINE.
  WRITE: 'End of', SY-PAGNO.

After executing this program, the user can enter a value for parameter P on the selection screen (for example 100) and choose Execute + print. The following dialog box appears:

This graphic is explained in the accompanying text

The function module SET_PRINT_PARAMETERS fills the input fields with the default values. Because of the function module, the Lines field is ready for input, even though the LINE-COUNT addition is used in the REPORT statement. The option, in this case, is needed to reserve space for two footer lines.

After choosing Print on the Print List Output dialog window, the system displays the Archive Parameters dialog box, since the import parameter ARCHIV_MODE sets the archiving mode to Print and archive.

If the user enters 100 for the parameter P on the selection screen, the system creates an SAP cover page and two print pages that look like this.

First page:

Page 1
--------------------
1
2
3

   .....

        49
50
--------------------
End of 1

Second page:

Page 2
--------------------
58
59
60

   .....

        99
100
--------------------
End of 2

On each page, you can output up to 54 lines, including page header and footer lines. Note that the system triggers page breaks and creates page headers and footers exactly as described in Creating Complex Lists.

If the user chooses Execute on the selection screen instead of Execute + print, the system displays the list as one page and without page footer on the output screen.

 

 

 

 

 

Leaving content frame