You are on page 1of 8

SAP R/3 Document : SAPScript

SAPScript
There are three components in SAPScript
1. Standard Text
2. Layout Set
3. ABAP/4 program
SAPScript is the Word processing tool of SAP
It has high level of integration with all SAP modules
STANDARD TEXT
A Standard Text is a like our normal documents. In Standard Text, you can
create standard documents like letters, articles etc
Plain documents are classified as Standard Text ( ST ).
You should first create a Style. Goto Tools Word Processing Style
Every style contains Character Strings, Character formatting and paragraph
formatting
To create a Standard Text goto Tools Word Processing Standard Text
Give a Standard Text name, Specify Text Id as ST and Language as E.
Click on Create / Change
Every Standard text is assigned to a style
To assign a style goto Format Style
You can base your documents on these character strings, paragraphs etc.
Character strings have to be created, if you want a sets of strings / words /
paragraphs / documents with different fonts, font sizes, formats ( Bold,
Italic, Underline, Normal etc.) with these properties.
You can create each character strings differently
You can specify default properties for each type of paragraph like you can
define right margin, left margins, line spacing, alignment etc.
These properties can be different for every paragraph in a Standard text

By : Subba Rao

SAP R/3 Document : SAPScript

You can also specify how much space should be left before and after the
paragraph
You can also specify the TAB positions
To move to the next tab position specify ,, (two commas)
In the pull down box against each line you can specify the paragraph type
on which the text in the line is going to be based
You can also display your standard text in hierarchical format by selecting
the OUTLINE option while creating the paragraph
Every paragraph and character string that you create should be saved and
activated
To display the ACII character, enclose the ASCII value of that character in
<... > e.g. <65> would display A
If you want the text in your standard text to appear as per the attributes
specified in the character strings the specify <character string name> text
matter </>
Eg. if the S1 is a character string with Bold attribute and you want HELLO
to appear in bold then you should say <S1>HELLO</>.
This resembles HTML way of writing the code
Every Character String has to be terminated by a </>
You can display texts displayed in different character string formats but
every
character
string
should
be
terminated
by
</>.
E.g.
<S1><S2>HELLO</></>
If you specify a line to be of Raw Line ( ( ) type then the character strings in
that line will not have any effect and they will be treated as normal
characters
If you want a block of text to displayed as a single unit i.e. you dont a part
of the block in one page and some part in another page, then you should
enclose that block of text in between PROTECT.... ENDPROTECT
You can have Text symbols, System symbols and Program symbols in your
standard text.
Symbols are enclosed in &...&
For. If you want to display current date in your Std. Text then you write
&date&. Here &date& is a system symbol. Current time ( &time&, &user&
etc. Are some examples of system symbol).

By : Subba Rao

SAP R/3 Document : SAPScript

You can define Text Symbols by using the system command DEFINE and
specifying command line in the column tag area. You can define a Text
Symbol as follows :
DEFINE &MYSYMBOL& = CSSL : - defines the text symbol
&MYSYMBOL&
: - displays CSSL at runtime.
PROGRAM Symbols are used for communication between different modules
of SAP
Using Program symbols you can fetch the data from the database. You will
mainly use Program symbols in Std. Text when the std. Text has to sent to a
Layout set with data extracted from a database.
You would write Program symbol as follows :
&Tablename-fieldname&
e.g. &TABNA-NAME1& where TABNA is a table name and NAME1 is a field.
Specify command line in the column tag area
But to display the data in the layout set you have to write a ABAP/4
program.
You can refer to online help documentation on SAPScript for more
information on different types of symbols and control commands that can be
use in SAPScript.
You can assign Layout sets to a Standard Text

LAYOUT SETS
A SAPScript FORM consists of the following elements

Windows and Pages


Paragraph formats
Character formats
Creating FORMS in the R/3 system

Every Layout Set will contain a Header, Paragraphs, Character Strings


Character Strings are similar to the one that we create in Styles for
Standard Text
For every Layout Set you have to define Pages, Windows and Page Windows
HEADER contains the General information about the Layout set. As part of
the header
You need to assign / define the default paragraph ( this has to
existing) and the first page ( i.e. the first page in the Layout set) of the
Layout set

By : Subba Rao

SAP R/3 Document : SAPScript

In the initial settings of a layout set as part of the header information,


you can specify page format ( A4, etc. ), Page orientation, Printer, line
spacing, fonts, character spacing etc.
To create different elements in the layout set, click on the buttons on the
application toolbar
PAGES

A FORM / LAYOUTSET can have one or more pages


You can determine the page sequence of a document, by simply entering
which page follows the one you are currently on
You must always enter a starting page in a forms header data
A specific page format is defined for each form
SAPScript allows for automatic page numbering
To create Pages for the layout set click on PAGES button on the
toolbar
To create a new page goto EDIT Create Element
Give a name to the page and a description
In the standard attribute area of the page, you can specify the name
of the next page in sequence it there is one or else you can enter the
same page name in the area
You can specify page counter for page numbering in the page counter
area. By default the numbering type is Arabic
You can create any number of pages

PARAGRAPHS
Click on Paragraphs button on the applications toolbar
To create new paragraphs go to EDIT Create Element
Give a name and description to the paragraph.
You can specify different attributes to like font type, font size,
character style ( i.e. bold / italics / underline ), Tab settings, Bar
codes, margins, alignments etc.
CHARACTER STRINGS
This again is like the ones that you creates for Std. Text

By : Subba Rao

SAP R/3 Document : SAPScript

To create a new character string, click on the Character String button


To create a new Character String go to EDIT Create Element
Give a character string name and a description
In the character strings attribute, you can specify the font types, font
sizes, barcodes, superscript, subscript, hidden, protected etc.

WINDOWS
The various output areas found on a form are called Windows
You can organize texts within your windows using the text elements and
paragraphs
Windows can appear on numerous pages within a single form
Click on Windows button
To create a new window go to EDIT Create Element
Give a name and description for the window
Specify the window type
There are 3 types of windows
MAIN
CONSTANT
VARIABLE
Every layout set can have only one MAIN window. MAIN
window is created by default
MAIN window can flow across pages
CONSTANT windows are use only once per page
You need to specify default of that windows
TEXT ELEMENTS
For every window you may want some text to appear in it.

By : Subba Rao

SAP R/3 Document : SAPScript

Click on the Text Elements button


In the text elements you can enter the text in the editor that
has to be displayed in the window
This editor is like the one that you get for Std. Text
PAGE WINDOWS
Using the PAGE WINDOWS, you can specify the positions and
size of the windows on the pages
A PAGE WINDOW can have different size and position on
different pages
Texts that appear in page windows are defined for an entire
form using that forms corresponding window
Click on PAGE WINDOW button
Select the page on which you would want to place the windows
by double clicking on the page name
In the standard attributes, you have to specify the left margin,
Upper margin, Window height and Window width. This will
determine the position and size of the window on the page
The text for each window can be written in Text Element of the
Window

INCORPORATING GRAPHICAL ELEMENTS


You should have the company logo or any other graphical element that you
want to include in the FORM / LAYOUT SET in a valid graphic file format
like .bmp or .jpg
This .bmp / .jpg file has to first converted into a .TIFF file format using any
software that would do the conversion like a software called PHOTOWORK
To include this graphic in the FORM / LAYOUT SET, define a new window
and incorporate the text element (i.e. the TIFF file) in the new window
After converting to the TIFF format, access the file on the front end
Upload the file as text module using the ABAP/4 report RSTXLDMC

By : Subba Rao

SAP R/3 Document : SAPScript

Execute this program from the ABAP/4 editor


Use RSTXLDMC to save the TIFF file on your front end.
Enter the location of the .TIFF file name on your system
Specify BMON or BCOL as the type of raster image
The system generates a suggested name for the text : ZHEX-MACRO-*. The
asterix (*) denotes the file type. For example ZHEX-MACRO-LOGO.
Use the ID ST and the logon language
This completes the process of converting the .TIFF file into a text element
To incorporate the logo specific text element into the FORM / LAYOUT SET,
enter INLCUDE ZHEX-MACRO-LOGO OBJECT TEXT ID ST in the first line.
11

SAPScript ABAP/4 Interface


You can interface a ABAP/4 program with SAPScript
This is done when you need to get data from the tables into SAPScript
Using this interface you an create Mail Merge documents in SAP
COMPONENTS OF ABAP/4 Program
TABLES statement : here you will declare the table names from which
the data has to brought in
DATA statement : here you declare the variables or internal tables
that you may use
SELECT statement : After declaring the tables and internal tables you
use the SELECT statement to select the required data from the tables
OPEN_FORM function : After selecting the data, you open the layout
set in which you want to display the data. In the OPEN_FORM
function we mention the Layout set name to open.
WRITE_FORM function : Then you display the data in the layout set
using the WRITE_FORM function. Here you specify the ELEMENT
NAME and the window in which you display the data.
CLOSE_FORM function : After displaying / printing the data you
close the form i.e. the layout set, using the CLOSE_FORM function.

By : Subba Rao

SAP R/3 Document : SAPScript

Since you have opened a form you close that form using the
CLOSE_FORM function.

Summary :
A SAPScript Layout set consists of different elements like Pages, Windows,
Page Windows, Character Strings, Paragraphs etc.
You will have to create a layout set in the following order.
Every layout set may consist of at least one Page. It may also contain
number of pages. So you first define a default page.
Every Page should have a default paragraph assigned to it. So after you
create a page assign a paragraph to the page.
The contents of every page have to specify a position on the page. For that
you have create to Windows. Which Windows should appear in what pages
and at which position is user specific.
Every Window is some certain size. So you specify the sizes of the windows
in the Page Window of each Window. This will also determine the position of
the windows.
The contents to be displayed in the Windows are written in Text Elements.
What styles the paragraphs / texts in the page widow should take can be
defined using the Character Strings.

By : Subba Rao