Professional Documents
Culture Documents
Objectives
Text Elements
Text element always start with
the line /E and continue to the
next text element (/E). It is
shown in red in the SAPScript
editor.
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.
To hard code text in SAPScripts, the texts to be displayed are written into the line
of the editor. If the text to be displayed is continuous, use the ‘=‘ tag in the
paragraph tag column.
To output SAP field values and variables, the field names and the variable names
must be written with ampersands. For e.g. &KNA1-KUNNR& .
To use the tabs that have been defined in the paragraph formats the fields must
have two commas per tab written between them. For e.g. &KNA1-
KUNNR&,,&KNA1-NAME1&.
If there is a character format B which represents bold text , the format of using
this is <B>any text </>. The character wrapper has two parts to it( <B> and </>)
and both should be coded to make it work.
Symbols
Symbols (Contd.)
SYSTEM symbols are supplied by SAPScripts. They can be used in all texts.
Following is a list of frequently used system symbols.
&DATE& = Current date, like ABAP field SY-DATUM
&DAY& = Day
&MONTH& = Month
&YEAR& = Year
&TIME& = Time of day , like ABAP field SY-UZEIT
&HOURS& = Hours
&MINUTES& = Minutes
&SECONDS& = Seconds
Symbols (Contd.)
Symbols (Contd.)
PROGRAM symbols are placeholders for values which come from the program
that calls the SAPScript form. The symbol has to be defined in the Data
Dictionary and filled with values by the output program.
Example:
&KNA1-NAME1&
in the layout set this will output the Customer’s name.
STANDARD symbol are maintained centrally in one table (TTDTG) for all
SAPScript users.
Symbols (Contd.)
Commands
IF..ELSE..ENDIF can be used within the layout set to control the flow of logic. It is
same as the corresponding ABAP command but with only one difference that no
full stops are used here.
Example :
/: IF &VBRK-VKORG(2)& EQ ‘HG’
/: DEFINE &PREFIX& = ‘Mr.’
/: ELSE
/: DEFINE &PREFIX& = ‘Mrs.’
/: ENDIF
/ &PREFIX&
Commands (Contd.)
CASE ..ENDCASE command can also be used in the layout set to control the
flow of logic. It is same as the corresponding ABAP command but with only one
difference that no full stops are used here.
Example :
/: CASE &VBDKL-VKORG(2)&
/: WHEN ‘HG’
/ Case # &‘934’VBDPL-SORTKRI&
/: WHEN OTHERS
/ Case # &‘999’VBDPL-SORTKRI&
/: ENDCASE
Commands (Contd.)
Using the command NEW-PAGE, a page -break can be made in SAPScript at any
position before the end of the page defined in the layout set. The next page can
be specified explicitly.
Syntax:
/: NEW-PAGE [PAGE]
Commands (Contd.)
Commands (Contd.)
The parameter LINES are available for formatting the address. Possible values
are from 1 to n. If it is not possible to format all address data due to a lack of
lines, the data which is entered in the parameter PRIORITY is omitted.
Commands (Contd.)
The date can be formatted using the command SET DATE MASK = ‘…’. After
formatting all date fields are output as specified. The available formats for day,
month and year are following.
DD Day
MM Month in figures
MMMM Month in words
YY Year (2 digits)
YYYY Year (4 digits)
Example : /: SET DATE MASK = ‘MM/DD/YYYY’
The formatting can be reset at any point of time by
/: SET DATE MASK = ‘’. Formatting is then carried out as defined by the System.
Commands (Contd.)
The time can be formatted using the command SET TIME MASK = ‘…’. After
formatting all time fields are output as specified. The available formats for hours,
minutes and seconds are following.
HH Hours
MM Minutes
SS Seconds
Example /: SET TIME MASK = ‘HH:MM:SS’
The formatting can be reset at any point of time by
/: SET TIME MASK = ‘’. Formatting is then carried out as defined by the System.
Commands (Contd.)
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 :
There are two different types of text handled in SAPScript. One is APPLICATION
TEXT and other one is STANDARD TEXT.
Commands (Contd.)
Barcode Printing
Demonstration
Changing the custom SAPScript created for the previous chapter using
transaction SE71.
Creating a text-element in the main window to display the price of the ticket.
Displaying the date using SAPScript symbols
Formatting the date in MM/DD/YYYY format using SAPScript commands
Importing a logo for the airlines using transaction SE78 and displaying the same
the same on the form.
Practice
Changing the custom SAPScript created for the previous chapter using
transaction SE71.
Creating a text-element in the main window to display the price of the ticket.
Displaying the date using SAPScript symbols
Formatting the date in MM/DD/YYYY format using SAPScript commands
Importing a logo for the airlines using transaction SE78 and displaying the same
the same on the form.
Summary
Text elements can be coded in the SAPScript editor. They always start with the
line /E and continue to the next text element (/E).
SAPScript Symbols are placeholders for values during print formatting and are
wrapped in in ‘&’ characters. Example : &VBAK-VBELN&.
Flow Logic commands e.g. CASE…ENDCASE and IF…ELSE…ENDIF can be
used in layout sets to control the flow logic.
In SAPScript, any text can be included at a certain position in the document using
INCLUDE command.
There are two different types of text handled in SAPScript. One is APPLICATION
TEXT and other one is STANDARD TEXT.
Barcodes and Logos can be created in layout sets.
Questions
Is printing of the text elements on the form controlled by the layout set or the
output program ?
What is the use of the ‘DEFINE’ command ?
What is the command for preventing a page break within a paragraph ?
What is the transaction executed to import a bitmap logo object as a graphics
object in SAP R/3 ?
What is the use of the ‘INCUDE’ command in SAPScripts ?