0% found this document useful (0 votes)
981 views21 pages

Comandos SapScript

The document discusses commands in SapScript used to control positioning and sizing of boxes and lines, including the POSITION, SIZE, and BOX commands. It provides examples of using these commands to preset arguments in BOX, precisely position boxes, and relatively size boxes. Guidelines are given for using these commands in forms to ensure graphics and text are properly oriented. The NEW-PAGE and PROTECT commands are also summarized as ways to control page breaks in SapScript.

Uploaded by

marcos_sbc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
981 views21 pages

Comandos SapScript

The document discusses commands in SapScript used to control positioning and sizing of boxes and lines, including the POSITION, SIZE, and BOX commands. It provides examples of using these commands to preset arguments in BOX, precisely position boxes, and relatively size boxes. Guidelines are given for using these commands in forms to ensure graphics and text are properly oriented. The NEW-PAGE and PROTECT commands are also summarized as ways to control page breaks in SapScript.

Uploaded by

marcos_sbc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 21

Comandos de SapScript

Pre-Setting BOX Position Arguments


You can use the POSITION and SIZE commands to preset some arguments in the BOX command. POSITION
presets the start point (upper left corner) of a box or line. SIZE specifies the width and height of a box.
You can use POSITION and SIZE to preset arguments, but you can also set the start point and size arguments of a
box or line directly in the BOX command.
By default, if no positioning is specified, the upper left corner of a box or halftone or the top of a line is aligned with
current SAPscript window. That is, the upper left corner of the box, halftone, or line starts at the upper left corner of
the current window in the active form. By default, the height and width of a box are set to the height and width of the
current window.
Use POSITION and SIZE to preset the arguments in a BOX command in the following situations:
• The BOX command exceeds the 132-character (1 line in SAPscript) length limitation if you specify all
arguments directly in the command. You may exceed this length limit if, for example, you use symbols in a
command.
By pre-setting arguments with POSITION and SIZE, you can work around the limitation on the length of a
command. You do not need to specify the preset arguments in the BOX command.
• You want to use the enhanced capabilities of POSITION for adjusting the starting point of a box or line.
With BOX, you can specify an offset for the starting point only as a whole number (non-negative integer). This
command would print a box starting 1 CM to the right and 1 CM down from the left upper corner of a window:
/: BOX XPOS '1' CM YPOS '1' CM
With POSITION; you can adjust the position of a line or box relative to a window much more precisely. In the
POSITION command, you can specify positive and negative offsets and use non-integer numbers.
Example: The commands shown below position a box slightly to the left and slightly above a window. This
leaves a margin between the edge of the box and the text in the window.
/: POSITION XORIGIN '-.2' CM YORIGIN '-.2' CM
/: SIZE WIDTH '+.2' CM HEIGHT '+.2' CM
/: BOX FRAME 10 TW
(Note that the box must be enlarged to accommodate the shift. If it is not enlarged, then it will not cover all of
the window.)
You can also use POSITION to set the starting point to the upper left corner of the active page format. Example:
POSITION PAGE moves the starting point from the active window to the active page format.
• You want to use the relative sizing capabilities of SIZE to adjust the size of a box, line, or halftone.
With BOX, you can make only absolute size specifications. BOX HEIGHT, for example, overrides the default
height setting to the height of the current window.
With SIZE, you can adjust the size of a box or a line with respect to its previously-set dimensions. The
following commands would, for example, draw a frame 1 CM in from the margins of the paper:
/: POSITION PAGE
/: POSITION XORIGIN 1 CM YORIGIN 1 CM
/: SIZE PAGE
/: SIZE HEIGHT '-2' CM WIDTH '-2' CM

Using the Commands in Texts and Forms


Since BOX, POSITION, and SIZE are text commands, you can insert them directly in a text. However, usually you
use these commands in forms, where you have better control of how a box or line and the accompanying text fit
together. SAPscript does not automatically fill text into a box or otherwise orient text with respect to these graphical
elements.

Enter the following line as a command in text in a SAPscript document. The command draws a box of 17.5
CM length, 1 CM high, with 10% shading:
/: BOX WIDTH '17.5' CM HEIGHT '1' CM INTENSITY 10
The left upper corner of the box is located at the left upper corner of the main window defined in the form
of the document. The text that you type in is not automatically oriented in accordance with the box.
Whether the text fits in the box or not depends on you. If you type in three lines of text, then the bottom line
of text is likely to appear below the bottom of the box.
In a form, you can orient both text and graphical elements in the windows that you define. You therefore have much
better control of how graphics and text fit together

Tips and Guidelines


