Sap Script

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 39
At a glance
Powered by AI
The document discusses various SAPscript control commands that can be used for formatting text, conditional logic, page breaks and more. It also covers how to format dates, times, numbers and use system variables in SAPscript forms.

Some of the main SAPscript control commands discussed include ADDRESS, BOX, IF, INCLUDE, NEW-PAGE, PRINT-CONTROL, SET COUNTRY and STYLE.

Dates and times can be formatted using the SET DATE MASK and SET TIME MASK commands along with date/time format codes. Numbers can be formatted using options like exponents, fill characters, leading signs. Country dependent formatting is also covered.

Appendix :A SAPscript Control Commands

Appendix :B Contents

Overview................................................................................................................ A–3
Overview of SAPscript Control Commands........................................................A–4
Overview of Formatting Options..........................................................................A–5
Syntax of Control Commands..............................................................................A–6
ADDRESS: Formatting of addresses......................................................................A–6
BOTTOM: Define footer text in a window................................................................A–8
BOX, POSITION, SIZE: Boxes, lines, shading........................................................A–9
CASE: Case distinction......................................................................................... A–12
DEFINE: Value assignment to text symbols..........................................................A–13
HEX: Hexadecimal Data........................................................................................ A–13
IF: Conditional text output.....................................................................................A–14
INCLUDE: Include other texts...............................................................................A–16
NEW-PAGE: Explicit form feed..............................................................................A–17
NEW-WINDOW: Next window MAIN.....................................................................A–18
PERFORM: Calling ABAP Subroutines.................................................................A–18
PRINT-CONTROL: Insert print control character...................................................A–19
PROTECT: Protect from page break.....................................................................A–20
RESET: Initialize outline paragraphs.....................................................................A–21
SET COUNTRY: Country-specific formatting........................................................A–22
SET DATE MASK: Formatting of date fields..........................................................A–23
SET SIGN: The Position of +/-...............................................................................A–24
SET TIME MASK: Formatting of time fields...........................................................A–24
STYLE: Change style............................................................................................ A–25
SUMMING............................................................................................................. A–25
TOP: Set header text in MAIN...............................................................................A–25

SAPscript Made Easy 1


Syntax of Formatting Options............................................................................A–27
Changing the Value of a Counter..........................................................................A–27
Country Dependent Formattingn...........................................................................A–27
Date Mask............................................................................................................. A–28
Exponent for floating point numbers......................................................................A–29
Fill characters........................................................................................................ A–29
Ignoring conversion rules......................................................................................A–30
Leading sign to the left.......................................................................................... A–30
Leading sign to the right........................................................................................ A–30
Number of decimals.............................................................................................. A–31
Offset..................................................................................................................... A–31
Omitting leading zeros........................................................................................... A–31
Omitting the leading sign.......................................................................................A–32
Omitting the separator for “Thousands”.................................................................A–32
Output length......................................................................................................... A–32
Preceding and subsequent text.............................................................................A–33
Right-justified output.............................................................................................. A–34
Space compression............................................................................................... A–34
Suppressing initial values......................................................................................A–35
Time Mask............................................................................................................. A–35
System Variables.................................................................................................A–36
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Overview

The functionality of the SAPscript editor is determined by a number of commands, which


you can either choose from the menu or call with function keys. These commands edit the
text in the editor based on your requirements, and commands are immediately executed.
In contrast, SAPscript recognizes another type of commands, the control commands, which:
 Correspondingly influence the output formatting
 Are not interpreted by the SAPscript editor
 Only affect the SAPscript Composer
The Composer is a program that converts text from the editor display into the print display.
This program formats the line and pages where symbols are replaced by their current values
and text formatting is based on the paragraph and the character style formats.
Overview of SAPscript Control Commands

SAPscript Control Commands Description

ADDRESS Formatting of addresses


BOTTOM, ENDBOTTOM Define footer text in a window
BOX, POSITION, SIZE Boxes, lines and shading
CASE, ENDCASE Case distinction
DEFINE Value assignment to text symbols
HEX, ENDHEX Hexadecimal values
IF, ENDIF Conditional text output
INCLUDE Include other texts
NEW-PAGE Explicit forms feed
NEW-WINDOW Next window MAIN
PERFORM Calling ABAP Subroutines
PRINT-CONTROL Insert print control character
PROTECT, ENDPROTECT Protect from page break
RESET Initialize outline paragraphs
SET COUNTRY Country-specific formatting
SET DATE MASK Formatting of date fields
SET SIGN Position of +/- sign
SET TIME MASK Formatting of time fields
STYLE Change style
SUMMING Summing variables
TOP Set header text in window MAIN
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Overview of Formatting Options

Formatting options format variables and override the format described in the Dictionary. Formatting
options are always specified within &-& variable brackets.

Formatting Options Description

Changing the value of a counter Increasing or decreasing the value of a counter


Country dependent formatting Specifying formats for country dependent values
Date mask Formatting date fields
Exponent for floating point numbers Specifying an exponent for floating point values
Fill characters Replacing leading spaces with fill characters
Ignoring conversion rules Ignoring conversion rules from Dictionary
Leading sign to the left Leading sign of numeric values is on the left
Leading sign to the right Leading sign of numeric values is on the right
Number of decimals Specifying the number of decimal places
Offset Specifying an offset of n characters
Omitting leading zeros Omitting the leading zeros
Omitting the leading sign Omitting the leading sign of numeric values
Omitting the separator for ‘Thousands’ Omitting the separator for “Thousands” in
numeric values
Syntax of Control Commands

SAPscript control commands are entered, changed, or deleted in the SAPscript editor in the
same way as other text lines. However, they differ from normal lines in the following ways:
 In the tag column, indicate control commands with the paragraph format /:
 Enter the command in the line.
 All key words and specifications, not defined in quotes as literal, are automatically
converted to upper case.
 Enter the complete control command and the necessary parameters on one line.
 Enter only one control command per line.
 Editor formatting does not affect lines with control commands.
If the control command is unknown or syntactically incorrect, the command line is treated
as a comment line, and is not interpreted or printed.

If a parameter of a control command is written in parentheses, [], on the


following pages, then this parameter is optional for the command.

Some of the control commands are global settings, which are valid until they
are explicitly switched off. Therefore it is important to know that, on a page,
the MAIN window is always processed first. For example, if you want to set
the date format with the control command SET DATE FORMAT and this
format must be valid for the entire form, then specify this command at the
top of MAIN.

ADDRESS: Formatting of addresses


