Sapscript
Sapscript
Sapscript
SAPscripts
1 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 2
SAPscripts
1 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 3
Purpose
SAPscript is a template that simplifies the process of designing business forms. You need SAPscript forms to print, distribute or display business forms.
Use
Forms are defined and formatted using layout sets. SAP documents are printed using forms. SAPscript is a tool that SAP provides for creating layout sets.
(Output)
Define
SAPscript
SAP documents are printed using forms. Forms are defined and formatted using layout sets. SAPscript is a tool that SAP provides for creating layout sets.
Components of SAPscript
Output determination configuration
Output Program
Layout set
Form
SAPscripts
1 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 8
Print Program
Overview
Print Program Overview: Get the required data from the database. Call function modules : OPEN_FORM (to initialize the print output of the form), WRITE_FORM (to output the general text and data in the main window) CLOSE_FORM (ends the printing of the form)
Note: For each printout of a form, you must use the pair of function modules OPEN_FORM and CLOSE_FORM. You can also use a print program to print several forms, which you can either maintain in separate spool requests or combine into one. In the latter case, you must use the function modules START_FORM and END_FORM.
Structure of Programs Stand alone Transaction Triggered Communication in between program and layout set is done via execution of function calls and communication structures. Execution sequence of function calls A layout set must be opened before being able to output data. Data can be transfer as often as required. At end layout set has to be closed.
Syntax Description
General Function calls: CALL FUNCTION OPEN_FORM . CALL FUNCTION WRITE_FORM . CALL FUNCTION CLOSE_FORM . CALL FUNCTION CONTROL_FORM . CALL FUNCTION READ_TEXT .
Syntax Description
CALL FUNCTION OPEN_FORM = ..
EXPORTING
IMPORTING EXCEPTIONS
= .. = ..
= .. = .. = ..
Syntax Description
CALL FUNCTION WRITE_FORM
EXPORTING
ELEMENT TYPE FUNCTION WINDOW .. = .. = .. = .. = ..
EXCEPTIONS
SAPscripts
1 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 14
Demonstration
SAPscript Development
Component Output program Layout set Resource ABAP resource ABAP resource
Output determination Functional resource configuration Printer configuration Basis / ABAP (Impact, Thermal, Laser) Font configuraiton Basis / ABAP Testing End-user / Functional / ABAP resrouce
Layout Set
Some Facts
Client specific (client-dependent) Language specific While creating SAP Script it is necessary to specify a language. Note: If the layout set is not available in the client in which the document is being printed, then the SAPscript checks for the style or layout set in client 000. Recommendation: Keep only one copy of the layout set in one client.
Header
Pages Windows Page windows Paragraphs formats Character formats
Documentation
Header: Pages: Windows: Page windows: Paragraphs formats: Character formats: Documentation:
General info and default settings Name of the pages with page flow info Description of areas on the pages Position and size of the windows on the pages Font and tab info Font info within a paragraph Gives the documentation of the form
This tab gives all the administrative information like Form Name, Description, Package, Date of creation and change and language attributes.
Layout Set
Test Print
Menu: Utilities > Printing test Shows the layout design of the layout set. Test printing does not trigger the output program to interface with the layout set. It simply shows the maximum length of each of the fields being printed.
Layout Set
Activating Layout Set
Menu: Form > Activate Must activate the layout set any time a change has been made
Layout Set
Commands
In SAPscript, any text can be included at a certain position in the document. The text is defined as standard text using transaction SO10. This text is displayed in the document using INCLUDE command as follows.
Syntax : INCLUDE name OBJECT object ID identifier PARAGRAPH paragraph LANGUAGE language. Example : INCLUDE &VBDPL-TDNAME& OBJECT VBBP ID 0001 PARAGRAPH IT INCLUDE SD_TEXT OBJECT TEXT ID SDVD PARAGRAPH HT
Translation
Forms and styles are language - specific. That is, the definitions and texts in a form or style are defined for a particular language. The language in which a form or style is created is its "original language."
Forms and styles can be translated using the standard SAP translation tools ( Transaction SE63 ).
Goto transaction SE63, select the menu path: Translation ABAP Objects Other Long Texts .
Select SAP Smart Forms option from the list. Give the name of text module and select the source and target languages for the translation and edit.
In SAPscript:
PERFORM < routine_name> in <report_name> USING &var1& CHANGING &var2&. ENDPERFORM.
Logo Printing
To print a Logo, follow the steps below :
Built a Logo. This file can be a bit map or windows meta file. Convert the Logo to a TIFF ( extension TIF ) file. Use program RSTXLDMC to convert the TIF file to a standard text. Print this standard text via SAPscript INCLUDE command.
e.g. /: INCLUDE ZHEX-IBMLOGO-PCL OBJECT TEXT ID ST
Barcode Printing
To print barcode , follow the steps below :
Select / Create a barcode in SAP using transaction SE73. Create a character format and include the barcode with it. The data need to printed as barcode should be attributed via the character format. e.g. / <BC>&VBAK-WERKS&</>
Execution methods
Direct call
A script is called in a custom report program which is executed through a transaction code assigned to it.
Dynamic call
The configuration need to be done for this. The basic configuration required to do for script is creating output type and attaching the script to the output type. - NACE is the transaction to set the output type. - In this transaction first the application is selected ( e.g.V1 Sales, V2 Shipping etc) - Then output type is selected. Sometimes output type is created newly. - Whenever new output type is created , 3 parameters are required. They are :
Script Name Driver Program Name ENTRY routine name.
SAPscripts
1 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 42
Exercises
Let us design one SAPscript for Billing Document.. The layout specifications and data retrieval logic has been explained in these word documents.
Layout Specification
SAPscripts
1 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 44
HelpMe
Additional Info
Some Standard SAPscript Forms
Form Description Sales order confirmation Picking List INVOICE PURCHASE ORDER PRENUMBERED CHECK
RSTXPDFT4 : to convert your SAPscripts spools into a PDF format. RSTXSCRP : Import/Export SAPscript form from PC file RSTXLDMC : To convert TIF file to Standard text
Layout Set
Symbol
SYSTEM symbols are supplied by SAPscripts. They can be used in all texts. Following are list of frequently used system symbols.
&DATE& &DAY& &MONTH& &YEAR& &TIME& &HOURS& &MINUTES& &SECONDS& &PAGE& &NEXTPAGE& &SPACE& &ULINE& &VLINE& &NAME_OF_MONTH& = Current date = Day = Month = Year = Time of day = Hours = Minutes = Seconds = Page = Page number of next page = Blanks = Underline = Vertical line = Name of month
Layout Set
Symbol
FORMATTING of the symbol can be done in following different ways:
&SYMBOL+ 4& &SYMBOL(5)& &SYMBOL(I)& &SYMBOL(Z)& &SYMBOL(C)& &SYMBOL(R)& &SYMBOL(S)& &SYMBOL(5,2)& &SYMBOL(E3)& &text1SYMBOLtext2& = Off set = Length = If the symbol is initial, output nothing = Suppress leading zeros = Compress blanks = Right-justified output = Suppress +/- sign = Decimal place formatting = Exponential notation = Concatenation of symbol and text
Examples :
&VBDPR-MATNR+2(4)& &VBDKL-BRGEW(I13)& &Currency : VBDKA-WAERK& &Case # &PREFIX&VBDPR-BSTNK+2(8)00&
SAPscripts Boxes/Lines/Shading
Drawing a box
/: BOX XPOS '11.21' MM YPOS '5.31' MM HEIGHT '10' MM WIDTH '20' MM INTENSITY 10 FRAME 0 TW OR /: POSITION XORIGIN '11.21' YORIGIN '5.31' MM /: SIZE HEIGHT '2' MM WIDTH '76' MM /: BOX FRAME 10 TW INTENSITY 10
The position is now 5 MM from the left and 10 MM from the top of the window.