You are on page 1of 34

SAP SCRIPTS

02-Sep-09 Kaavian
Systems
Purpose

What is SAP script ?

 Sap script is used to print forms.


 Scripts are client dependent.

 Sap script has two parts: one print program and another layout
set.

 Print program is written in SE38 transaction.

 While for Layout set is written in SE71.

02-Sep-09 Kaavian 2
Systems
Components

Components

 Editor

 Form Layouts and Styles

 Composer

 Print Program (Driver)

 Database

02-Sep-09 Kaavian 3
Systems
Components
Components
Involved

02-Sep-09 Kaavian 4
Systems
Process of Script
Process

Printer

FAX

E-Mail

On Screen

02-Sep-09 Kaavian 5
Systems
FORM Management

FORM Management Tools

 FORM Painter
A graphical tool to manage form Design and layout set
(SE71)

 PC editor
A text based tool to manage business contents (SO10)

02-Sep-09 Kaavian 6
Systems
Components of FORM

FORM Component

 Header

 Paragraph format

 Character format

 Page layout

 Documentation

02-Sep-09 Kaavian 7
Systems
Header details

Header :
Consists of Administrative
Data and Basic Settings.

Administrative Data :

Displays the name of the


form, its description, form class and
the status.

02-Sep-09 Kaavian 8
Systems
Header details

Header
Basic Settings :

Default settings for


the entire document is given
here. It consists of page size,
orientation, font, print attributes
(Lines per inch, and characters
per inch) default font to be used
etc.

02-Sep-09 Kaavian 9
Systems
Format details

Paragraph Format :

Used to define several


paragraph formats to be used
with Texts in Forms. Some of the
Attributes are Margins,
alignment, Font Name & Size,
Tab settings and Outline

definitions.

02-Sep-09 Kaavian 1
Systems 0
Paragraph Format

02-Sep-09 Kaavian 1
Systems 1
Character Details

Character format:
To define formats to words and characters such as Bold,
Italic, Underlined, Barcode format, Font Name and Size etc.

02-Sep-09 Kaavian 1
Systems 2
Layout

Page layout
 Page size is defined in the Basic Settings of Header.

 Using Graphical Editor, placing and sizing windows on form is


simplified with mouse clicks and drag & drop.

 We can define several pages with minimum of one page.

 Different pages can have different layouts.

02-Sep-09 Kaavian 1
Systems 3
Types of windows

There are three type of windows

 Main window

 Variable window

 Constant window

02-Sep-09 Kaavian 1
Systems 4
Windows

Constant Windows HEADER WINDOW


LOGO Company Name & Details

Recipient Information
Address Variable Windows

MAIN
WINDOW
MAIN Variable
Main Windows
Windows
WINDOW

FOOTER WINDOW Variable Windows FOOTER WINDOW

02-Sep-09 Kaavian 1
Systems 5
Components of script

Documentation
 Store Technical Details relating to the Script.

 Detailed Help regarding the Variables used (text elements, program


symbols etc), Logical Flow, Description about Various Windows etc to be
provided.

 If copy of standard forms are modified, make sure that the changes
are properly documented.

02-Sep-09 Kaavian 1
Systems 6
Editor in script
PC Editor

PC Editor can be invoked using


Transaction SO10.

The Graphical Editor displayed


can be changed to Line Editor using
the menu path GOTO -> Change
Editor.

You can Enter the Text


Elements, Symbols etc.

02-Sep-09 Kaavian 1
Systems 7
Text Elements

Text elements

 Text elements are defined for each window.

 They are accessed using their name by a print program, formatted,


and output in the respective window.

 The /E in the tag column is used to identify the text as a text element

02-Sep-09 Kaavian 1
Systems 8
Types of Symbols
Symbols
These are Placeholders which represents data, replaced
with their output values.

System symbol
SAPScript supplies values for the system symbols
ex : date, time etc

Program symbol
Data is supplied by the program

Standard symbol
values are defined in the TTDTG table

Text symbol
values From control commands in text editor
02-Sep-09
Types of Symbols

System Symbols

 Sap script supplies values for System symbols.


 Fixed name for system symbols.

Examples
&DATE&
&ULINE&
&TIME&

02-Sep-09 Kaavian 2
Systems 0
Types of Symbols

Program Symbols

 SAP Scripts cannot directly retrieve data from DB tables – calls


another program to do this.

 Values fed to SAP Scripts using data areas.

 Program symbol value limited to 255 chars

02-Sep-09 Kaavian 2
Systems 1
Types of Symbols

Standard Symbols
 Standard symbols are defined in the TTDTG table

 This table is delivered complete with standard entries supplied by SAP

Text Symbols

 You define the value of a text symbol yourself in the text module

 Use the control command DEFINE