To ensure in forms that boxes, lines, and shading fit correctly with text, follow these guidelines:
• In your form design, match graphical elements and windows to each other. By default, a box defined in a
window has the dimensions and starting point of the window.
Defining a window for each graphical element that you want to include facilitates using boxes, lines, and
shading, since the graphical element and the window have the same dimensions and positioning.
Example: If a window is defined with the dimensions 6 CM high and 8 CM wide, then this statement in the text
element of the window paints a 10 halftone with the same dimensions. The shading is oriented on the upper left
corner of the window.
/: BOX INTENSITY 10
• Use the POSITION command to adjust the position of a box or line relative to a window.
For example, these commands in a form window would allow more room above the first line of text in the
window. The box would start 0.2 CM above the top of the window.
/: POSITION YORIGIN '-0.2' CM
/: SIZE HEIGHT '+0.2' CM
/: BOX INTENSITY 5
Make sure to increase the size of the box to accommodate an offset. Otherwise, the box will not cover all of the
window.
In the example above, the SIZE command increases the height of the box by 0.2 CM to accommodate the
positioning of the box above the window.
• Draw a horizontal line by setting the HEIGHT in a BOX command to 0. Draw a vertical line by setting
WIDTH to 0.
/: BOX FRAME 10 TW WIDTH 0 TW HEIGHT '10' CM
Vertical line 10 CM long
/: BOX FRAME 10 TW WIDTH '10' CM HEIGHT 0 TW
Horizontal line 10 CM long
• Adjust the tabs in a window to match the position of lines and boxes.
For example, you define a table with the commands shown below. The vertical lines in the table are drawn in at
10 CM and 13.5 CM from the left edge of the window:
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: 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
In the paragraph formats that you use to fill the table, you would define tabs at the positions shown below. With
these tabs, your input would start right-justified in the first, second, and third columns of the table. You must
ensure that your input is not too long to fit in the columns defined with the lines:
Format TB Fill table
Tabs: 1 9.5 CM RIGHT
2 13.0 CM RIGHT
3 17.0 CM RIGHT

Explicit Page Break: NEW-PAGE


SAPscript automatically inserts a page break when the main window of a page (MAIN) is full. You can use the
NEW-PAGE command to force a page break in the text at any point you want one. The text following this command
then appears on a new page. The page break is always performed (it is an unconditional page break).
The NEW-PAGE command completes the current page. This means that all the windows that are still on the page
are printed immediately. If you use the NEW-PAGE command without parameters, the page defined in the current
form as the next page will be taken next. If, however, your form contains a number of different pages, then you can
specify any one of these as the next page to be used.
Syntax:
/: NEW-PAGE [page_name]

/: NEW-PAGE
The current page will be completed and the text in the following lines will be written to the page specified
in the form.
/: NEW-PAGE S1
As above, except that the page S1 will be taken as the next page.

• If, in a NEW-PAGE command, you specify a page not contained in the form, the
specification is ignored.
• Take care that there are no blank lines immediately before a NEW-PAGE command. If an
implicit page break occurs within the blank lines, an unexpected blank page may be printed

Preventing Page Breaks: PROTECT


You can specify, either in the style or in the form, that a particular paragraph should not be split in two by a page
break. If this page protect attribute is set, then the complete paragraph is always printed on one page. This property
applies only to that particular paragraph.
This attribute is not intended to be used to protect all paragraphs against a page break. The point is that a page break
is by its very nature a dynamic event and the exact point at which it occurs depends on the current state (length and
contents) of the preceding text. It is also possible that you may want to protect only certain parts of a paragraph
against a page break. One way to achieve this is to use the NEW-PAGE command immediately before the text
concerned starts. Explicitly beginning a new page at this point should ensure that a further page break does not occur
within the text. However, this technique is not change-friendly. For example, you format your text with the help of
the NEW-PAGE command so that no page breaks occur where they should not. At a later time, you insert or delete
some lines. These changes cause all the subsequent text to be moved relative to the printed page, and you must check
each NEW-PAGE command you previously inserted to see if it is still in the correct place.
To allow you to define the areas to be protected against a page break on an individual basis, SAPscript provides the
PROTECT.. ENDPROTECT command pair. If you enclose the text to be protected in these commands, then
SAPscript will ensure that each line of this text is printed together on the same page. If the complete text fits in the
space remaining on the current page, then it is printed on this page just as it would be if no PROTECT command had
been used. If, however, the remaining space is not sufficient for the text, then the PROTECT command has the same
effect as a NEW-PAGE command and text is printed on a new page.
Thus the PROTECT/ENDPROTECT commands may be regarded as a kind of conditional NEW-PAGE command,
the condition being whether or not the lines enclosed between the two commands fit in the space remaining in the
current main window.
Syntax:
/: PROTECT
:
:
/: ENDPROTECT
The text lines to be protected are enclosed between the two commands.

• An ENDPROTECT command without a preceding PROTECT command has no effect.


• If the terminating ENDPROTECT is missing, SAPscript assumes it at the end of the text.
• PROTECT.. ENDPROTECT command pairs cannot be nested. If a second PROTECT
command occurs before the first one has been terminated by an ENDPROTECT, it is ignored.
• If the text enclosed by a PROTECT.. ENDPROTECT pair is itself too long for a single
page, then a page break is generated immediately before the text and the text is printed in the
normal way. It is then unavoidable that a page break will occur at some point within the text.

Next Main Window: NEW-WINDOW


Each page can consist of up to 99 main windows. Each main window is assigned a consecutive identifying number
(0..98), and the windows are filled in this order. This feature enables SAPscript to print labels and to output multi-
column text. When one main window fills up, the next main window on that page is taken, if there is a next one. A
page break is inserted after the last main window.
You can use the NEW-WINDOW command to call the next main window explicitly, even if the current main
window is not yet full. If you are in the last main window of the page, the command has the same effect as the
NEW-PAGE command.
Syntax:
/: NEW-WINDOW

