SAP Scripts - 1
What is SAP Script?
• SAP Script is used to print forms.
• Form Vs. Reports
• Forms look “nicer”.
• Forms can have graphic elements.
• Forms can be event-triggered.
• SAP Script has two parts: one print program and another
layout set.
• Print Program is written in SE38 transaction.
• While for layout set SE71 Transaction is used.
How SAP Script Works?
Layout set Form
SAP
Document Template (Output)
Print
Read Data
Define
SAP Script
•SAP Documents are printed using forms.
•Forms are defined and formatted using layout sets.
•SAP script is a tool that SAP provides for creating layout sets.
Creating Report Vs. Form
Creating Reports
Output
Program(ABAP) Report
Sap Document
Creating Forms
Output
Program(ABAP)
Layout set
Form
Sap Document
Components of SAP Script
Output determination configuration
SAP Document Output Layout set Form
Program
Printer/Font Configuration
• Output program: Extracts data from SAP data
dictionary
• Layout set: Formats the extracted data
•Output determination configuration: Configures triggering event,
timing/destination
•Printer/ Font configuration: Configures impact/laser printer, bar
code, logo
SAP Script Development
Component Resource
Output Program ABAP resource
Layout set ABAP resource
Output determination Functional resource
configuration
Printer configuration Basis/ABAP
(Impact,Thermal,Laser)
Font configuration Basis/ABAP
Testing End-user/Functional/ABAP resource.
Layout Set elements
Initial Screen(SE71 Transaction)
• Header
• Paragraphs
• Character strings
• Windows
• Pages
• Page windows.
Layout Set Elements Components
S.O#
S.O#
P.O#
P.O#
Date
Date
Ship-to
Sold-to
Item Material# Price
40 Part D $250
50 Part E $400
Item Material# Price
60 Part F $350
10 Part A $500
70 Part G $150
20 Part B $350
Total $2,800
30 Part C $800
Header : General info AND default settings
Paragraph : Font and tab info
Character strings : Font info within a paragraph
Windows : Description of areas on the pages.
Pages : Name of the pages with page flow info
Page windows : Position and size of the windows on the pages
Structuring Pages Using Windows
Pages
W indows
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 be first
defined under” Windows” and then
be added to the page windows.
Layout Set Elements
Windows
• Types of windows:
- Main-Special
-VAR –Variable
-CONST-Constant
• Shows list of all windows defined
for the layout set.
• A window can contain hard-coded
texts and the Variables to be
printed in the window.
Structuring Pages Using Windows
Template Form: Windows
Fly & Smile 07/15/98
4 Truckee Way
Durango, CO 85650
Turnaround Inc.
145 Apple Valley Ln.
Ithaca, NY 14850
Dear Sir or Madam,
Thank you for your booking. We
are pleased to confirm the
following flights:
Flight Date Depart Price
AA 0017 07/20/98 13:15 799.00 USD
AZ 0790 11/11/98 6:55 1644.00 USD
LH 0400 07/21/98 6:07 387.80 USD
LH 0400 07/28/98 6:07 398.80 USD
Page 1
Windows and Page Windows
W indows Form: Page windows
Date
Sender
Adressee
W indow with
body text
Page 2
Page 1
Footer
Window Types
W indow s
D ate
Sender
Ad ressee W indow type: V AR
W indow w ith W indow type: M AIN
bod y text
Footer W indow type: V AR
Main Window
Flight Date Depart Price
Fly & Smile 7/15/98 -----------------------------------
4 Truckee Way LH 0400 07/28/98 6:07 398.80 USD
Durango, CO 85650 LH 0003 08/16/98 15:06 990.00 USD
Turnaround Inc. Yours faithfully
145 Apple Valley Ln. ...
Ithaca, NY 14850
Dear Sir or Madam,
Thank you for your booking. We are
pleased to confirm the following
flights:
Flight Date Depart Price
AA 0017 07/20/98 13:15 799.00 USD
AZ 0790 11/11/98 6:55 1644.00 USD
AA 2017 12/21/98 21:55 799.00 USD
LH 0400 12/28/98 6:07 398.80 USD
Page 2
Page 1
Layout Set Elements
Windows-Text element
• A window can contain hard-coded
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
Layout set Elements
Windows-Text element
• Text Element always starts with
the line /E and continues to the
next text element (/E).
• It is the output program ( not the
layout set) that controls whether or
not to print a text element (i.e.
block of texts surrounded by /E)
and the order in which they are
printed.
• ‘,,’ Tabs in a paragraph
• ‘&&’ Variables.
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.
Pages: Attributes
A ttrib u te s P a ge
P a ge FIR S T
P age attributes
D e s c rip tio n A d d re s s p a g e NNUUMMBBEERRIN
INGG TTYYP P ES
ES
Page Page 1 AARRAABBIC
Next page NEXT IC A ra b ic n u m era
A ra b ic n u m e rals
ls
D e s c rip tio n A d d re s s P a ge CCHHAR
AR Fix
F ixeedd ccha
harac
racte
terr
P a g e c o u n te r LE
Next page Page 2 L ETTT
TEERR Lette
L e tters
rs
M RROOMMAANN RRoom m aann nnuummeera
rals
ls
Po adgee c ou n te r
Mitia
In o d lize
e c o u n te r
In c re as e ccoouunnteter r
In itia lize
KIn
e ecprecaso uencte
o ru n te rh a n ge d
unc FFoorr eexxaam
N o n -c h a n g in g c ou n te r mpple le::
O
O
O u tp
utp
Ouutpu u
u tt le
le
tp utt le n
n g th
gth
lennggthth->4->
4
N u m b e rin g
N um b e rin g ->PPPaag
age
ge e11:1
: : 00
-> P a g e 1 : 0 00 100
0 00
00 11 1
NNuummbberin
e rin ggtyp typee
OOuutp
tpuut tlelenng
g th PPaappeerr tra
th trayy cchhooic
icee
UUppppeerc
r as ee
c as
P rinPtrin
a ttrib ute us te s OOnnee -s
-side
id edd oorr ddoouubble
le -s
-side
idedd
t a ttrib
R e s o u rce n a m e pprin
rintin
tingg dde
e fa
fauultlt
R e s o u rce n a m e SS SSim
impple lexx m
moodede
P rin t m o de DD DDuupple x m o d e
P rin t m o d e le x m o de
TT TTuum
m bble le mmoode
de
Forms - Pages
Page
Page format
Page format
format Static
Static page
Static page
page sequence
sequence
sequence
Page 1 Page 2
DIN A4 LETTER
Next
page
Horizontal
DIN A5 Next page
Defining Page Windows
Top edge
Left edge
Height
Page window
W idth
Page
Layout Set Elements Paragraphs
• Contains all information needed to
format a paragraph of text
• Font
• Tabs.
Layout Set Elements Paragraphs
• Specifies tabs to create columns for line items
Paragraph Formats: Standard Attributes
Alignm
Alignment:
ent:
Standard attributes BLOCK
BLOCK justified
justified
CENTER
CENTER centered
centered
Paragraph HD Description Header 1 LEFT
LEFT aligned
aligned left
left
RIGHT
RIGHT aligned right
aligned right
Left m argin 1.00 CM Alignm ent LEFT
Right m argin 1.50 CM Line spacing 1.00 LN
Indent 1st line 2.00 CM No blank lines Units
Units of
of
Space before 1.50 CM Page protection m
m easurement:
easurem ent:
Space after LN
LN Lines
Lines
Next paragraph sam e page
CM
CM Centim
Centimeters
eters
MM
MM Millim eters
Millim eters
Right m argin IN
IN Inches
Inches
Left m argin PT
PT Points
Points
TW
TW Tw
Twips
ips
Space after
Space before
Indentation
W indow
Layout Set Elements
Paragraphs
• If no font is specified, default font from the layout set set header
will be used.
Elements for Structuring Texts
Fly & Smile 07/15/98
4 Truckee Way
Durango, CO 85650
Turnaround Inc.
145 Apple Valley Ln.
Ithaca, NY 14850
Type
Dear Sir or Madam,
Thank you for your booking. We are pleased to
confirm the following flights:
Flight Date Depart Price Paragraphs
AA 0017 07/20/98 13:15 799.00 USD
AZ 0790 11/11/98 6:55 1644.00 USD
Yours faithfully
...
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.
Character Formats: Standard Attributes
Standardattributes
String BF Description Boldface
On Off Retain AAdopt
doptheader
header
Protected data
dataor
orparagraph
paragraph
Hidden form
format
atsettings
settings
Marker
Superscript
Barcode Subscript
Sym
Symbolicnam
bolicnameof
eofaa
barcodefrom OOverride
verrideheader
header
barcodefromSA SAPscript
Pscript data
font
fontm
maintenance
aintenance dataor
orparagraph
paragraph
form
format
atsettings
settings
Layout Set Elements
Header
• Administrative info
• Default settings
• Page format: different for different
countries/applications
• Never change ‘Lines per inch’&
‘character/inch’
Graphical Form Painter: Page Layout
Form ...
P age
W IN D O W 1*
FIR S T Address page
W IN D O W 2*
W indow G raphic
W indow AD D R E S S
D escription Address
M ain w indow Ad m inistrative w indow M AIN * D esign w indow
D efault paragraph
Left m argin 1,60 CM
U pper m argin 1,60 CM
W indow w idth 9,00 CM
W indow height 6,00 CM
D esign / T ext O ptions
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.
Layout Set
Activating Layout set
• Must activate the layout set any
time a change has been made.