SAP Scripts Tutorial: SE71, SE78, SCC1, VF03, SO10
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.
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
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
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.
Enter /: in the paragraph format
- 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
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
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
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.