Assigning a Value to a Text Symbol: DEFINE Text symbols acquire their values as a result of explicit assignment.
To interactively assign text symbols, in the text editor choose Include ® Symbols ® Text. This method is available
for all text symbols belonging to a text module as well as those of the associated form.
Values defined in this way are lost when the transaction is left. If you want to print the text module again, then you
must enter the symbol values again. The purpose of the DEFINE command is to provide a means of making this
value assignment a permanent part of the text, so that the values are available again when the text module is called
again. This command can also be used to re-assign a new value to a text symbol half-way through the text.
Syntax:
/: DEFINE &symbol_name& = 'value'

/: DEFINE &subject& = 'Your letter of 7/3/95'


The value assigned can have a maximal length of 60 characters. It may itself contain other symbols. A
symbol contained within the value assigned to another symbol is not replaced with its own value at the
point at which the DEFINE command is executed. Rather, this replacement is made when the symbol
defined in the DEFINE command is called in the text.

/: DEFINE &symbol1& = 'mail'


/: DEFINE &symbol2& = 'SAP&symbol1&'
/: DEFINE &symbol1& = 'script'
&symbol2& -> SAPscript
If, however, the DEFINE command is written using the ':=' character rather than the '=' character, then any
symbol contained within the value being assigned is replaced immediately with its current value. The
assignment to the target symbol is made only after all symbols in the value string are replaced with their
values. The total length of the value string may not exceed 80 characters. The target symbol must be a text
symbol, as before.

/: DEFINE &symbol1& = 'mail'


/: DEFINE &symbol2& := 'SAP&symbol1&'
/: DEFINE &symbol1& = 'script'
&symbol2& -> SAPmail

Formatting Date Fields: SET DATE MASK


To define the formatting of date fields, use the SET DATE MASK control command. Executing this command
causes all subsequent date fields to be printed using the specified format.
Syntax:
/: SET DATE MASK = 'date_mask'
In the date mask, you can use the following codes:
• DD: day (two digits)
• DDD: day name - abbreviated
• DDDD: day name - written out in full
• MM: month (two digits)
• MMM: month name - abbreviated
• MMMM: month name - 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)
All other characters found in a date mask are interpreted as simple text and are copied straight into the output.
Assuming the current system date is March 1st, 1997.
/: SET DATE MASK = 'Foster City, MM/DD/YY'
&DATE& -> Foster City, 03/01/97
/: SET DATE MASK = 'MMMM DD, YYYY'
&DATE& -> March 01, 1997
The date mask may be reset to the default setting by using an empty string:
/: SET DATE MASK = ' '
The abbreviated and full forms of the names of the days and months are stored in the language dependent TTDTG
table under the following keys:
• %%SAPSCRIPT_DDD_dd: abbreviated day name
• %%SAPSCRIPT_DDDD_dd: full form of day name
• %%SAPSCRIPT_MMM_mm: abbreviated month name
• %%SAPSCRIPT_MMMM_mm: full form of month name
dd: day number 01 = Monday,..., 07 = Sunday
mm: month number 01 = January,..., 12 = December

Formatting Time Fields: SET TIME MASK


To format time fields to your needs, use the SET TIME MASK control command. Executing this command causes
all subsequent time fields to be printed using the specified format.
Syntax:
/: SET TIME MASK = 'time_mask'
In the time mask, you can use the following codes:
• HH hours (two digits)
• MM minutes (two digits)
• SS seconds (two digits)
All other characters found in a time mask are interpreted as simple text and are copied straight into the output.

Assuming the current time is 10:08:12,


/: SET TIME MASK = 'HH:MM'
&TIME& -> 10:08
/: SET TIME MASK = 'HH hours MM minutes'
&TIME& -> 10 hours 08 minutes
The time mask may be reset to the default setting by using an empty string:
/: SET TIME MASK = ' '

Country-Dependent Formatting: SET COUNTRY


The formatting for certain field types depends on the country settings. These field types include, for example, date
fields and number fields that include either a decimal point or the ‘thousands’ separator character. The formatting
options defined in the user master record are usually the ones used here. To choose a formatting option other than
the one specified in the user master record, use the SET COUNTRY control command. The country-dependent
formatting options are stored in the T005X table.
Syntax:
/: SET COUNTRY country_key
You can enter the country key either as a literal value enclosed in quotes or as a symbol.

/: SET COUNTRY 'CAN'


/: SET COUNTRY &country_key&
Use a blank country name to revert to the setting found in the user master record:
/: SET COUNTRY ' '
This SAPscript command actually calls the corresponding ABAP command internally. This guarantees the
effect of the SAPscript command to be identical with that of the ABAP command.

If the formatting turns out not to be as required, then you should check the settings in table T005X.

Position of the Leading Sign: SET SIGN


The usual convention in business applications is to show the leading sign to the right of the figure to which it
applies. However, it is sometimes necessary to show the leading sign to the left of the figure. To set the sign
explicitly, use the SET SIGN control command. Executing this command affects the formatting of all subsequent
program symbols that possess a leading sign.
Syntax:
/: SET SIGN LEFT
The leading sign appears to the left of the number.
/: SET SIGN RIGHT
The leading sign appears to the right of the number.
Initializing Numbered Paragraphs: RESET
To reset the numbering of an outline paragraph to its initial value, use the RESET control command. If you do not
use the RESET command, then the numbering of all outline paragraphs in a text is continuous. If you specify the
name of an outline paragraph in the RESET command, then its paragraph numbering and that of subordinate
paragraphs is reinitialized.
Syntax:
/: RESET paragraph_format
The paragraph format specifies the outline paragraph to be reset.

