Vous êtes sur la page 1sur 25

SAP Script

Jul 2012
Sawyer Peng

2006 Hewlett-Packard Development Company, L.P.


The information contained herein is subject to change without notice
Presentation Overview
Duration
60 minutes
Contents
Introduction to SAP Script
Layout Set
Header data
Paragraph and Character Formats
Windows and Text Elements
Pages
Page Windows
Control Commands
Basic Formats used in SAP Script
Standard Texts & Graphics
Copying Scripts across clients
Debugging SAP Script

2 14 June 2017 Innovation Activity Codes


Introduction to SAP Script
SAP scripts is the SAP System's own text-processing system
The looks and feel, is a lot like other leading text-processing systems
It is used to print preformatted text in the preformatted forms
SAP script is tightly integrated into the SAP System
SAP script is client dependent and language dependent
Transaction used for creating and viewing a Script is SE71
Other relevant transactions are,SE76,SE78

3 14 June 2017 Innovation Activity Codes


Layout Set
To output documents using the programming interface, the R/3 application
programs need the so-called layout sets (kind of form)

In SAP script, a layout set describes the layout of individual print pages &
uses text elements to supply definable output blocks, which the print program
can call.


A layout set can be defined as a page design for a document
In
fo
sy
s Usually a SAPscript form consists of the following objects:
Te Header Data
ch
no Paragraph and Character Formats
lo Windows and Text Elements
gi
Pages
es
Li Page Windows
mi
te
d
Layout Set
Header Data
Header data is used for information and control of SAP printing. The header data comprises of 2
parts
Device Independent
Start page Tells the print program which page should be printed first.
Default paragraph Tells the print program, the default paragraph to be selected if no
paragraph is mentioned in text elements.
Language Attributes Displays the original language, current language and the list of
languages into which the form can be translated.

In Tab Stop A grid set to a specified interval in window. This works for paragraphs for which
fo tabs are not specified.
sy
s Device Dependent
Te Page format Specifies format in which the form needs to be printed. E.g. Dina4, US Letter
ch etc. The page format is determined from spool administration table with transaction SPAD.
no
Orientation Depends on the page format selected. E.g.. Landscape and Portrait.
lo
gi Lines per inch
es Characters per inch
Li Font attributes Default font for the form
mi
te
d
Layout Set
Paragraph and Character Formats
Paragraphs are formatted using formats and their corresponding attributes.

Standard paragraph attributes


Left or Right margin - amount of space between paragraph and the left and the right
border of the window.
Indent first line- Indent of the first line of a paragraph. If the value is positive, then it is
indented to the right and if it is negative then it is indented to the left. E.g. -1, 1 etc
Space before & space after Space before and space after controls the amount of
In space between paragraphs.
fo
sy Alignment - Alignment of a paragraph. E.g. CENTER, LEFT, RIGHT and BLOCK
s Line spacing - Spacing between the lines.
Te
ch
no Font attributes To specify font attributes for paragraph formats.
lo Font family Select the font supported by font maintenance.
gi Font size
es
Li Bold / Italic or underlined
mi Continued in next slide
te
d
Layout Set
Paragraph and Character Formats

Tabs
The tab feed in a paragraph is controlled by tab positions. The tab
positions defined can have MM, CM, LN etc as unit of measure.
You can define as many tab positions as you require for each
In
fo
paragraph format. Text can be aligned in different ways.
sy CENTER, LEFT or RIGHT.
s
Te
ch
no Character formats
lo
gi
Character formats allow to format entire blocks of text within a
es paragraph.
Li
mi
te
d
Layout Set
Windows
Windows are individual text areas (header address, date, footer) in a page
To combine the information contained in a document into certain groups & make each
group appear on the printed page in an individual area, such a group known as window.
To refer to windows via programming interface, each window must have a unique name.

Window types
1. MAIN Window

In Window in which the continuous text is printed. This window can extend over many
fo pages. If the text fills one page, the output continues in the window of next and
sy subsequent pages, as long as MAIN has been defined for these pages.
s 2. VAR Window
Te Window with the variable contents. The text content can vary on each page in which
ch the window is positioned. Variable windows are formatted for each page.
no
lo 3. CONST Window
gi Window with constant contents which is formatted only once.
es 4. GRAPH Window - Grid Screen.
Li
mi
te
d
Layout Set
Text Elements
You can define text elements (window texts) for each window. The print
program accesses the text elements by name, then formats them & prints
them in the respective window. The paragraph and the character formats
used must be defined in the form.
Using Boxes, Lines, and Shading
SAP script provides text commands for using boxes (or frames), lines,

In and shading in documents:


fo The BOX command is for drawing a box or a vertical or horizontal line.
sy
s The POSITION command is for specifying the starting point (upper left
Te corner) of a box or line.
ch
no The SIZE command is for specifying the width and height of a box.
lo
gi Syntax for BOX Command
es
Li
mi
te
d
Layout Set
Pages
The individual pages of a document
They must have a unique name. Often have different layouts for individual pages: The
first page of an invoice differs from the subsequent pages, on which you need not repeat
the general information, such as address /customer data.
Attributes
Standard attributes
Next page - You should inform to the system which page is to be used after reaching
end of the 1st page. If this is not specified the text printing stops after first page.

