SAP Scripts Tutorial: SE71, SE78, SCC1, VF03, SO10
โก Smart Summary
SAP Scripts form the text processing system of the SAP System, printing preformatted text into preformatted forms. This page explains the five components, the layout set, control commands, the print program, output types, and the transactions SE71, SE78, SO10, and SCC1.

What is SAP Script?
SAP script is the SAP System’s own text-processing system.It looks and feels a lot like other leading text-processing systems.
It is used to print preformatted text in pre-formatted forms.
Typical documents produced with SAPscript are invoices, purchase orders, delivery notes, and customer letters. The form is designed once in transaction SE71, and an ABAP print program supplies the data at runtime.
Components of SAPScript
SAP Scripts comprises of five main components:
- An editor for entering and editing the lines of a text
- Styles and layout sets for print layout. These are created independent of the individual texts using the corresponding maintenance transactions and are allocated to the texts later
- The composer is a central output module. The SAP script composer is invisible to the outside
- A programming interface that allows you to include SAP script components into your own application programs and to control the output of layout sets from within the programs
- Several database tables for storing texts, styles and layout sets
The diagram above shows how those components fit together. The layout set, shown at its centre, is described next.
Layout Set
To output documents using the programming interface, R/3 application programs need so-called layout sets (a kind of form).In SAP script a layout set describes the layout of the individual print pages and uses text elements to supply definable output blocks, which a print program can call.A layout set can be defined as a page design for a document
Layout set on its own doesn’t contain any data. The selection of data for the document is done through the print program. The print program selects the data from database table and feeds it to the layout set. When the print program is executed the document is printed on the screen, printer.
Usually a SAPScript Layout consists of following components
- Header Data: Header data is used for information and control of SAP printing. The header data comprises of 2 parts – Device Independent – Stores information like Start page , Default paragraph ,Language Attributes etc. And Device Dependent stores information like Page format ,Orientation Lines per inch etc
- Paragraph and Character Formats: Paragraphs are formatted using various attributes. For instance Standard paragraph attributes specify Left or Right margin, Alignment ,Line spacing etc. Font attributes specify Font family ,Font size etc. Character formats allow to format entire blocks of text within a paragraph
- Windows and Text Elements: Windows are individual text areas (header address, date, footer) in a page . It helps combine the information contained in a document into certain groups and make each group appear on the printed page in an individual area.You can define text elements (window texts) for each window. The print program accesses text elements by name, formats them and prints them in the respective window. The paragraph and the character formats used must be defined in the form.
- Pages: They are individual pages of a document and must have a unique name. You will often find different layouts for individual pages: The first page of an invoice differs from the subsequent pages, on which you need not repeat general information, such as address or customer data.
- Page Windows: While defining windows and pages, you do not yet determine the position and spacing of the texts to be output.A page window defines the rectangular output area in the output medium by specifying the left upper edge of the output area and its width and height
Control Commands
The purpose of “control commands” is to allow control of the output formatting.These commands are not interpreted by the SAP script editor, but are passed through to the SAP script Composer for processing. This includes, for example, line and page formatting, the formatting of text according to the paragraph and character formats specified.
Syntax
Enter /: in the paragraph format
Examples
- NEW-PAGE – Explicit page break
- PROTECT ………ENDPROTECT – To print complete paragraph in one page.
- INCLUDE – To include the content of another text into current text
- PERFORM – To call a subroutine of any ABAP program
Print Program
The execution of script is done through an ABAP program, which is referred as Print Program. Each print program should have an ENTRY form , which will be called from customization.
For a standard configuration we can see the form name (script name), print program name and output type in the table TNAPR. The print program uses the Form control functions to call the script.
The print program call either all or some of the form control functions to execute the script
- OPEN_FORM (Mandatory) Opens the layout set output
- CLOSE_FORM (Mandatory) Ends the layout set output
- START_FORM (Optional) Starts a new layout set
- WRITE_FORM (Mandatory) Calls a layout set element
- END_FORM (Optional) Ends the current layout set
How to Create a SAPscript Form in SE71
A working SAPscript output needs a form, a print program, and an assignment in customizing. The steps below build one from an empty form.
- Create the form: In SE71 enter a form name and a language, then choose Create. Fill the header data with the start page, the default paragraph, and the page format.
- Define the paragraph and character formats: Create at least one paragraph format, for example AS for a standard line, because every text element refers to a paragraph format.
- Create the pages: Define a first page, for example FIRST, and set its next page to NEXT so that longer documents continue on a second layout.
- Create the windows and page windows: Define the windows such as HEADER, MAIN, and FOOTER, then place each of them on the page and enter the left upper edge, the width, and the height.
- Write the text elements: Open the text editor of a window and mark each block with /E followed by the element name. The print program calls the element by that name.
- Activate the form and write the print program: Activate the form, then call the form control functions from the ABAP program as shown below.
- Assign the output type: Enter the form name, the print program, and the ENTRY routine in table TNAPR through the output customizing of the application, for example NACE.
CALL FUNCTION 'OPEN_FORM' EXPORTING form = 'Z_INVOICE' language = sy-langu device = 'PRINTER'. * Print the element ITEM_LINE in the window MAIN LOOP AT lt_items INTO ls_item. CALL FUNCTION 'WRITE_FORM' EXPORTING element = 'ITEM_LINE' window = 'MAIN' function = 'SET' type = 'BODY'. ENDLOOP. CALL FUNCTION 'CLOSE_FORM'.
โ ๏ธ Warning: WRITE_FORM only prints the fields that are filled at the moment of the call. Fill the work area before the call, because the form reads the global fields of the print program, not the parameters of the function module.
Output Types
The output type can specify, a printed form that you need for internal use or a form that you want to send to a customer or vendor . The output type can also be an internal electronic mail message that you want to send to staff in another department.
For example “Print out” can be classified as one output type of a billing document, i.e. when this output type is executed the billing document is printed. Similarly “Fax” can be an output type, i.e. when this output type is executed a fax of the billing document is sent
All the output types for any document (e.g. billing document) will be stored in the table NAST.Output types are executed through the program RSNAST00 .
Example : Output type in a billing document-
- Go to VF03
- Enter billing document number and press enter again
- Chose Output under the menu Goto -> Header
- Here Z101 is an output type of a print output
The screenshot shows the output screen of transaction VF03, where the output type Z101 is attached to the billing document.
Standard Texts and Graphics
Standard Texts for your report can be created using transaction SO10
Graphics and printer macros are uploaded with report RSTXLDMC into individual standard text documents or through transaction SE78. Graphics are uploaded in “Baseline TIFF 6.0” format (.tif files on PC)
SAP Script & Standard text elements can exported or imported between two systems using RSTXSCRP program
Copying Scripts Across clients:
SAP Script is a client dependent object.Unlike programs, changes done to SAP script in one client will not be reflected in other clients. For copying script from one client to another, go to SE71 and use “Copy from Client” option available under Utilities menu or import the transport request, in which the script is saved, from the original client using the transaction SCC1 .
Important Points to Note
- SAP script does not maintain any versions. So when modifying the SAP script , ensure that the changes are well documented in script. This applies to the standard texts too.
- The output of the form will differ when viewed on the screen and on the printer. So always test the output of the script on the printer.
SAPscript vs Smart Forms
SAPscript is the older of the two form technologies in SAP, and every new form is normally built with Smart Forms. The table below shows why.
| Criteria | SAPscript | Smart Forms |
|---|---|---|
| Transaction | SE71 | SMARTFORMS |
| Client dependency | Client dependent, copied with SCC1 | Client independent |
| Main window | Exactly one main window is required | Not mandatory, and several main windows are allowed |
| Program logic | Written in the separate print program | Partly built into the form, which generates its own function module |
| Output formats | Print, fax, and mail | Print, fax, mail, and XML or HTML output |
| Version management | None, so changes must be documented manually | Available through the workbench |
SAPscript remains widely used, because many standard SAP forms and their print programs still rely on it, and because a client dependent form can be adapted per client.