Assume that the paragraph N1 is defined in the style you are using. This kind of paragraph is intended for
enumerated lists and causes a sequential number to be printed.
* Proceed as follows if you want to work with the SAP R/3
system:
N1 Ensure that you have a PC
N1 Switch the PC on
N1 Click on the SAP icon using the mouse.
* You will then enter the SAP logon screen. In order to log
on here, you must carry out the following actions:
/: RESET N1
N1 Enter your user name
N1 Enter your password
N1 Select the application you want to use
This text specification would be output as follows:
Proceed as follows if you want to work with the SAP R/3
system:
1. Ensure that you have a PC
2. Switch the PC on
3. Click on the SAP icon using the mouse.
You will then enter the SAP logon screen. In order to log on here, you must carry out the following actions:
1. Enter your user name
2. Enter your password
3. Select the application you want to use
If there is no RESET command between the two sections, then the two lists would be numbered in a single
sequence:
Proceed as follows if you want to work with the SAP R/3
system:
1. Ensure that you have a PC
2. Switch the PC on
3. Click on the SAP icon using the mouse.
You will then enter the SAP logon screen. In order to log on here, you must carry out the
following actions:
4. Enter your user name
5. Enter your password
6. Select the application you want to use

Including Other Texts: INCLUDE To include the contents of another text into the current text, use the INCLUDE
control command. SAPscript still treats the text to be included as a separate text. The text is copied over only at the
point at which the output is formatted.
Thus the use of the INCLUDE command always ensures that the most current version of a text is included into the
output, since the text is not read and inserted until the output is formatted.
Syntax:
/: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p]
[NEW-PARAGRAPH np]
You must specify the name of the text to be inserted. It can be up to 70 characters long. If the name of the text
contains spaces, then you must enclose it in quotes as a literal value. You can, alternatively, specify the name via a
symbol. All remaining parameters in the INCLUDE command are optional. If an optional parameter is not specified,
then SAPscript uses default values as applicable for the calling environment.
/: 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 of the calling
text. The paragraph format A1 will be used as the standard paragraph type for this call.
Optional parameters:
• LANGUAGE
If this parameter is not specified, then the language of the calling text or the form language are used for the text
to be included. If the language is specified, then the text will be fetched in this language, regardless of the
language of the calling text.
• PARAGRAPH
The text to be included is formatted using the style allocated. The PARAGRAPH parameter can be used to
redefine the standard paragraph for this style for the current call. All *-paragraphs in the included text will then
be formatted using the paragraph specified here.
• NEW-PARAGRAPH
The first line of the text to be included will be given this format indicator, as long as it is not a comment or
command line. If the optional PARAGRAPH parameter (see above) is not specified, then all *-paragraphs of the
included text will also be formatted using the paragraph specified in the NEW-PARAGRAPH command.
• OBJECT
In order to completely specify a text, information about the text object is also required. There are a number of
restrictions and other rules that depend on the object type of the calling text:
• Any kind of text can be included in a form. If no object is specified, then TEXT will be
used (standard texts).
• In the case of a document text (DOKU object), you can include only document texts. This
object type is also assumed if no object is specified in this environment.
• Only hypertexts and document texts can be included in a hypertext (DSYS object). If the
OBJECT parameter is missing, then DSYS is used as the default value.
• In the other kinds of text you can include only standard texts (TEXT object), document
texts or hypertexts. If there is no specification, then the default object is TEXT.
• ID
The text ID is a part of the text key, which permits further text objects within a given object. If no ID is
specified, then the default include ID is used from the TTXID table for the calling text. If there is no entry in
this table, then the text ID of the calling text is used.
The following consistency check is applied both to the ID and the object:
• All text IDs are allowed in a form.
• In document texts, only document texts may be included that have text IDs TX (general texts) or UO
(authorization objects) and also other document texts with the same text ID as the calling document text.
• In DSYS texts, all DSYS texts can be included, whatever ID they have. Document texts to be included must
have one of the IDs TX or UO.
• Into the other texts, standard texts with any allowable text ID, DSYS texts with all IDs, and document texts
with the IDs TX and UO can be included.
The INCLUDE command returns a status code in the SAPSCRIPT-SUBRC symbol:
• 0: the text include was successful.
• 1: the command could not be executed because it contained syntax errors.
• 2: the rules governing the text to be included were not followed (see above).
This value cannot occur if the command is used in a SAPscript form.
• 4: the specified text could not be found.

Changing the Style: STYLE


The STYLE control command allows you to change the style within a text. The new style is in force until another
STYLE command is issued. If you specify * as the name of the style, then the system reverts to the default
paragraph of the original style or form.
Syntax:
/: STYLE style [DOMINANT]
/: STYLE *
A style set with this command has no effect in a text included with INCLUDE. The system takes the paragraph and
character formats from the calling text. To use the style set with STYLE in the INCLUDE text as well, you must add
DOMINANT to the command.

If the INCLUDE text has a style assigned to it, in both cases, the system always takes the paragraph and
character formats from the directly assigned style.

