SAP Scripts - Control Print Output

To control the print output of a document, you can pass different parameters with function modules - PRINT_TEXT and OPEN_FORM. PRINT_TEXT function module is used to prepare the text module specified in the parameters HEADER and LINES for an output device and to output it. The output format for print is taken from the fields TDSTYLE and TDFORM in the text header.

You can also use TDPREVIEW field to see the display on the screen in the print format. There are various fields that you can use to control the print output.

TDPAGESLCT SAPscript: Select print page
TDPREVIEW SAPscript: Show print view
TDNOPREV SAPscript: Disable print view
TDNOPRINT SAPscript: Disable printing from within print view
TDTITLE SAPscript: Text for title line in the output selection screen
TDPROGRAM SAPscript: Program name for replacing symbols
TDTEST SAPscript: Test printout
TDIEXIT SAPscript: Return immediately after printing
TDGETOTF SAPscript: Return OTF table, no print output
TDSCRNPOS SAPscript: Display position of OTF on screen
TDDEST Spool: Name of the output device
TDPRINTE Spool: Name of the device type
TDCOPIES Spool: Number of copies
TDNEWID Spool: New request
TDIMMED Spool: Print request immediately
TDDELETE Spool: Delete request after printing
TDLIFETIME Spool: Retention time of the request
TDDATASET Spool: Identification of the request
TDSUFFIX1 Spool: Suffix 1 of the request
TDSUFFIX2 Spool: Suffix 2 of the request
TDARMOD Spool: Archiving mode
TDCOVER Spool: Print cover page
TDCOVTITLE Spool: Cover page: Title text
TDRECEIVER Spool: Cover page: Recipient name
TDDIVISION Spool: Cover page: Division name

Key Function Modules

Following are the key function modules that can be used to control the print output −


This is used to display the output on the screen before you take the printout. This function module always creates a SPOOL request and it is not interpreted in background processing.

  • ‘X’ − Print view wanted

  • ‘ ‘ − No print view wanted


This function module can be used to select the pages to be printed in the print output. You can select individual pages, or a range of pages, or you can also select combinations. When you don’t select the page number field, all pages are printed.

Note that the page numbers here shows the physical pages of the SAPscript printout and not the logical number in the form.

  • 2 − This prints an individual page number 2

  • 1-5 − This prints all the pages 1 to 5, including both the pages

  • 2- − This prints all the pages from page 2 to end

To combine these values, you can put a comma between these to use the combination. 2, 1-5, 2-


This function module is used to select the text for title line of print selection.


This function module is used to determine whether to send a SPOOL request immediately or you want to print it at night.

  • ‘IMM’ − To send the SPOOL request immediately

  • ‘NIG’ − To send request during night

When no value is selected for this field, by default, the system takes it as IMM.