02-Sep-09 Kaavian 2
Systems 2
Commands in Scripts
How to Define Commands ?
Following tags are used in Editor to designate the commands
Tag Meaning
/E - Element Name
/: - Command Line
= - Extended Line
/ - Line Feed
/= - Line feed with Extended Line
* - Default Paragraph
/* - Comment Line
along with other paragraph formats defined.

02-Sep-09 Kaavian 2
Systems 3
Commands in Scripts
SAP Script Commands SAPscript Description
Commands
SAPscript Description
commands Perform, Call ABAP subroutines
Endperform
Address, Formatting of address
Endaddress Insert print control
Print-control character
Bottom, Define footer text in
Endbottom window Protect,
Endprotect Protect from page break
Box, Position, Boxes, Lines and
Size Shading Reset Initialize outline
paragraph
Case, Endcase Case distinction
Set country Country-specific
Value assignment to text formatting
Define symbols Set date Formatting of date fields
mask
Hex, Endhex Hexadecimal values
Set sign Position + / - sign
If, Endif Conditional text output Set time
mask Formatting of time fields
Include Include other texts
Style Change style
New-page Explicit form feed Summing Summing variables
New-window New window main Top Set header text in main
window

02-Sep-09
Commands in Scripts
SAPscript Command : Address … ENDAddress
The command formats an address according to the postal
standards of the destination country defined in the parameter
COUNTRY. The reference fields are described in the structure
ADRS. Both constants and symbols can be assigned to the
parameters.

/: ADDRESS [DELIVERY][PARAGRAPH P][PRIORITY PR][LINES L ]


/: TITLE <title>
/: NAME name1 [,name3[,name3]]
/: STREET street
/: POSTBOX PO Box [CODE zipcode]
/: POSTCODE zipcode
/: CITY town1[,town2]
/: REGION region
/: COUNTRY country
/: FROMCOUNTRY from country
/:ENDADDRESS
02-Sep-09
Commands in Scripts
SAPScript Command

BOXES, LINES, SHADING : BOX, POSITION, SIZE

The BOX, POSITION and SIZE commands for drawing boxes,


lines and shadowing can be used for specifying that within a layout set
particular windows or passages of text within a window are to be
output in a frame or with shadowing.

Syntax
1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME]
[INTENSITY]
2. /: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
3. /: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]

02-Sep-09
Commands in Scripts

SAP Script Command

SET DATE /: Set date mask= ‘date mask’


SET TIME /: Set Time mask = ‘HH:MM’

HEADER TEXT /:TOP


..
/:ENDTOP
FOOTER TEXT /:BOTTOM
..
/:ENDBOTTOM
PROTECT /: PROTECT
..
/: ENDPROTECT

02-Sep-09 Kaavian 2
Systems 7
Structure of Scripts

The Structure of a Print Program

program rstxexp1.
Retrieves data tables: scustom, sbook, ...
select * from ...
...
Opens layout set call function 'OPEN_FORM'
printing exporting form = ...
... Changes to
call function 'START_FORM' ... another layout set
...
call function 'WRITE_FORM' Prints output on the
exporting element = ... layout set
window = ...
...
call function 'END_FORM' ...
...
call function 'START_FORM' ...
...
call function 'END_FORM' ...
Closes layout set ... R

printing call function 'CLOSE_FORM' ...

 SAP AG

02-Sep-09 Kaavian 2
Systems 8
Function modules for Scripts
Form Functions

Open_form - Opens form printing.

Close_form - Closes form printing.

Write_form - Prints text elements in layout set window.

Write_form_lines - Prints text lines from table into specified form window.

Start_form - To combine several different forms into one print


output

End_form - Ends the currently open form and Executes the required
termination processing

02-Sep-09
Function modules for Scripts

Beginning and End of Layout Set Printing

CALL FUNCTION ’OPEN_FORM’


EXPORTING
FORM = ...
LANGUAGE = ...
DEVICE = ...
OPTIONS = ...
DIALOG = ...
IMPORTING
LANGUAGE = ...
EXCEPTIONS ... = ...

CALL FUNCTION ’CLOSE_FORM’


IMPORTING
RESULT = ...
EXCEPTIONS ... = ...
R

 SAP AG

02-Sep-09 Kaavian 3
Systems 0
Function modules for Scripts

Outputting More than One Layout Set


Using a Single Spool Request
CALL FUNCTION ’START_FORM’
EXPORTING
FORM = ...
LANGUAGE = ...
STARTPAGE = ...
IMPORTING
LANGUAGE = ...
EXCEPTIONS ... = ...

CALL FUNCTION ’END_FORM’


IMPORTING
RESULT = ...
EXCEPTIONS ... = ...

 SAP AG

02-Sep-09 Kaavian 3
Systems 1
Function modules for Scripts
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT =
WINDOW =
FUNCTION =
TYPE =
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT =
FUNCTION =
TYPE =
UNOPENED =
UNSTARTED =
WINDOW =

02-Sep-09 Kaavian 3
Systems 2
Standard SAP Scripts

Some of the Standard SAPScript Forms

Form Description Standard Form Name

Sales Order Confirmation RVORDER01

Packing List RVDELNOTE

Invoice RVINVOICE01

Purchase Order MEDRUCK

Prenumbered Check F110_PRENUM_CHCK

02-Sep-09 Kaavian 3
Systems 3
THANK YOU

02-Sep-09 Kaavian
Systems

You might also like