Formatting Addresses: ADDRESS The ADDRESS - ENDADDRESS control command formats an address
according to the postal convention of the recipient country defined in the COUNTRY parameter. The reference
fields are described in the structures ADRS1, ADRS2, or ADRS3, depending on the type of address. Either direct
values or symbols may be assigned to the parameters.
Syntax:
/: ADDRESS [DELIVERY] [TYPE t] [PARAGRAPH a] [PRIORITY p] [LINES l]
/: TITLE title
/: NAME name1[,name2[,name3[,name4]]]
/: PERSON name of natural person [TITLE form of address]
/: PERSONNUMBER number of the personen
/: DEPARTMENT department
/: STREET street name HOUSE house number
/: LOCATION additional location information
/: POBOX po box [CODE post code / zip code] [CITY city]
/: POSTCODE post code / zip_code
/: CITY city1[,city2]
/: NO_UPPERCASE_FOR_CITY
/: REGION county / state
/: COUNTRY recipient country [LANGUAGE language code]
/: COUNTRY_IN_REC_LANG
/: LANG_FOR_COUNTRY language key
/: FROMCOUNTRY sender country
/: ADDRESSNUMBER address number
/: ENDADDRESS
The parameter values contain both formatting and address information. The address data are formatted for output
according to the data in the following parameters:
• TYPE
• FROMCOUNTRY
• COUNTRY
• LANGUAGE
• PRIORITY
• DELIVERY
• LINES
For more information, see the documentation for the SAP function module ADDRESS_INTO_PRINTFORM.
If DELIVERY is not specified and if a POBOX is specified, then the POBOX is used in an address instead of a
STREET.
Parameters
• DELIVERY
Means that the address should be formatted as a complete delivery address, using the street name and number
rather than the P.O. Box.
• TYPE
Specifies the type of address. The following types are possible:
4. Normal address (ADRS1). This is the address of a company or organization. It corresponds to the
address structure that is expected in most SAP applications.
5. Private or personal address (ADRS2). This is the address of a natural person, a private or home
address.
6. Company addressDienstadresse (ADRS3) with contact person. This is the address of a colleague
or contact within a company or organization. The company name should be specified in the TITLE
and NAME fields; the ATTN: contact person should be named in PERSON and TITLE.
Should you enter another address type or leave the field blank, then type 1 is used for formatting.
• PARAGRAPH
Specifies the paragraph format to be used for outputting the address. If this parameter is not given, the address
will be output using the default paragraph format.
• PRIORITY
Specifies which of the address lines may be omitted should this be necessary. Any combination of the following
codes may be specified. The order in which you list the codes determines the order in which address lines are
left out.
The codes are as follows:
A Title
P Mandatory empty line
4 Name4
3 Name3
R Region
T Neighborhood, administrative section of a city (CITY2)l
D Department
L Country name
C Post code or zip code
2 Name2
B P.O. Box (Japan only)
S Street name and number or P.O. Box, depending upon DELIVERY parameter
N Name and form of address of natural person (PERSON and TITLE)
I Location information in LOCATION
O City
• LINES
Specifies how many lines may be used for formatting the address. If there are too few lines available to allow all
the address data to be formatted, then the data specified in the PRIORITY parameter are omitted. If there is no
LINES parameter and if this command is in a form window of a type other than MAIN, then the number of lines
available for formatting the address are automatically calculated based on the current output position and the
size of the window.
• TITLE
Title or form of address. Used only with addresses of types 1 and 3.
• NAME
Up to four names may be given, separated by commas. Used only with addresses of types 1 and 3.
• PERSON
Name of the addressee. Used only for addresses of type 2 (private or personal address) or type 3 (company
contact address). In type 3 addresses, use PERSON for the name of your contact person: ‘Attn: Mr. Jeffries’.
The name fields should be used for the company address.
• PERSONNUMBER
Personal number. Can be used only for address types 2 or 3 (private or personal address).
• TITLE (with PERSON)
Title of the addressee. Can be used only for address types 2 or type 3 (private or personal address).
• DEPARTMENT
Department of the addressee. Can be used only for address type 3 (company address).
• STREET
Street name.
• HOUSE
House number for the corresponding street.
• LOCATION
Additional location information, such as the building, "Upstairs Apartment" and so on. Appears on its own line
in the address.
• POBOX
P. O. Box
• CODE
The post code / zip code of the P. O. Box if this differs from the post code / zip code of the recipient.
• CITY
The city in which the destination P.O. Box is located if this differs from the city of the recipient.
• POSTCODE
Post code / zip code of the recipient.
• CITY
Addressee’s city. city1 is expected to be the city; city2 is the neighborhood or administrative section, if
required.
• NO_UPPERCASE_FOR_CITY
Default = NO_UPPERCASE_FOR_CITY ‘ ‘
Usually, the system prints the city and country names of foreign addresses in uppercase (
NO_UPPERCASE_FOR_CITY ‘ ‘ ).
You can use this parameter to force the system to output city and country name unchanged
(uppercase/lowercase).
( NO_UPPERCASE_FOR_CITY ‘X’ )
• REGION
This allows an administrative region, county, province, or state etc. to be specified.
• COUNTRY
Specifies the recipient country, i.e. the country according to whose postal conventions the address is to be
formatted.
• COUNTRY_IN_REC_LANG
This flag tells the system to use the recipient language for the country name.
( COUNTRY_IN_REC_LANG ‘X‘ )
( Default: Recipient language is not used: COUNTRY_IN_REC_LANG ‘ ‘ )
• LANG_FOR_COUNTRY
Default = Space
Use this parameter to explicitly set the language in which to print the country name of a foreign address. By
default, the system uses the language of the sending country.
• LANGUAGE
Language code of the language of the recipient country, if it differs from that of the recipient COUNTRY.
Example: addresses in Switzerland. Standard SAP language codes are used; you can display these in the initial
SAPscript text processing screen or in table T002.
• FROMCOUNTRY
Specifies the language to be used for formatting the name of the recipient country. For most European countries,
the recipient country is specified by placing the international car registration letters in front of the post code and
separating them from the post code with a hyphen. You must always specify the sender country.
• ADDRESSNUMBER
The number is used to index a central address file, from which the desired address is read instead of using the
set of the above fields. You can find more information on this facility in the documentation for the function
module ADDRESS_INTO_PRINTFORM.

