Show TOC

Execute and PrintLocate this document in the navigation structure

The easiest way of printing a list while creating it is for the user to choose Execute and Print on the selection screen of the executable program. 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 and Print on the selection screen of the executable program, the system displays the Print Parameter dialog box before creating the list. The user enters the print parameters. You can use the function module SET_PRINT_PARAMETERS to predefine values for this dialog window.

Consequently, you must program the list in such a way that it can both be displayed and printed. Therefore, do not specify a page width wider than 132 characters using the LINE-SIZE addition and never set any page length using the LINE-COUNT addition of the REPORT statement.

Using Execute and Print, the user can print only the basic list of the executable program. To print detail lists that you create during interactive events on the displayed list, use NEW-PAGEPRINT ON (see Printing from Within the Program ).

Tip

REPORT demo_list_print_1 NO STANDARD PAGEHEADING 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     = '0'            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 and Print. The following dialog box appears:

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 addition, in this case, is needed to reserve space for two footer lines.

After choosing Print in the Print Parameter dialog box, the system displays the Archive Parametersdialog 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 produce 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.