The command ADDRESS - ENDADDRESS 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.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Syntax:
/: ADDRESS [DELIVERY] [PARAGRAPH a] [PRIORITY p] [LINES l]
/: TITLE title
/: NAME name1[,name2[,name3[,name4]]]
/: STREET street
/: POBOX PO box [CODE zip code]
/: POSTCODE zip code
/: CITY town1[,town2]
/: REGION region
/: COUNTRY country
/: FROMCOUNTRY from country
/: ENDADDRESS
Both formatting data and address data are parameters. Address data is formatted for output based on the
COUNTRY, PRIORITY and LINES parameters. As the default, the P.O. Box is used, if it is available, rather
than the street address.
 DELIVERY defines the street address.
 If this parameter is selected, the system prints the street address on the layout output instead of the
P.O. Box.
 PARAGRAPH defines in which paragraph format the address is output.
 If the parameter is not defined, the address is output in the default paragraph format.
 PRIORITY defines which address lines can be omitted if there is not enough space on the output.
 You can enter a combination of the following values:
 A form of address
 P mandatory blank line 1
 Q mandatory blank line 2
 2 name2
 3 name3
 4 name4
 L country name
 S line for the street
 O line for the city
 LINES define how many lines are available to format the address.
If the address data cannot be completely formatted due to an insufficient number of lines, the data
entered in the parameter PRIORITY is omitted. If the LINES specification is missing and this command
is in a form window whose type is not MAIN, the lines available for the address layout are
automatically calculated with the current output line item and window size.
 TITLE is a required form of address.
 NAME means that up to four separate names, separated by commas, can be defined.
 STREET means the street specification, including address number.
 POBOX is the Post Office box number.
 CODE is the P.O. box, postal, or zip code, if this code is different from the postal code of the city.
 POSTCODE is city’s postal, or zip, code.
 CITY means that up to two place names can be defined.
 REGION determines the administrative area.
 COUNTRY specifies the country based on specific postal standards and the address format.
 FROMCOUNTRY defines in which language the destination country’s name is formatted. In EEC
countries, only the international country identification letter is placed, with a hyphen, before the postal
code.

Example:
/: ADDRESS
/: TITLE ‘Company’
/: NAME ‘Widget Technology, Inc.’, ‘All Kind of Widgets’
/: STREET ‘1005 Lido Lane’
/: POBOX ‘2935’ CODE ‘94400’
/: POSTCODE ‘94404’
/: CITY ‘Foster City’
/: REGION ‘CA’
/: COUNTRY ‘USA’
/: FROMCOUNTRY ‘USA’
/: ENDADDRESS
This list generates the following address:

Company
Widget Technology, Inc.
All Kind of Widgets
PO box 2935
Foster City, CA 94400
If the DELIVERY supplement is specified for the ADDRESS command, then the street, not
the P.O. Box, is entered.

Company
Widget Technology, Inc.
All Kind of Widgets
1005 Lido Lane
Foster City, CA 94404

SAPscript calls the ADDRESS_INTO_PRINTFORM function module to


format the address. If the display is not in the required form, check the
settings that are valid for this function module (see the documentation on
the function module).
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

BOTTOM: Define footer text in a window


For MAIN, determine the lines, also known as footer texts, which are always automatically output at the
bottom of that window.
Syntax:
/: BOTTOM
:
:
/: ENDBOTTOM
The text lines between the two commands are output at the bottom of MAIN.
To switch a footer text off, enter the command pair BOTTOM .. ENDBOTTOM with no text lines in
between:
/: BOTTOM
/: ENDBOTTOM
Footer text no longer appears at the bottom of the page from and including this page.

If there is sufficient space in the window, a footer text is output on the


current page.
Only use footer texts in texts that are not printed with application programs,
such as dunning texts, ordering texts. These application programs also work
with footer texts with the form interface, which can lead to unwanted
results.

BOX, POSITION, SIZE: Boxes, lines, shading


The BOX, POSITION and SIZE commands draw boxes, lines, and shadows. Within any particular form,
these commands specify window or passage of window text can be output in a frame or with shadowing.
The SAP printer drivers based on page-oriented printers (the HP LaserJet PCL-5 driver HPLJ4, the
Postscript driver POST, the Kyocera Prescribe driver PRES) use these commands when creating output.
Line printers and non-supported page-oriented printers ignore these commands. The resulting output may
be viewed in the SAPscript print previewer.
Syntax:
1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
2. /: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
3. /: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
BOX
Syntax:
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
This command draws a box of the specified size at the specified position. For each parameter (XPOS,
YPOS, WIDTH, HEIGHT, and FRAME), both a measurement and a unit of measure must be specified. The
INTENSITY parameter should be entered as a percentage between 0 and 100.
 XPOS, YPOS specify the upper left corner of the box, relative to POSITION command values.
Default is the values specified in the POSITION command.
The following calculation is performed internally to determine the absolute output position of a box on
the page:
X(abs) = XORIGIN + XPOS
Y(abs) = YORIGIN + YPOS
 WIDTH determines the width of the box.
Default: WIDTH value of the SIZE command.
 HEIGHT determines height of the box.
Default: HEIGHT value of the SIZE command.
 FRAME determines the thickness of frame.
Default: 0 (no frame).
 INTENSITY determines the box contents as a grayscale percentage.
Default: 100 (full black)
When determining the measurements, use decimal numbers to specify literal values (like ABAP numeric
constants) and enclose these values in inverted commas. Use a period for the decimal point character. See
also the examples listed below.
Use the following units of measure:
 TW (twip)
 PT (point)
 IN (inch)
 MM (millimeter)
 CM (centimeter)
 LN (line)
 CH (character)
The following conversion factors apply:
 1 TW = 1/20 PT
 1 PT = 1/72 IN
 1 IN = 2.54 CM
 1 CM = 10 MM
 1 CH = height of a character relative to the CPI specification in the form header
 1 LN = height of a line relative to the LPI specification in the form header

Example:
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
/: BOX INTENSITY 10
Fills the window background with shadowing having a gray scale of 10 %.
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line across the complete top edge of the window.
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line along the complete height of the left hand edge of the window.
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
Draws two rectangles and two lines to construct a table of three columns with a
highlighted heading.

