You are on page 1of 41

AB1008 SAPscripts - v1.

India SAP CoE, Slide 1

SAPscripts
1 2

Introduction Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 2

SAPscripts
1 2

Introduction Syntax Description


3

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.

India SAP CoE, Slide 4

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.

India SAP CoE, Slide 5

How SAPscript Works


SAP Document Document Layout set Read Data (Template) Form

Print

(Output)

Sales order Billing document Purchase order etc

Define

SAPscript

Order confirmation Invoice Purchase order etc

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.

India SAP CoE, Slide 6

Components of SAPscript
Output determination configuration

SAP Document Document

Output Program

Layout set

Form

Printer / Font Configuration


Output program:
Layout set: Printer / Font configuration:

Extracts data from SAP data dictionary


Formats the extracted data Configures impact / laser printer, bar code, logo

Output determination configuration: Configures triggering event, timing/destination

India SAP CoE, Slide 7

SAPscripts
1 2

PrepareMe Syntax description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 8

Output Program
Overview
Program retrieves the data to be printed in a Layout set. 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.

India SAP CoE, Slide 9

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 .

India SAP CoE, Slide 10

Syntax Description
CALL FUNCTION OPEN_FORM = ..

EXPORTING
IMPORTING EXCEPTIONS

FORM LANGUAGE DEVICE = .. OPTIONS DIALOG = .. APPLICATION


LANGUAGE ..

= .. = ..
= .. = .. = ..

India SAP CoE, Slide 11

Syntax Description
CALL FUNCTION WRITE_FORM = ..

EXPORTING = ..

ELEMENT
TYPE FUNCTION WINDOW .. = .. = .. = ..

EXCEPTIONS

India SAP CoE, Slide 12

SAPscripts
1 2

PrepareMe Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 13

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

India SAP CoE, Slide 14

SAPscript Transaction Codes


SE71 : Form Painter SE72: Style Maintenance SE78: Graphics Managements S010: Create Standard Text Module

India SAP CoE, Slide 15

Layout Set
Some Facts
Client specific (client-dependent) Language specific 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.

India SAP CoE, Slide 16

Layout Set Elements


Menu: Tools > Word processing > Layout set

Header Paragraphs Character strings Windows Pages

Page windows

IMG
India SAP CoE, Slide 17

Layout Set Elements


Components
S.O. # P.O. # Date Sold-to Ship-to S.O. # P.O. # Date Item Material # Price
40 50 60 70 Total Part Part Part Part D E F G $250 $400 $350 $150 $2,800

Item Material # Price


10 20 30 Part A Part B Part C $500 $350 $800

Header: Paragraphs: Character strings: Windows: Pages: Page windows:

General info and default settings Font and tab info Font info within a paragraph Description of areas on the pages Name of the pages with page flow info Position and size of the windows on the pages

India SAP CoE, Slide 18

Layout Set Elements


Page Windows
List of all the windows on the page with coordinates. The coordinates are given by the upper left-hand corner and the width and length. Note: A window which should appear on a page must first be defined under Windows and then be added to the page windows.

India SAP CoE, Slide 19

Layout Set Elements


Windows
Type of windows: Main - Special VAR - Variable CONST - Constant Shows list of all windows defined for the layout set. A window can contain hardcoded texts and the variables to be printed in the window.

India SAP CoE, Slide 20

Layout Set Elements


Windows - Text element
A window can contain hardcoded texts and the variables to be printed in the window. Tag column: Specifies format of the text Text line column: Contains the actual content of the window. Special characters * Default paragraph /: Command line /* Comment line /E Text element

India SAP CoE, Slide 21

Layout Set Elements


Pages

Shows the page flow information. Must define at least two pages. The first page specifies the next page. The last page recursively defines the next page as
itself.

India SAP CoE, Slide 22

Layout Set Elements


Paragraphs
Contains all information needed to format a paragraph of text Font Tabs

India SAP CoE, Slide 23

Layout Set Elements


Paragraphs

Tabs

Specify tabs to create columns for line items

Font

If no font is specified, default font from the layout set header will be used

India SAP CoE, Slide 24

Layout Set Elements


Character Strings
A default character style is specified at the paragraph level. Can be used within paragraph to override the default settings for a few words within the paragraph.

India SAP CoE, Slide 25

Layout Set Elements


Header
Administrative info Default settings Page format: different for different countries / applications Never change Lines per inch & Characters/inch

India SAP CoE, Slide 26

Layout Set
Test Print

Menu: Utility > Test print 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.

India SAP CoE, Slide 27

Layout Set
Activating Layout Set
Menu: Layout set > Activate Must activate the layout set any time a change has been made

India SAP CoE, Slide 28

Layout Set
Commands
In SAPscript, any text can be included at a certain position in the document using INCLUDE command.
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 There are two different types of text handled in SAPscript. One is APPLICATION TEXT and other one is STANDARD TEXT.

India SAP CoE, Slide 29

Retrieved Data passing to Program


FORM .. ENDFORM is used When retrieved data needs to sent back to print program.

In SAPscript:
PERFORM < routine_name> in <report_name> USING &var1& CHANGING &var2&. ENDPERFORM.

India SAP CoE, Slide 30

Retrieved Data passing to Program


In Report:
FORM < routine_name> in_tab type ITCSY out_tab type ITCSY READ TABLE in_tab WITH KEY NAME = var1. {Data Selection based on above value. It returns ret_value.} READ TABLE out_tab WITH KEY name = var2. out_tab-value = ret_value. MODIFY out_tab. ENDFORM.

India SAP CoE, Slide 31

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. ST /: INCLUDE ZHEX-IBMLOGO-PCL OBJECT TEXT ID

India SAP CoE, Slide 32

Barcode Printing
To print barcode , follow the steps below : Select / Create a barcode font in SAP. Create a character string and include the barcode with it.

The data need to printed as barcode should be attributed via the character string.
e.g. / <BC> * &VBAKA-WERKS& * </>

India SAP CoE, Slide 33

SAPscripts
1 2

Introduction Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 34

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

Data Retrieval Logic

India SAP CoE, Slide 35

SAPscripts
1 2

Introduction Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 36

HelpMe

Additional Info
Some Standard SAPscript Forms

Form Description Sales order confirmation Picking List INVOICE PURCHASE ORDER PRENUMBERED CHECK

Standard Form Name RVORDER01 RVDELNOTE RVINVOICE01 MEDRUCK F110_PRENUM_CHCK

India SAP CoE, Slide 37

SAPscripts - Important Programs

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

India SAP CoE, Slide 38

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& = Current date &DAY& = Day &MONTH& = Month &YEAR& = Year &TIME& = Time of day &HOURS& = Hours &MINUTES& = Minutes &SECONDS& = Seconds &PAGE& = Page &NEXTPAGE& = Page number of next page &SPACE& = Blanks &ULINE& = Underline &VLINE& = Vertical line &NAME_OF_MONTH& = Name of month

India SAP CoE, Slide 39

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&

India SAP CoE, Slide 40

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

To set the current position relatively to the start of the Window.


/: POSITION WINDOW /: POSITION XORIGIN '+5' MM YORIGIN '+10' MM

The position is now 5 MM from the left and 10 MM from the top of the window.

India SAP CoE, Slide 41