You use this one parameter instead of the set of parameters described before.

/: ADDRESS
/: TITLE 'Firma'
/: NAME 'Schneider & Co', 'Finanzberatung'
/: STREET 'Kapitalgasse 33'
/: POBOX '12345' CODE '68499'
/: POSTCODE '68309'
/: CITY 'Mannheim'
/: COUNTRY 'DE'
/: FROMCOUNTRY 'DE'
/: ENDADDRESS
This produces the following output address:
Firma
Schneider & Co
Finanzberatung
Postfach 12345

68499 Mannheim
If the DELIVERY parameter is specified on the ADDRESS command, then the street name and number
will appear in the address in place of the P. O. Box number.
Firma
Schneider & Co
Finanzberatung
Kapitalgasse 33

68309 Mannheim

SAPscript makes an internal call to the ADDRESS_INTO_PRINTFORM function module for formatting
the address. If the result is not as expected, you should check the settings for this function module (see the
function module documentation).

Setting a Header Text in the Main Window: TOP


You can use the TOP.. ENDTOP control command to specify lines of text that you want to print always at the top of
the main window. These text lines are also known as header texts. For example, you would use header texts in the
case of a very long table covering several pages of output to ensure that the table heading information were repeated
at the start of each new page of output.
Syntax:
/: TOP
:
:
/: ENDTOP
The lines of text enclosed between the two control commands will be output from now on at the start of the main
window.
An existing header text can be disabled by using the TOP.. ENDTOP command pair without enclosing any text lines
between the two command lines:
/: TOP
/: ENDTOP
Subsequent pages will contain no header text.

• If the main window already contains some output then a newly specified header text takes
effect on the next page only.
• The same applies to the deletion of a header text. If a header text has already been output
on the current page then it cannot be retracted.
• Header texts should not be employed in texts that are printed from applications programs,
such as reminder texts, order texts. These applications programs can also work with header
texts via the form interface, which may lead to unexpected results.

Setting a Footer Text in the Main Window: BOTTOM


You can specify footer texts for the main window in a similar way to header texts. Footer texts are always printed at
the bottom of the window.
Syntax:
/: BOTTOM
:
:
/: ENDBOTTOM
The lines of text enclosed between the two control commands will be output from now on at the bottom of the main
window.
An existing footer text can be disabled by using the BOTTOM.. ENDBOTTOM command pair without enclosing
any text lines between the two command lines:
/: BOTTOM
/: ENDBOTTOM
This and subsequent pages will contain no footer text.

• Assuming there is still sufficient space in the main window, a newly specified footer text
will also be printed on the current page.
• Footer texts should not be employed in texts that are printed from applications programs,
such as reminder texts, order texts. These applications programs can also work with footer
texts via the form interface, which may lead to unexpected results.

Conditional Text: IF
You can use the IF control command to specify that text lines should be printed only when certain conditions are
met. If the logical expression contained within the IF command is true, then the text lines enclosed by the IF...
ENDIF command pair are printed. Otherwise they are ignored.
Syntax:
/: IF condition
:
:
/: ENDIF
The logical expression can use the following comparison operators:
= EQ equal to
< LT less than
> GT greater than
<= LE less than or equal to
>= GE greater than or equal to
<> NE not equal to
The following logical operators can be used to combine conditions:
• NOT
• AND
• OR
Evaluation of both the individual logical expressions and of the combinations of expressions is performed strictly
from left to right. There are no precedence rules. Bracketed expressions are not supported.
The comparison is always performed on literal values, that is, the symbols are formatted as character strings before
they are compared. This is particularly significant in the case of program symbols, because the formatting of these
may depend on various parameters. For example, the formatted form of a currency field employs a variable number
of decimal places and a variable ‘decimal point’ symbol (a period or a comma) depending on the applicable currency
key.
You can extend the IF command with the ELSE command to allow text lines to be specified that you want to print in
case the condition is false. If the condition is true, the text lines enclosed by the IF and ELSE commands are
formatted; otherwise the text lines enclosed by the ELSE and ENDIF commands are formatted.
Syntax:
/: IF condition
:
/: ELSE
:
/: ENDIF
The ELSEIF command allows you to specify multiple cases.
Syntax:
/: IF condition
:
/: ELSEIF condition
:
/: ELSE
:
/: ENDIF
You can use any number of ELSEIF commands within one compound IF.. ENDIF control command. The use of an
ELSE command is then optional.