POSITION
Syntax:
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
This command sets the origin for the coordinate system used by the XPOS and YPOS parameters of the
BOX command. When a window is first started, the POSITION value is set to refer to the upper left corner
of the window (default setting). If a parameter value does not have a leading sign, then its value is
interpreted as an absolute value, which is a value that specifies an offset from the upper-left corner of the
output page. If a parameter value is specified with a leading sign, then the new value of the parameter is
calculated relative to the old value. If a parameter specification is missing, then this parameter is
unchanged.
 XORIGIN, YORIGIN is the origin of the coordinate system.
 WINDOW sets the values for the left and upper edges to be the same of those of the current window
(default setting).
 PAGE sets the values for the left and upper edges to be the same as the current output page (XORIGIN
= 0 cm, YORIGIN = 0 cm).
Example:
/: POSITION WINDOW
Sets the origin for the coordinate system to the upper-left corner of the window.
/: POSITION XORIGIN 2 CM YORIGIN '2.5 CM'
Sets the origin for the coordinate system to a point 2 cm from the left edge and 2.5 cm
from the upper edge of the output page.
/: POSITION XORIGIN '-1.5' CM YORIGIN -1 CM
Shifts the origin for the coordinates 1.5 cm to the left and 1 cm up.

SIZE
Syntax:
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
This command sets the values of the WIDTH and HEIGHT parameters used in the BOX command. When a
window is first started, the SIZE value is set to the same values as the window (default setting). If one of
the parameter specifications is missing, then no change is made to its current value. If a parameter value
does not have a leading sign, then its value is interpreted as an absolute value. If a parameter value is
specified with a leading sign, then the new value of the parameter is calculated relative to the old value.
 WIDTH, HEIGHT sets the dimensions of the rectangle or line.
 WINDOW sets the values for the width and height relative to the values of the current window (default
setting).
 PAGE sets the values for the width and height to the values of the current output page.

Example:
/: SIZE WINDOW
Sets WIDTH and HEIGHT to the current window dimensions.
/: SIZE WIDTH '3.5' CM HEIGHT '7.6' CM
Sets WIDTH to 3.5 cm and HEIGHT to 7.6 cm.
/: POSITION WINDOW
/: POSITION XORIGIN -20 TW YORIGIN -20 TW
/: SIZE WIDTH +40 TW HEIGHT +40 TW
/: BOX FRAME 10 TW
A frame is added to the current window. The frame edges extends beyond the window
itself, to avoid obscuring the leading and trailing text characters.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

CASE: Case distinction


The CASE command is a special case of multi-level case distinction with IF commands. As a condition for
the different cases, only one symbol can be queried for equality with different values.
Syntax:
/: CASE symbol
/: WHEN value1
:
/: WHEN value2
:
/: WHEN value n
:
/: WHEN OTHERS.
:
/: ENDCASE
The symbol entered in the CASE line is formatted. If it has a value specified in the individual WHEN lines,
the text following the valid WHEN line is output. If none of the listed values apply, the lines between the
WHEN-OTHERS line and ENDCASE are output. The WHEN-OTHERS case is optional. Comparison is
always carried out as a literal comparison as for the IF command.

ENDCASE must end a CASE command, but the WHEN-OTHERS command


is optional.

DEFINE: Value assignment to text symbols


Text symbols receive their value through an explicit assignment. This assignment can be made
interactively in the editor by choosing Include  Symbols  Text. This step lists all the text symbols of a text
module and those of the allocated form. If the transaction is exited, the contents defined in this way are
lost. To continue printing the text module, you would have to enter the symbol values again.
The DEFINE command allows you to anchor this value assignment in the text and to have it available
when you next call up the text. Furthermore, you can allocate another value to a text symbol in the course
of the text.
Syntax:
/: DEFINE &symbolname& = ‘value’
Example:
/: DEFINE &re& = ‘Your correspondence of 3/17/94’
/: DEFINE &symbol1& = ‘xxxxxxx’
/: DEFINE &symbol2& = ‘yyy&symbol1&’
/: DEFINE &symbol1& = ‘zzzzzzz’
Result: &symbol2&  yyyzzzzzzz

The assigned value may have a maximum of 60 characters, but it can also contain more symbols. When a
symbol is defined using DEFINE, symbols which occur in the value are not immediately replaced by their
value. They are replaced only when the target symbol is output.
If operator := is used in DEFINE, the symbols that occur in the value to be assigned are immediately
replaced by their current values. The resulting character string is only then assigned to the target symbol
when all occurring symbols have been replaced. The length of the value is limited to 80 characters, and the
target symbol must be a text symbol.
Syntax:
/: DEFINE &symbolname& := ‘value’

HEX: Hexadecimal Data