In Print attributes
fo
sy Resource name : You specify that paper for this page should be taken from particular
s paper tray at the printer. Eg TRY01 ( select paper from first tray)
Te Print Mode : You can specify single /double side printing for a page.
ch Page Counter
no
lo Mode Specify the mode in which page numbering needs to be done.
gi 1. INC - Increments by 1
es 2. HOLD Counter remains unchanged
Li
mi 3. START Sets the counter to 1
te Numbering Type The format in which page numbering is to be done.
d ARABIC , ROMAN or LETTER
Layout Set
Page Windows
While defining windows and pages, you do not 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 left upper edge of the output area & also its
width and height.

In FORM Painter
fo
sy - Form Painter is used to design layout of your forms,
s
Te
- To switch to graphical form painter , Go To Menu bar, select
ch settings.
no PC Editor
lo
gi - PC Editor is used to edit and create text in SAP scripts.
es
Li
mi
te
d
Control Commands
The purpose of Control Commands is to allow the control of output formatting. These
Control 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 & character formats specified.
Syntax for control commands
Enter /: in the paragraph format
Enter the command in the text line. The command entered should occupy only one line.

Examples of control command


In
1. NEW-PAGE Explicit page break
fo
sy PROTECT ENDPROTECT - To print complete paragraph in one page.
2.
s INCLUDE - To include the content of another text into the current text
3.
Te
4. PERFORM - To call a subroutine of any ABAP program
ch
no IFENDIF
5.
lo CASE..ENDCASE
6.
gi
7. SET DATE MASK Used to define formatting of date field. In the date Mask you can use DD
es / DDD / DDDD and MM / MMM / MMMM and YY / YYYY.
Li
mi
te
d
Basic Formats used in SAP Script
/: This is a command line. We can call standard texts include,
subroutine and give the conditions using this Format.
/* This is a comment line. It is used to write general comments that
are not executed and displayed while showing the script but are
used to keep track of changes in the Script.
/E This is a Text element. The text element is generally called from

the WRITE_FORM function module in the print program. It is used


In to display a particular part in the script based on some user
fo defined conditions . For example display of line items for the
sy invoice.
s
Te = This is Extended line. It is used in the SAP Script when it is not
ch possible to accommodate the instructions in a single line.
no
lo
gi
es (Continued in next slide)
Li
mi
te
d
Basic Formats used in SAP Script (contd.)

In
fo
sy
s
Te
ch
no Source: Screen Shot from SAP ECC 6.0
lo
gi
es
Li
mi
te
d
FORM Control
The selection of the data for the document is done through print
program.
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

In
fo START_FORM (Optional) Starts a new layout set
sy
s
Te WRITE_FORM (Mandatory) Calls a layout set element
ch
no
lo END_FORM (Optional) Ends the current layout set
gi
es
Li
mi
te
d
Translation for Layout Set
To create layout set in different languages use transaction
SE63.

The complete path from SE63 : Translation Long Texts


SAP Scripts Forms (SE76).

In
fo
sy
Enter Form Name, Source Language and Target
s Language.
Te
ch
no
lo
gi
es
Li
mi
te
d
Standard Texts & Graphics
Graphics are uploaded in format "Baseline TIFF 6.0"
(file extension .tif on PC files)
Graphics & printer macros are uploaded with report RSTXLDMC into
individual standard text documents or through transaction SE78
SAP Script & Standard text elements can be exported or imported
between two systems using RSTXSCRP program

In Standard texts are created using the transaction SO10
fo
sy
Syntax
s for Graphics : The Graphics will be stored with the name
Te
ch
Z_LOGO_AL in SE78 in the example below :
no
lo
gi
es
Li
mi
te
d
Standard Text
Maintaining the standard text in transaction SO10

In
fo
sy
s
Te
Syntax for calling the standard text from the script
ch
no
lo
gi
es
Li Source: Screen Shot from SAP ECC 6.0
mi
te
d
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


In For copying script from one client to another, go to SE71 and use
fo Copy from Client option available under Utilities menu or import the
sy
s
transport request, in which the script is saved, from the original client
Te using the transaction SCC1 (SCC1 is a transaction used to copy
ch transport request, having client dependent objects, from one client to
no another)
lo
gi
es
Li
mi
te
d
Transporting Scripts

Create a customizing transport request using SE01

In the task add an entry with R3TR for Program ID, FORM
for Object Type and Script Name for Object name

In
fo
sy The script is now included in a transport request, which
s
Te can be later used for transporting into other environments
ch
no
lo
gi
es
Li
mi
te
d
Debug SAP Script
You can debug a SAP Script: Use Tools -> Word Processing -> Layout Set.
Enter name of layout set & then Utilities - Activate Debugger.

It is of no consequence that which layout set you enter when selecting the
SAP script debugger. (Menu path: Tools->Word processing -> Forms,
Utilities -> Activate Debugger) The next layout set called will invoke
debugger. This is quite handy when verifying which layout set is being called
(Verifying the customizing settings).
In
fo
sy Another way to set the SAP Script debugger is to run the program
s RSTXDBUG.
Te
ch
no Transaction SE71
lo
gi
es (Screenshot in next slide)
Li
mi
te
d
Debug SAP Script

In
fo
sy
s
Te
ch
no
lo
gi
es
Li
mi Source: Screen Shot from SAP ECC 6.0
te
d
Things to remember while changing SAP Script

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

In the screen and on the printer. So always test the

sy output of the script on the printer.


fo

s
Te
ch
no
lo
gi
es
Li
mi
te
d
Demo
Its demo time Over to R/3

In
fo
sy
s
Te
ch
no
lo
gi
es
Li
mi
te
d

In
fo
sy
s
Te
ch
no
lo
Thank You.
gi
es
Li
mi
te
d

Vous aimerez peut-être aussi