• You must not extend a condition over more than one line. Both the IF or ELSEIF
command and the attached condition must be completely contained within a single line.
• You can nest IF commands.
• You must terminate an IF command with an ENDIF command. If you forget this, there
will be no more output following the IF command if the condition is false.
• If a syntax error occurs in the interpretation of this command, then the command is not
executed. This may have an unexpected effect on the subsequent text output. For example, if
the IF statement is incorrect, then all following ELSEIF and ELSE commands will be ignored,
since the opening IF command is ‘missing’. This will cause all the text lines attached to the
ELSEIF and ELSE commands to be printed.

Finding a Match: CASE


The CASE command covers a special case of the multiple case IF command. Rather than allowing an arbitrary
condition to be tested in each of the individual cases (as in the general multiple case IF command), the CASE
command allows a given symbol to be tested against specific values until a matching value is found.
Syntax:
/: CASE symbol
/: WHEN value1
:
/: WHEN value2
:
/: WHEN valuen
:
/: WHEN OTHERS.
:
/: ENDCASE
The symbol in the CASE line is formatted. If its value is found in one of the WHEN lines, then the text lines
following this WHEN line are printed. If no matching value is found then the text lines enclosed by the WHEN
OTHERS line and the ENDCASE command are printed. The WHEN OTHERS section is optional.
As with the IF command, the comparison is always performed on literal values.

• A CASE command must be terminated by an ENDCASE command.


• The WHEN OTHERS section is optional.

Calling ABAP Subroutines: PERFORM


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.
The system does not execute the PERFORM command within SAPscript replace modules, such as
TEXT_SYMBOL_REPLACE or TEXT_INCLUDE_REPLACE. The replace modules can only replace
symbol values or resolve include texts, but not interpret SAPscript control commands.
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.

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.

DATA: PAGNUM LIKE SY-TABIX, "page number


NEXTPAGE LIKE SY-TABIX. "number of next page

READ TABLE IN_PAR WITH KEY ‘PAGE’.


CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.


CHECK SY-SUBRC = 0.

NEXTPAGE = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY ‘BARCODE’.


CHECK SY-SUBRC = 0.

IF PAGNUM = 1.
OUT_PAR-VALUE = ‘|’. "First page
ELSE.
OUT_PAR-VALUE = ‘||’. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = ‘L’. "Flag: last page
ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.


ENDFORM.

Summing a Program Symbol: SUMMING


The SUMMING command is used for accumulating a total value for a program symbol. The command should be
specified just once. Then, each time the specified program symbol is formatted, its current value is added into the
total symbol. Several program symbols may all be added into a single total symbol.
Syntax:
/: SUMMING program_symbol INTO total_symbol
SAPscript cannot create the field for the total dynamically. The summing symbol used for totalling must be declared
with TABLES in the ABAP program. Otherwise, only zero is added. Declaring the symbol with the DATA
statement is not sufficient (global data).

For details on summing and carrying forward, see Summing and Carrying Forward is Incorrect.

Current Date
&DATE& The current date is displayed. It is formatted according to the specifications found in the user master
data. You can adapt this format to your own requirements by specifying a date mask (SET DATE
MASK) or by using a country-specific formatting option (SET COUNTRY).
The current value for this symbol is taken from the SY-DATUM field. This value is not copied
every time that the date is called, but only at the following times:
• When printing starts (OPEN_FORM, PRINT_TEXT)
• When symbols are replaced in the text editor
• When a text is exported in the ASCII or RTF format
• When the TEXT_SYMBOL_REPLACE function module is called (optional)

Current Day Number


&DAY& The current day number is printed. The display includes leading zeros.

Current Month Number


&MONTH& The current month number is printed. The display includes leading zeros.

Current Year Number


&YEAR& This symbol is used to print the current year as a four digit number.

Current Day Name (Long Form)


&NAME_OF_DAY& The name of the current day is written out in full. The language used for the output is
determined by the appropriate text language or form language. The names of the days
are stored in the TTDTG table under the key %%SAPSCRIPT_DDDD_dd, where dd is
the day number (01= Monday,.., 07 = Sunday).

Current Month Name (Long Form)


&NAME_OF_MONTH& The name of the current month is written out in full. The language used for the output is
determined by the appropriate text language or form language. The names of the
months are stored in the TTDTG table under the key %%SAPSCRIPT_MMMM_mm,
where mm is the month number (01,.., 12).

Current Time
&TIME& The current time is printed in the form hours:minutes:seconds. Each of the components for hours,
minutes, and seconds consists of two digits, using a leading zero if necessary. You can adapt this
format to your own requirements by specifying a time mask (SET TIME MASK).
The value for the time field is taken from the SY-UZEIT field. This value can be copied over only at
particular times (c.f. DATE ).

Hours Component of Current Time


&HOURS& The component of the current time referring to hours is printed. The display includes leading
zeros.

Minutes Component of Current Time


&MINUTES& The component of the current time referring to minutes is printed. The display includes leading
zeros.

Seconds Component of Current Time


&SECONDS& The component of the current time referring to seconds is printed. The display includes leading
zeros.

Current Page Number