This command sends printer commands in a printer language directly to a printer that supports that
language. SAPscript does not interpret the data enclosed by the HEX and ENDHEX command pair, but
inserts unchanged data into the output stream. This technique allows objects with a pixel-oriented format
to be printed as part of a SAPscript text. The HEX and ENDHEX command pair enclose the printer
commands and data as hexadecimal text, so that the printer formatting routines interpret each successive
pair of characters as a single hexadecimal value in the 0..255 range.
The characters 0..9 and A..F to represent the values 10..15 are valid hexadecimal characters. The text may
also include comment lines (these begin with /* in the format column), which will not be interpreted as
hexadecimal data but are simply passed over by the formatting routines.
Syntax:
/: HEX [TYPE printer_language]
:
:
/: ENDHEX
HEX denotes the start of the hexadecimal data. Subsequent text lines are interpreted as described above. If
the TYPE parameter is present, the data will be sent to the printer only if the printer understands the
specified printer language. The following printer languages are currently supported:
 POST (Postscript)
 PRES (Kyocera Prescribe)
 PCL (HP Printer Control Language)
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

/: HEX [TYPE printer_language] [XPOS x_position] [YPOS y_position]


Before the hexadecimal data is output, the output cursor is set to the absolute position indicated by the
specified X and Y position parameters. If either the X or the Y position is not specified, then 0 will be
assumed for this parameter.
/: HEX [TYPE printer_language] [HEIGHT height] [LEFT left_indentation]
The HEIGHT parameter determines the amount of space to be reserved on the page for the output of the
hexadecimal data. Any text after ENDHEX will be output below this point. If the LEFT parameter is also
specified, then the output of the hexadecimal data will be indented from the left margin by the specified
amount.

Example:
/* Creator: report ZQVNTE30 date 19940705 time 125129 user SAPSCRIPT
/= 1B2A7230461B2A743735521B2A7231411B2A62304D1B2A62343057FFFFFFFFFFFF
/= FF1B2A62343057FFFFFFFFFFFFC0007D00DFC0F7D0000000000000000000000017
/: ENDHEX
This data will be printed only by an HP PCL printer (7.5 cm of space will allocated on the page
for the output of the data and the output cursor will be indented 2.25 cm to the right of the
form window edge).

The RSTXLDMC program uploads correctly formatted pixel data to the R/3
system and prepares it as a HEX-ENDHEX control command. This data can
then be saved as normal SAPscript text.

IF: Conditional text output


With the IF control command, define those lines that are output under certain conditions. If the logical
expression entered for the IF command is fulfilled, the lines parenthesized by IF ... ENDIF are output. If
this expression is not enclosed in parentheses, the commands are ignored.
Syntax:
/: IF Condition
:
:
/: ENDIF
In the condition, the following relational operators are possible:
Relational Operator Description

= or EQ equals
< or LT less than
> or GT greater than
<= or LE less than or equal to
>= or GE greater than or equal to
<> or NE not equal

As logical link operators use OR, NOT, or AND.

The sequence of processing the logical operations and the sequence of processing the conditions is always
from left to right. There is no order of binding, and bracketing is not allowed.
Comparison is always carried out as a literal comparison, that is, symbols are compared in their formatted
form as a character string and not with their internal representation. This comparison must be taken into
account for program symbols whose format depends on different parameters. Examples include currency
fields that are output with different number of places after the decimal point depending on the currency
key, or that use a comma or a period as the decimal separator depending on the setting.
The IF command can be extended to make a two-sided case distinction with the ELSE command. If the
specified IF condition is true, then the lines listed between IF and ELSE are formatted, otherwise the lines
between ELSE and ENDIF are formatted.
Syntax:
/: IF Condition
:
/: ELSE
:
/: ENDIF
A multi-level case distinction is possible using the ELSEIF command.
Syntax:
/: IF Condition
:
/: ELSEIF Condition
:
/: ELSE
:
/: ENDIF
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

You can use as many ELSEIF commands as required. The specification of an ELSE command is optional in
this case.

 The condition must not extend over several lines, and must be contained
in one line with the IF or ELSEIF command.
 IF commands can also be nested.
 An IF command must always end with ENDIF. If this command is
forgotten, and if the condition is not true, nothing more is output after
the IF command.
 If a syntax error is found when interpreting these commands, the
corresponding command is not executed. This can have various effects
on the following text output. If, for example, the IF statement is
incorrectly structured, since IF is missing, the following ELSEIF or ELSE
commands are ignored. All lines are output.

INCLUDE: Include other texts


Use INCLUDE to include the contents of another text into your text. The text to be included exists
separately from yours and is only copied at the time of the output formatting. With INCLUDE, since the
text is only read and inserted during the output formatting, the most current version of the required text is
always available.
Syntax:
/: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p] [NEW-PARAGRAPH np]
The name of the text to be inserted must be specified and can have up to 70 characters. If the text name
contains blanks, put it in quotes as a literal. It can also be specified with a symbol. All further parameters of
INCLUDE are optional. If these parameters are missing, SAPscript uses default values based on the
respective call environment for them.

Example:
/: INCLUDE MYTEXT
The text MYTEXT is included in the language of the calling text.
/: INCLUDE MYTEXT LANGUAGE ‘E’ PARAGRAPH ‘A1’
The text with the name MYTEXT and the language E is included, regardless of the
language in which the calling text is created. The paragraph format A1 is valid as the
standard paragraph for this call.

Optional specifications:
49. LANGUAGE
If a language is unspecified, the calling text’s language or the form is set for the text to be included. If a
language is specified, the text is always loaded in this language, regardless of the language of the
calling text.
50. PARAGRAPH
The text to be included is formatted with its style allocation. With this parameter, the standard
paragraph of this style can be redefined for the current call. All * paragraphs of the inserted text are
formatted with the paragraph specified here.
51. NEW-PARAGRAPH
The first line of the included text has this format flag, provided it is not a command or comment line. If
the optional entry PARAGRAPH (see above) is empty, all * paragraphs of the included text are
formatted with the paragraph np specified with NEW-PARAGRAPH.
52. OBJECT
To completely specify a text, create additional specifications about the text object. There are different
rules and restrictions for this specification that depends on the calling text’s object type. All texts can be
included in a form. If no object is entered here, TEXT is used (standard texts). With a documentation
text (object DOKU), you can only include documentation texts. This object is assumed even if no object
is specified in this environment.
Only hypertext or documentation text can be included into a hypertext (object DSYS). If the OBJECT
specification is missing, DSYS is set as a default value.
Only standard text (object TEXT), documentation text or hypertext can be included in any other type of
text. The default object is TEXT if nothing is entered.
53. ID
The text ID allows further text types within an object, is a further part of the text key. If the ID is not
entered, the default Include ID from table TTXID is used to call text. If the specification is not in this
table, the text ID of the calling text is used.
The ID and the object are now the basis of a further consistency check:
 All text IDs are allowed for a form.
 Only documentation texts with the text IDs TX (general texts), UO (authorization objects), and
documentation texts (with the same text ID as the calling documentation text) may be included in
documentation texts.
 All DSYS texts may be included in DSYS texts, regardless of their ID. Documentation texts that will be
inserted may only have IDs TX and UO.
 Standard texts with the allowed text IDs, DSYS texts with IDs, and documentation texts with IDs TX
and UO may be included in the text types.

NEW-PAGE: Explicit form feed


SAPscript automatically inserts a page break if MAIN of one page is filled. Using NEW-PAGE, a page
break can be forced at any point. The text after this command is written on a new page. The form feed is
independent of any conditions. The command now outputs the current page.
If you have entered NEW-PAGE without additional parameters, the page defined in the form as the next
page is accessed. If, however, there are various pages in your form, you can jump to any particular next
page by specifying the page name.
Syntax:
/: NEW-PAGE [page name]
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Example:
/: NEW-PAGE
The current page is completed and the text in the following lines is written on the next
page as determined in the form.
/: NEW-PAGE S1
Same as before, but S1 is accessed as the next page.

If an explicitly specified page for NEW-PAGE is not in the form, this page
specification is ignored. Make sure that there are no blank lines immediately
before a NEW-PAGE command. If an implicit form feed was carried out
within these blank lines, this step could lead to an unwanted empty page
being printed.

NEW-WINDOW: Next window MAIN


You can have up to 99 MAIN windows on one page. These windows are distinguished by a serial number
(0..98) and assigned in this order. So, with SAPscript, it is possible to print labels or to output text in
multiple columns. If one MAIN window is filled, then the next MAIN window on the page is automatically
accessed. A page break is inserted at the end of the final MAIN window.
Using NEW-WINDOW, even if the current window is not completely filled, you can explicitly call the next
window MAIN. If you are currently in the last MAIN window of the page, the command works as a NEW-
PAGE.
Syntax:
/: NEW-WINDOW

PERFORM: Calling ABAP Subroutines


You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the
normal ABAP runtime authorization checking. You can use such calls to subroutines for carrying out
calculations, for obtaining data from the database that is needed at display or print time, for formatting
data, and so on.
PERFORM commands, like all control commands, are executed when a document is formatted for display
or printing. Communication between a subroutine that you call and the document is by way of symbols
whose values are set in the subroutine.
Syntax in a form window:
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM
INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog
as follows:
FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
...
ENDFORM.
The values of the SAPscript symbols passed with /: USING... are now stored in the internal table
IN_TAB . Note that the system passes the values as character string to the subroutine, since the field Feld
VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See the example below on how to
access the variables.
The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM
statement. These parameters are local text symbols, that is, character fields. See the example below on how
to return the variables within the subroutine.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Example:
From within a SAPscript form, a subroutine GET_BARCODE in the ABAP program
QCJPERFO is called. Then the simple barcode contained there (‘First page’, ‘Next page’,
‘Last page’) is printed as local variable symbol.

Definition in the SAPscript form:


/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/
/ &BARCODE&

Coding of the calling ABAP program:


REPORT QCJPERFO.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.

PRINT-CONTROL: Insert print control character


This command allows you call certain printer functions from SAPscript text. The control characters for the
printer cannot be directly entered into your text. First, with the spool transaction SPAD, define a print
control that contains the required printer commands. This print control can now be called with the
SAPscript command PRINT-CONTROL.
Syntax:
/: PRINT-CONTROL name
The name of the required print control can be entered with or without quotes.

SAPscript has no idea of what is contained in the print control. It cannot


check whether the printer commands hidden behind it are functional. If
problems result when printing such a text, first print the text without the
print controls, and then activate each PRINT-CONTROL command to help
you locate the error more easily.
On completion, make sure that the defined print control sequences restore
the printer to a defined status. When printing subsequent texts, SAPscript
assumes that certain settings are still valid (type font, current page). If these
settings are changed by the called printer commands, this change can have
unwanted effects.

After performing PRINT-CONTROL, SAPscript inserts a blank at the start of the following line. If this is not
required, this line must have the paragraph format “=.”
PROTECT: Protect from page break
You can determine whether a paragraph should or should not be separated by a page break in the style or
form. If the attribute page protection is set, then all the lines of this paragraph are always output together
on one page. This attribute is linked to the respective paragraph.
It is not beneficial to provide all paragraphs with a page protection attribute to neutralize unwanted page
breaks. This event is too dynamic and only results from the current text. Furthermore, you may also want
to protect only parts of a paragraph from a page break.
In principle, this problem could be solved with NEW-PAGE by explicitly starting a new page before the
affected parts of the text. However, it is complicated to change this procedure. Using NEW-PAGE, if your
text is formatted to have no unwanted page breaks, and new lines are inserted and existing ones are
deleted, the NEW-PAGE commands inserted after this point will have to be checked and can result in the
movement of page breaks.
With the command pair PROTECT .. ENDPROTECT, SAPscript offers the option to individually define
protection from a page break. If you parenthesize text with these commands, SAPscript automatically
guarantees that all of its lines are printed on one page. If the lines fit on the current output page, they are
output there, as if PROTECT was not used. If, however, the space is not sufficient, PROTECT works like a
NEW-PAGE and generates a form feed.
So, you can view PROTECT/ENDPROTECT are conditional NEW-PAGE commands, that determine
whether the included lines fit into the current window MAIN or not.
Syntax:
/: PROTECT
:
:
/: ENDPROTECT
The lines to be protected lie between the two commands.

 An ENDPROTECT command without a preceding PROTECT command


is ineffective.
 If the last ENDPROTECT is missing, it is implicitly assumed at the end of
the text.
 PROTECT .. ENDPROTECT commands cannot be nested. If a second
PROTECT command is recognized while another is active, the second is
ignored.
 If the text between PROTECT and ENDPROTECT is so extensive that it
would not fit on an empty page, then only one form feed is generated
and the text is normally output. Thus, in this case, the section to be
protected is separated by a page break.

RESET: Initialize outline paragraphs


The RESET command resets the numbering of an outline paragraph to its initial value. If the user does not
use RESET, all the outline paragraphs of a text are sequentially numbered. If the name of an outline
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

paragraph is entered in RESET, the numbering of this paragraph, is initialized with subordinate outline
levels.
Syntax:
/: RESET paragraph format
The paragraph format specifies the outline paragraph to be initialized.

Example:
Assume that paragraph N1 is defined in the style that you are using. This paragraph
should be used for listings and it each time generates an output of a list number. This is
the SAPscript editor:
AS If you want to work with the SAP R/3 System, proceed as
follows:
N1 Make sure that you have a PC
N1 Switch on the PC
N1 Click on the SAP icon.
AS The SAP logon screen appears. To log on, you must carry out the
following steps:
/: RESET N1
N1 Enter your user ID
N1 Enter your password
N1 Choose the application you require
Result:
If you want to work with the SAP R/3 System, proceed as follows:
1. Make sure that you have a PC
2. Switch on the PC
3. Click on the SAP icon.
The SAP logon screen appears. To log on, you must carry out the following steps:
1. Enter your user ID
2. Enter your password
3. Choose the application you require.
Example:

If the RESET command between the two lines in the previous example is missing, then
both of the listings would be sequentially numbered:
Result:
If you want to work with the SAP R/3 System, proceed as follows:
1. Make sure that you have a PC
2. Switch on the PC
3. Click on the SAP icon.
The SAP logon screen appears. To log on, you must carry out the following steps:
4. Enter your user ID
5. Enter your password
6. Choose the application you require.

SET COUNTRY: Country-specific formatting


Some field types are formatted to be country-specific. This includes the display of a date, the decimal point,
or the thousands separator. Normally, the display types defined in the user master record are used here.
With the control command SET COUNTRY, a format alternative to that in the user master record can be
chosen, which is stored country-specifically in table T005X.
Syntax:
/: SET COUNTRY Country key
This country key can be entered either directly in quotes or with a symbol.

Example:
/: SET COUNTRY ‘CAN’
/: SET COUNTRY &country key&
By entering an empty country name, you can return to the values set in the user master
record.
/: SET COUNTRY ‘ ‘
The corresponding ABAP command is called internally by SAPscript.

If the required formats are incorrect, check the settings in table T005X.

SET DATE MASK: Formatting of date fields


Formatting date fields can be defined with the SAPscript command SET DATE MASK. After executing this
command, all the date fields are output with this display.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Syntax:
/: SET DATE MASK = ‘date mask’
In the date mask, the following edit formats can be used:

Edit format Description

DD Day (two-digit)
DDD Day name abbreviated
DDDD Day name in full
MM Month (two-digit)
MMM Month name abbreviated
MMMM Month name in full
YY Year (two-digit)
YYYY Year (four-digit)

All other characters in the mask are interpreted as text and copied correspondingly.

Example:

Assume that the current system date is March 1st 1994.


/: SET DATE MASK = ‘Walldorf, DD.MM.YY’
&DATE&
Result: Walldorf, 01.03.94
/: SET DATE MASK = ‘MMMM, DD. YYYY’
&DATE&
Result: March, 01. 1994

By specifying an empty string as the date mask, you can switch back to the default display:
/: SET DATE MASK = ‘ ‘
The texts for the month and day names, shortened or in full, are stored language-dependently in table
TTDTG under the following arguments:
Argument Description

%%SAPSCRIPT_DDD_dd abbreviated day name


dd = day number (01 = Monday … 07 = Sunday)
%%SAPSCRIPT_DDDD_dd full day name
%%SAPSCRIPT_MMM_mm abbreviated month name
mm = month number (01 = January … 12 = December)
%%SAPSCRIPT_MMMM_mm full month name

SET SIGN: The Position of +/-


For commercial applications, it is common for the “+/-“ signs to be displayed to the right of the number
value. In certain cases, however, it is necessary for these signs to be displayed to the left of the number
value. This position can be determined with the control command SET SIGN. All program symbols
formatted using this command and that have a “+/-“ sign are displayed in the required fashion.
Syntax:
/: SET SIGN LEFT
The +/- sign is displayed to the left of the number.
/: SET SIGN RIGHT
The +/- sign is displayed to the right of the number.

SET TIME MASK: Formatting of time fields


With the SAPscript command SET TIME MASK time fields can be alternatively formatted to the standard
display.
Syntax:
/: SET TIME MASK = ‘time mask’
The following edit formats can be used in the time mask:
 HH hours (two-digit)
 MM minutes (two-digit)
 SS seconds (two-digit)
All other characters in the mask are interpreted as text and printed correspondingly.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Example:

Assume that the current time is 10:08:12.


/: SET TIME MASK = ‘HH:MM’
&TIME&
Result: 10:08
/: SET TIME MASK = ‘HH hours MM minutes’
&TIME&
Result: 10 hours 08 minutes

By specifying an empty string as a time mask, you can switch back to the default display:
/: SET TIME MASK = ‘ ‘

STYLE: Change style


The control command STYLE changes style within a text. This other style is used until a new STYLE
command is entered. If * is entered as a style name, switch back to the original style.
Syntax:
/: STYLE style
/: STYLE *
If another text module is inserted by choosing Include  Text and immediately deleted, STYLE is
automatically set in the editor. The same occurs if the text contents included in INCLUDE are copied into
the text by choosing Edit  Selected area  Delete INCLUDE.

SUMMING
Program symbols can be added with the SUMMING command. The command needs to be defined only
once. Each time that the specified symbol is edited, its current value is added to the sum field. Several
program symbols can also be added in a sum field.
Syntax:
/:SUMMING program symbol INTO sum symbol
Since SAPscript can not dynamically define sum fields, the sum symbol must be in a calling program
structure that was declared with TABLES.

TOP: Set header text in MAIN


In MAIN, lines that are always automatically output at the top of the window, called header texts, can be
determined. Header texts can automatically repeat the table heading at the top of every page for an
extensive tabular list.
Syntax:
/: TOP
:
:
/: ENDTOP
Those text lines between the two commands will be output at the top of MAIN.
To switch a header text off, enter the command pair TOP .. ENDTOP, with no lines in between:
/: TOP
/: ENDTOP
Header text will not appear on subsequent pages.

 If the document window contains text, then the header text is effective
from the next page.
 The same applies to deleting a header text. That is, a header text that has
already been output can no longer be canceled on the current page.
 Only use header texts in texts that are not printed with application
programs, such as dunning texts and ordering texts. These application
programs can also work with header texts in the form interface, which
can lead to unwanted results.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Syntax of Formatting Options

Changing the Value of a Counter


You can increase or decrease the value of SAPSCRIPT-COUNTER_x (x=0.. 9) counter variable by 1, before
the current counter value is printed.
Syntax:
&SAPSCRIPT-COUNTER_x(+)& Increases by 1 the contents
of the counter variable x
(x=0.. 9)
&SAPSCRIPT-COUNTER_x(-)& Decreases by 1 the contents
of the counter variable x
(x=0.. 9)
If you want to change the value of a counter variable without actually printing the new value, use this
formatting option together with an additional option to set the output length to 0 (see above). If you want
to set a counter variable to some specific value, use the DEFINE control command.

Example:
Assume that &SAPSCRIPT-COUNTER_1& initially has the value 2.
&SAPSCRIPT-COUNTER_1&  2
&SAPSCRIPT-COUNTER_1(+)&  3
&SAPSCRIPT-COUNTER_1(-)&  2
&SAPSCRIPT-COUNTER_1(-)&  1
&SAPSCRIPT-COUNTER_1(+0)& 
&SAPSCRIPT-COUNTER_1(+)&  3

Country Dependent Formattingn


Certain fields are formatted specific to a particular country. These include fields for displaying a date and
numeric fields containing either a decimal point or a ‘thousands’ separator character. The formatting
applied is usually determined by the definitions contained in the user master record. You can use the SET
COUNTRY control command to choose a different formatting operation. The various country-dependent
formatting options are stored in table T005X.
Syntax
/: SET COUNTRY country_key
You can specify this country key either by quoting it directly enclosed in inverted commas or by using a
symbol.
/: SET COUNTRY 'CAN'
/: SET COUNTRY &KNA1-LAND1&
You can revert to the settings of the user master record by using the SET COUNTRY control command
again with an empty country name.
/: SET COUNTRY ' '
When SAPscript encounters this command it calls the corresponding ABAP command internally. The effect
of the SAPscript command is thus identical with that of the ABAP command.
If the formatting turns out other than expected, check the settings in table T005X.

Date Mask
To format date fields, use the SAPscript SET DATE MASK command. Executing this command causes all
subsequent date fields to be printed with the specified formatting.
Syntax
/: SET DATE MASK = 'date_mask'
The following table provides templates may be used in the date mask:

Template Description

DD day (two digits)


DDD name of day (abbreviated)
DDDD name of day (written out in full)
MM month (two digits)
MMM name of month (abbreviated)
MMMM name of month (written out in full)
YY year (two digits)
YYYY year (four digits)
LD day (formatted as for the L option)
LM month (formatted as for the L option)
LY year (formatted as for the L option)

Any other characters occurring in the mask are interpreted as simple text and are copied directly to the
output.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Example:

Assuming a current system date of March 1st, 1997.


/: SET DATE MASK = 'Foster City, MM.DD.YY'
&DATE&  Foster City, 03.01.97
&DATE(Z)&  Foster City, 3.1.97
/: SET DATE MASK = 'MMMM DD, YYYY'
&DATE&  March 01, 1997

You can revert to the standard setting by using the SET DATE MASK command again with an empty
string in place of the date mask:
/: SET DATE MASK = ' '

Exponent for floating point numbers


How a floating point number is formatted depends on whether an exponent is specified. The mantissa is
adjusted by shifting the decimal point and, if necessary, introducing leading zeros, based on the chosen
exponent. An exponent value of 0 means that the exponent representation will not be used to display the
symbol.
Syntax:
&symbol(En)&

Example:

In this example the PLMK-SOLLWERT field is assumed to have the value 123456.78 and
to be of data type FLTP.
&PLMK-SOLLWERT&  +1.23456780000000E+05
&PLMK-SOLLWERT(E3)&  +123.456780000000E+03
&PLMK-SOLLWERT(E6)&  +0.12345678000000E+06
&PLMK-SOLLWERT(E0)&  +123456.780000000
&PLMK-SOLLWERT(E)&  +123456.780000000

Fill characters
Leading spaces in a value can be replaced with a fill character. The character immediately following the F
in the specification is used as the fill character.
Syntax:
&symbol(Ff)&
Example:

The figure for customer sales in the KNA1-UMSAT field is $700. The Dictionary
description of the field specifies an output length of eight.
&KNA1-UMSAT&  700.00
&KNA1-UMSAT(F*)&  **700.00
&KNA1-UMSAT(F0)&  00700.00

Ignoring conversion rules


SAPscript conversion routines specified in the Dictionary are automatically recognized and used when
program symbols are formatted. These conversions can be prevented with the K option.
Syntax:
&symbol(K)&

Leading sign to the left


The leading sign is normally displayed to the right of a numeric value, except when using a floating point
number. This option allows you to specify that the leading sign is placed to the left of the number.
Syntax:
&symbol(<)&

Example:
&ITCDP-TDULPOS&  100.00-
&ITCDP-TDULPOS(<)&  -100.00

The SET SIGN LEFT control command specifies that all subsequent symbols
with a numeric value should have a left-justified leading sign. Using this
control command means that there is then no need to repeat the < option for
each individual symbol.

Leading sign to the right


The default setting outputs the leading sign to the right of a numeric value. If you used the SET SIGN LEFT
to specify that the leading sign should be output before the value, this specification can be overridden for
individual symbols to enable these values to be output with the leading sign to the right.
Syntax:
&symbol(>)&
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Use the SET SIGN RIGHT control command to switch back to the default
setting to output the leading sign.

Number of decimals
A program symbol of one of the data types DEC, QUAN and FLTP can contain decimal place data. This
option overrides the Dictionary definition for the number of decimal places to format this symbol value.
Syntax:
&symbol(.n)&

Example:
The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies
three decimal places and an output length of 17.
&EKPO-MENGE&  1,234.560
&EKPO-MENGE(.1)&  1,234.6
&EKPO-MENGE(.4)&  1,234.5600
&EKPO-MENGE(.0)&  1,235

Offset
Specifying an offset of “n” causes the “n” left-most characters of the symbol value will not be displayed. If
the offset specified is greater than the length of the value, nothing is output.
Syntax:
&symbol+n&

Example:

If symbol has the value 123456789, the following will be displayed:


&symbol&  123456789
&symbol+3&  456789
&symbol+7&  89
&symbol+12& 
&symbol+0&  123456789
Omitting leading zeros
Certain symbol values are output with leading zeros. To suppress these values use the Z option.
Syntax:
&symbol(Z)&

Example:
Assuming the current date is 1/1/1994.
&DAY&  01
&DAY(Z)& 1

Omitting the leading sign


Program symbols with numeric values can have a leading sign, which usually appears at the right of the
numeric value as a space for positive numbers, or as a minus sign for negative numbers. The S option
ensures that the value is formatted without the sign.
Syntax:
&symbol(S)&

Example:

The ITCDP-TDULPOS field contains the value -100.00. The ABAP Dictionary definition for
this field includes a leading sign.
&ITCDP-TDULPOS&  100.00-
&ITCDP-TDULPOS(S)&  100.00

Omitting the separator for “Thousands”


Symbols of the DEC, CURR, INT and QUAN data types are normally formatted with the “thousands”
separator character. The T option allows you to specify that this separator character should be omitted.
Syntax:
&symbol(T)&

Example:

The EKPO-MENGE field contains the value 1234.56. The Data Dictionary definition
specifies three decimal places and the output length is set to 17.
&EKPO-MENGE&  1,234.560
&EKPO-MENGE(T)&  1234.560
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Output length
If you need only a part of the symbol value, or if the output has to fit in an on-screen box or field without
overlapping the edges of this area, use an output length specification to define how many character
positions should be copied from the value.
If a length is specified that is greater than the current value length, then spaces are appended to the symbol
value.
The character * specifies the program symbol length. This specification causes the symbol value to be
output based on the output length defined in the ABAP Dictionary.
Syntax:
&symbol(l)&

Example:

If symbol has the value 123456789.


&symbol(3)&  123
&symbol(7)&  1234567
An output length specification can be combined with an offset specification. The specified
length is then counted from the specified offset position.
&symbol+4(3)&  567
Example:

The SYST-UNAME field contains the logon name of a user called Einstein. The ABAP
Dictionary entry for this field contains an output length of 12.
&SYST-UNAME&... Einstein...
&SYST-UNAME(9)&... Einstein ...
&SYST-UNAME(*)&... Einstein ...

Preceding and subsequent text


In addition to using initial symbol values, additional texts that are output only when the symbol value is
no longer the initial value can be specified. You can specify a text to be output immediately before the
symbol value (the pretext), and text to be output immediately after it (the posttext). If the symbol has its
initial value, these texts are suppressed.
Syntax:
&'pre-text'symbol'post-text'&
Ensure that the symbol, the pretext and the posttext, all appear on a single
line of the editor. This may mean that you have to use a long line (paragraph
attribute = or /= ) in the editor.
The apostrophe character delimits these texts. If this character also appears as
part of one of these texts, then it must be written twice at this point to avoid
misinterpretation. A pretext or posttext may contain symbols in addition to
normal text. These symbols are subject to the restriction that these symbols
may not have a pretext or a posttext.

Example:

The KNA1-PFACH field contains a customer PO Box number. Since “PO Box” is not
stored in the field with the value, you would normally write the following for the PO Box
line of an address:
PO Box &KNA1-PFACH&
However, if no “P.O. Box” has been specified then “PO Box” would still appear on its
own in the address. Prevent this step by using pretext and/or posttext (in this case
pretext).
PO Box &KNA1-PFACH&  PO Box
&'PO Box 'KNA1-PFACH&
If “P.O. Box” is specified, then this information will be displayed with the appropriate
text in the usual way.
&'PO Box 'KNA1-PFACH&  PO Box 123456

Right-justified output
Symbol values other than numeric values are normally formatted to be left-justified. Right-justified
formatting can be specified with the R option. This option has to be used with an output length
specification.
Syntax:
&symbol(R)&

Example:
If symbol has the value 1234.
&symbol&  1234
&symbol(8R)&  1234

Space compression
The symbol value is viewed as a sequence of “words,” each separated from the next by either one or a
string of space characters. The C option replaces each string of space characters with a single space and
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

shifting “words” to the left to close gaps. Leading spaces are completely removed. The results are the same
as if the ABAP command CONDENSE was used.
Syntax:
&symbol(C)&

Example:
Assuming ' Albert Einstein ' is the symbol value.
&symbol& Albert Einstein
&symbol(C)& Albert Einstein

Suppressing initial values


The I option suppresses the output of symbols that still contain their initial value.
Syntax:
&symbol(I)&

Example:

Assuming KNA1-UMSAT contains the value 0 and the currency is USD.


&KNA1-UMSAT& 0.00
&KNA1-UMSAT(I)&
If the field contains an amount other than 0, this value will be output in the usual way.
&KNA1-UMSAT& 700.00
&KNA1-UMSAT(I)& 700.00

Time Mask
You can use the SAPscript SET TIME MASK command to format time fields in a way that differs from the
standard setting. Executing this command causes all subsequent time fields to be printed with the specified
formatting.
Syntax:
/: SET TIME MASK = 'time_mask'
The following tables provides templates may be used in the time mask:

Template Description

HH hours (two digits)


MM minutes (two digits)
SS seconds (two digits)
Any other characters occurring in the mask are interpreted as simple text and are copied directly to the
output.

Example:
Assuming the current time is 10:08:12.
&TIME& -> 10:08:12
/: SET TIME MASK = 'HH:MM'
&TIME& -> 10:08
/: SET TIME MASK = 'HH hours MM minutes'
&TIME& -> 10 hours 08 minutes
&TIME(Z)& -> 10 hours 8 minutes
You can revert to the standard setting by using the SET TIME MASK command
again with an empty string in place of the time mask:
/: SET TIME MASK = ' '

System Variables

&SAPSCRIPT-COUNTER_x& (x = 0.. 9):


These fields represent ten counter variables that you can use in your text and forms for any counting
purposes. You can use the ‘+’ and ‘-’ formatting options to increment or decrement a counter before its
value is printed. You can use the DEFINE control command to assign any specific value to a counter.
&SAPSCRIPT-DRIVER&:
SAPscript formats a text for a specific output device. The initial formatting is independent of the specific
language of this device. SAPscript then calls a driver to convert the device-independent format to device-
specific control commands. This field contains the name of the driver.
POST Postscript driver
HPL2 HP Laserjet driver for the PCL4/PCL5 languages
PRES Driver for output devices using the PRESCRIBE language
The available drivers are stored in table TSP09.
&SAPSCRIPT-SUBRC&
After executing an INCLUDE statement, this contains a value that indicates whether the INCLUDE was
found or not. This value can be queried with IF....
INCLUDE found = 0 and INCLUDE not found = 4
&SAPSCRIPT-FORMPAGES&
This contains the total number of pages output in a SAPscript form (all output between the functions
START_FORM and END_FORM). The state of the page counter on the individual form pages
(START,HOLD,INC) is not taken into account.
Erro! Estilo não definido. Erro! Estilo não definido.
Erro! Estilo não definido.

Using this symbol impairs performance, since all output data for every form
must be retained internally to fill the symbol.

The CONDENSE option cannot be used on the program icon SAPSCRIPT-


FORMPAGES (C) without an explicit length specification. This symbol is
replaced with a value only after the form has been completely edited, since
the total number of pages of a form is first known in the program function
END_FORM or CLOSE_FORM.

However, the symbol size (number of characters) is reserved correctly when


the symbol first occurs, with the current page number. Therefore, only one
character is reserved for option C (CONDENSE) on pages 1-9, two characters
on pages 10-99, and so on.

&SAPSCRIPT-JOBPAGES&
This contains the total number of pages output in a SAPscript print run (all output between the functions
OPEN_FORM and CLOSE_FORM). The state of the page counter on the individual form pages
(START,HOLD,INC) is not taken into account.

Using this symbol impairs performance, since all output data for every print
job must be retained internally to fill the symbol.

&SAPSCRIPT-TELELAND&
This contains the country identifier for the fax destination with fax output with SAPscript (field ITCPO-
TDTELELAND for the parameter OPTIONS of function OPEN_FORM).
&SAPSCRIPT-TELENUM&
This contains the local fax number for the fax destination with fax output with SAPscript (field ITCPO-
TDTELENUM for the parameter OPTIONS of function OPEN_FORM).
&SAPSCRIPT-TELENUME&
This contains the complete fax number for the fax destination with fax output with SAPscript (field ITCPO-
TDTELENUME for the parameter OPTIONS of function OPEN_FORM).
Variables of Structure SYST
All variables of structure SYST, called system variables, can be used in the form. Of particular interest are
the variables for the system date and time. These variables indicate the date and time that the output was
created. For the system date, use SYST-DATUM variable, for the system time, use SYST-UZEIT. Note that
you have the formatting options for date and time variables.

You might also like