&PAGE& You can use this symbol to insert into the text the page number that the current page will have
when printed. You can specify the formatting option for the page number in the form for each
page type.

Page Number of the Next Page


&NEXTPAGE& This symbol is used to print the number of the following page. The output format is the same as
with &PAGE& .
Note that on the last page of the output, in each window that is not of type MAIN,
&NEXTPAGE& has the value 0.

Selected Device Type


&DEVICE& The &DEVICE& symbol is used to print the type of the output device. This type is passed in the
DEVICE parameter when the SAPscript output (OPEN_FORM, PRINT_TEXT) is started, and it
specifies the device for which the output should be formatted.
Possible values are:
PRINTER
SCREEN
TELEX
TELEFAX
ABAP (ABAP list display)

Spaces
&SPACE& You can use this symbol to generate a string of space characters. You must pass the number of space
characters required with the symbol. If you leave out the number, then no spaces are printed.

Underline
&ULINE& You can use this symbol to insert a string of underline characters into the output text. You must pass
the number of underline characters required with the symbol. If you leave out the number, then just
one underline character is printed.

Vertical Line
&VLINE& You can use this symbol to insert a string of vertical line characters into the output text. You must
pass the number of vertical line characters required with the symbol. If you leave out the number,
then just one vertical line character is printed.

Output Length
If you need only a part of the symbol value, or the output has to fit into a box or a field on the screen without
overlapping the edges of this area, then you can use an output length specification to define how many bytes of the
value should be copied.
Syntax
&symbol(length)&

If < symbol> has the value 123456789.


&symbol(3)& -> 123
&symbol(7)& -> 1234567
You can combine an output length specification with an offset specification. The specified length is then
counted from the specified offset position.
&symbol+4(3)& -> 567
If a length specified is greater than the current length of the value, then spaces are appended to the symbol value.
You can use the character * to specify the length of a program symbol. The value of the symbol is then printed using
the output length defined in the ABAP Dictionary.
Syntax
&symbol(*)&

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

Omitting the Leading Sign


Program symbols with numeric values can have a leading sign. This sign usually appears to the right of the numeric
value, either as a space for positive numbers, or as a minus sign for negative numbers . You can use t he S option to
ensure that the value is formatted without the sign .
Syntax
&symbol(S)&

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 Leading Zeros
Certain symbol values are printed with leading zeros. If you want to suppress these, use the Z option.
Syntax
&symbol(Z)&

Assuming the current date is 1.1.1994,


&DAY& -> 01
&DAY(Z)& -> 1

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 has the effect of replacing each string of space characters with a single space and shifting
the ‘words’ to the left as necessary to close up the gaps. Leading spaces are completely removed. The results are the
same as those of the ABAP command CONDENSE.
Syntax:
&symbol(C)&

Assuming ' Albert Einstein ' is the symbol value,


&symbol& -> Albert Einstein
&symbol(C)& -> Albert Einstein

Number of Decimal Places


A program symbol of one of the data types DEC, QUAN, and FLTP can contain decimal place data. Use the option
below to override the Dictionary definition for the number of decimal places for the formatting of this symbol value.
Syntax
&symbol(.N)&

The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 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
Omitting the Separator for ‘Thousands’ Symbols of the DEC, CURR, INT, and QUAN data types are normally
formatted with the a ‘thousands’ separator character. The T option allows you to omit this separator character.
Syntax:
&symbol(T)&

The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 decimal places
and an output length of 17.
&EKPO-MENGE& -> 1,234.560
&EKPO-MENGE(T)& -> 1234.560
Right-Justified Output Symbol values other than numeric values are normally formatted left-justified. To specify
right-justified formatting, use the R option. You must use this option in conjunction with an output length
specification.
Syntax
&symbol(R)&

If symbol has the value 1234.


&symbol& -> 1234
&symbol(8R) -> 1234
For program symbols, the length specification contained in the Dictionary definition may be used instead of an
explicit length.
Suppressing Output of Initial Values
Use the I option to suppress the output of symbols that still contain their initial values.
Syntax
&symbol(I)&

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


&KNA1-UMSAT& -> 0,00
&KNA1-UMSAT(I)& ->
If the field contains an amount other than 0, this value is printed in the normal way.
&KNA1-UMSAT& -> 700,00
&KNA1-UMSAT(I)& -> 700,00

Changing the Value of a Counter You can increase or decrease the value of a 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.

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

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 templates may be used in the date mask:
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.

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 = '
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 templates may be used in the time mask:
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.

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 = ' '
Administering Graphics
Use
Use the SAPscript Graphics Administration to import, administer, transport, and preview graphics before printing.
Features
In the navigation tree, you can go to any imported graphic. Up to Release 4.6, the graphics were stored as standard
texts. This is obsolete now. As of Release 4.6, graphics are stored on a document server. In addition to *.TIF files,
you can now import *.BMP graphics files as well.
Activities
Choose Utilities ® SAPscript ® Administration ® Graphic.
The dialog window for administering graphics appears.
To import graphics, choose Graphic ® Import.
Before you can continue with other functions, select an appropriate node in the navigation tree and specify the name
and the attributes of the corresponding graphic. To find graphics, use F4 help.
To transport graphics, choose Graphic ® Transport.
To display screen information, choose Graphic ® Screen information.
To display the print preview, choose Graphic ® Print preview.

You might also like