control commands

42
8/8/2019 Control Commands http://slidepdf.com/reader/full/control-commands 1/42 $ 3 3 ( 1 ' , ; lZi|\\z} h~~ The functionality of the SAPscript editor is determined by a number of commands, which you can either choose from the m enu 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.

Upload: kkamalk

Post on 09-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 1/42

$ 3 3 ( 1 ' , ;

Z lZi|\\z}

h~~

The fun ctionality of the SAPscript ed itor is determined by a n um ber

of comm and s, which you can either choose from the m enu or call with

function keys. These comman ds ed it the text in the ed itor based on

your requirements, and comma nd s are immed iately executed .

In contrast, SAPscript recognizes another typ e of comm and s, the

control comman ds, wh ich:

n  Correspond ingly influence the outp ut formatting

n  Are not interp reted by th e SAPscript ed itor

n  Only affect the SAPscript Composer

The Composer is a program that converts text from the ed itor display

into the print d isplay. This program formats the line and p ages where

symbols are replaced by th eir current v alues and text forma tting is

based on the paragra ph an d the character style formats.

Page 2: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 2/42

KKK SA Pscript M ade Easy | Release 4.6 

h~~lZi|\\z}

h~~_zh

Formatting options format variables and override the format

described in the Dictionary. Formatting op tions are alw ays specified

within &-& variable brackets.

Table A–1 SAPscript control commands

SAPscript 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 outputINCLUDE Include other texts

NEW-PAGE Explicit forms feed

NEW-WINDOW Next window MAIN

PERFORM, ENDPERFORM 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

Page 3: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 3/42

SA Pscript Control Commands KKL

Z

lz\\z}

SAPscript control comm and s differ from norm al text lines in th e

following ways:

i\^}

n  Control comm and s are highlighted gray.

n  Control comm and s are inserted, changed or d eleted using a dialog

window.

m~^}

n  Control comman ds are indicated with the paragraph format / : in

the tag column .

Table A–2 SAPscript formatting options

Formatting Options Description

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

Country dependent formatting Specifying formats for country dependentvalues

Date mask Formatting date fields

Exponent for floating point numbers Specifying an exponent for floating pointvalues

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 leftLeading 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” innumeric values

Page 4: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 4/42

KKM SA Pscript M ade Easy | Release 4.6 

n  Control comm and s are entered, changed , or deleted in the

SAPscript ed itor in the sam e way as other text lines.

i\^}z}m~^}n  All key word s and specifications, not defined in qu otes as literal,

are autom atically converted t o up per case.

n  Enter the comp lete control comman d an d th e necessary

param eters on one line.

n  Enter only one control comm and per line.

n  Editor formatting d oes not affect lines w ith control comm and s.

If the control comman d is unknow n or syntactically incorrect, the

comman d line is treated as a comm ent line, and is not interpreted or

printed.

g~

All examples in appendix A show the syntax for the Text Editor. The syntax for the PCEditor is identically except the paragraph format /: in the tag column, because the PC

Editor does not use a tag column anymore.

Z]]k^ll§^g]Z]]k^llS_zZ}}~~

The comm and formats an ad dress according to the postal stand ards of 

the destination coun try defined in the param eter COUNTRY . The

reference fields are d escribed in the stru cture ADRS. Both consta ntsand sym bols can be assigned to the param eters.

If a parameter of a control command is written in square brackets ( [ ] ) on thefollowing pages, then this parameter is optional for the command.

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

Tips & Tricks

TechTalk

Page 5: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 5/42

SA Pscript Control Commands KKN

Zlz

$''5(66>'(/,9(5<@>3$5$*5$3+D@>35,25,7<S@>/,1(6O@

7,7/(title

1$0( name1>,name2>,name3>,name4@@@675((7street32%2;PO  box>&2'(zip code@3267&2'(zip code&,7<town1>,town2@5(*,21region&28175<country)520&28175<from  country(1'$''5(66

Both formatting data and add ress data are parameters. Add ress data

is forma tted for outpu t based on the COUNTRY , PRIORITY an d

 LINES param eters. As the d efault, the P.O. Box is used , if it isavailable, rather than th e street add ress.

n   DELIVERY defines the street add ress.

If this para meter is selected, the system prints th e street add ress

on th e layout ou tpu t instead of the P.O. Box.

n   PARAGRAPH  defines in wh ich paragraph forma t the add ress is

output.

If the pa rameter is not defined, the add ress is outpu t in the default

paragraph format.

n   PRIORITY  defines which ad dress lines can be om itted if there is

not enough space on the output.

You can enter a combination of the following values:

Table A–3 PRIORITY parameter values

Value Description

A form of address

P mandatory blank line 1

Q mandatory blank line 2

2 name 2

3 name 3

4 name 4

L country name

S line for the street

O line for the city

Page 6: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 6/42

KKO SA Pscript M ade Easy | Release 4.6 

n   LINES define how ma ny lines are available to format th e add ress.

If the ad dress data cann ot be comp letely forma tted d ue to an

insufficient num ber of lines, the data entered in the par ameter

PRIORITY is omitt ed. If the LINES specification is m issing an d this

comman d is in a form w indow wh ose type is not MAIN, the linesavailable for the ad dress layout are au tomatically calculated with

the current output line item and window size.

n  TITLE is a required form of ad dress.

n   NAME means that u p to four separate names, separated by

commas, can be defined.

n  STREET mean s the street specification, including add ress num ber.

n   POBOX is the Post Office box num ber.

n  CODE is the P.O. box, postal, or zip code, if this code is different

from the posta l code of the city.

n   POSTCODE is city’s postal, or zip, code.

n  CITY means that u p to tw o place names can be defined.

n   REGION determ ines the adm inistrative area.

n  COUNTRY  specifies the country based on specific postal

standards and the add ress format.

n   FROMCOUNTRY defines in w hich language the d estination

country’s nam e is formatted . In EEC countries, only the

international country iden tification letter is placed, with a hyp hen,

before the postal code.

^z~

$''5(66

7,7/(¶&RPSDQ\·

1$0(¶:LGJHW7HFKQRORJ\,QF·¶$OO.LQGVRI:LGJHWV·

675((7¶/LGR/DQH·

32%2;¶·&2'(¶·

3267&2'(¶·

&,7<¶)RVWHU&LW\·

5(*,21¶&$·

&28175<¶86$·

)520&28175<¶86$·

(1'$''5(66

Page 7: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 7/42

SA Pscript Control Commands KKP 

Z

This list generates the following address:

CompanyWidget Technology, Inc.All Kinds of WidgetsPO box 2935Foster City, CA 94400

If the DELIVERY supplement is specified for the ADDRESS command, then thestreet, not the P.O. Box, is entered.

CompanyWidget Technology, Inc.All Kinds of Widgets1005 Lido LaneFoster City, CA 94404

[hmmhfS]~~_~m~zp}

For  MAIN , determ ine the lines, also know n a s footer texts, which are

always autom atically outpu t at the bottom of that w indow.

lz

%27720

(1'%27720

The text lines between the two commands are output at the bottom of MAIN .

^z~

To switch a footer text off, enter the command pair BOTTOM.. ENDBOTTOM with notext lines in between:

%27720

(1'%27720

Footer text no longer appears at the bottom of the page from and including this page.

SAPscript calls the ADDRESS_INTO_PRINTFORM function module to formatthe address. If the display is not in the required form, check the settings that arevalid for this function module (see the documentation on the function module).TechTalk

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

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

TechTalk

Page 8: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 8/42

KKQ SA Pscript M ade Easy | Release 4.6 

[hqEihlbmbhgElbs^S[~Ee~Elz}

The BOX , POSITION an d SIZE comman ds d raw boxes, lines, and

shadow s. Within any p articular form, these comman ds sp ecify

wind ow or passage of wind ow text can be outpu t in a frame or withshadow ing. The SAP printer d rivers based on page-oriented printers

(the HP LaserJet PCL-5 driver H PLJ4, the Postscript d river POST, the

Kyocera Prescribe d river PRES) use th ese comman ds wh en creating

outpu t. Line printers and nonsup ported p age-oriented printers ignore

these comman ds. The resulting outp ut m ay be viewed in the

SAPscript print previewer.

[hq

lz

%2;>;326@><326@>:,'7+@>+(,*+7@>)5$0(@>,17(16,7<@

This comm and draw s a box of the specified size at th e specified

position. For each para meter ( 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.

n   XPOS, YPOS specify the up per left corner of the box, relative to

POSITION comm and values.

Default is the values sp ecified in the POSITION command.

The following calculation is performed internally to determ ine the

absolute outp ut p osition of a box on the p age:

 X(abs) = XORIGIN + XPOSY(abs) = YORIGIN + YPOS

n  WIDTH determ ines the width of the box.

Default: WIDTH value of the SIZE command

n   HEIGHT determ ines height of the box.

Default: HEIGHT value of the SIZE command

n   FRAME determ ines the thickness of fram e.

Default: 0 (no frame)

n   INTENSITY determ ines 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 constan ts) and en close these

values in inverted comm as. Use a period for the decimal point

character. See also the exam ples listed below.

Use the following u nits of measure:

n  TW (twip)

n  PT (poin t)

Page 9: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 9/42

SA Pscript Control Commands KKR

Z

n  IN (inch)

n  MM (millimeter)

n  CM (centimeter)

n  LN (line)

n  CH (character)

The following conversion factors apply:

n  1 TW = 1/ 20 PT

n  1 PT = 1/ 72 IN

n  1 IN = 2.54 CM

n  1 CM = 10 MM

n  1 CH = height of a chara cter relative to the CPI specification in th e

form header

n  1 LN = height of a line relative to the LPI specification in the form

header

^z~

%2;)5$0(7:

The above command draws a frame around the current window with a thickness of 10

TW (= 0.5 PT).

%2;,17(16,7<

The above command fills the window background with shadowing having a gray scaleof 10 %.

%2;+(,*+77:)5$0(7:

The above command draws a horizontal line across the complete top edge of thewindow.

%2;:,'7+7:)5$0(7:

The above command draws a vertical line along the complete height of the left hand

edge of the window.

%2;:,'7+&0+(,*+7&0)5$0(7:,17(16,7<

%2;:,'7+&0+(,*+7&0)5$0(7:

%2;;326&0:,'7+7:+(,*+7&0)5$0(7:

%2;;326&0:,'7+7:+(,*+7&0)5$0(7:

The above commands draw two rectangles and two lines to construct a table of threecolumns with a highlighted heading.

Page 10: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 10/42

KLI SA Pscript M ade Easy | Release 4.6 

ihlbmbhg

lz

326,7,21>;25,*,1@><25,*,1@>:,1'2:@>3$*(@

This comm and sets the origin for the coordinate system u sed by the

 XPOS an d YPOS para meters of the BOX  comm and. When a window

is first started , the POSITION value is set to refer to the u pp er left

corner of the w indow (default setting). If a param eter value does not

have a leading sign, then its value is interpreted as an absolute value,

wh ich is a value tha t specifies an offset from the up per-left corner of 

the outp ut p age. If a param eter value is specified w ith a leading sign,

then the n ew va lue of the param eter is calculated relative to the old

value. If a p aram eter specification is missing, then th is param eter is

unchanged.

n   XORIGIN, YORIGIN is the origin of the coordinate system.

n  WINDOW sets the values for the left and u pp er edges to be the

same of those of the current w indow (default setting).

n   PAGEsets the values for the left and up per ed ges to be the same as

the current outpu t page ( XORIGIN  = 0 cm, YORIGIN = 0 cm).

^z~

326,7,21:,1'2:

The above command sets the origin for the coordinate system to the upper-left cornerof the window.

326,7,21;25,*,1&0<25,*,1&0

The above command 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.

326,7,21;25,*,1&0<25,*,1&0

The above command shifts the origin for the coordinates 1.5 cm to the left and 1 cmup.

lbs^

lz

6,=(>:,'7+@>+(,*+7@>:,1'2:@>3$*(@

This comman d sets the values of the WIDTH an d  HEIGHT parameters

used in the BOX comman d. When a wind ow is first started, the SIZE  

value is set to the sam e values as the wind ow (default setting). If one

of the param eter specifications is missing, then n o change is mad e to

its current v alue. If a param eter value d oes not have a leading sign,

Page 11: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 11/42

SA Pscript Control Commands KLJ

Z

then its value is interpreted as an absolute value. If a para meter value

is specified w ith a leading sign, then the n ew va lue of the param eter is

calculated relative to the old va lue.

n  WIDTH ,

HEIGHT sets the d imensions of the rectangle or line.

n  WINDOW sets the values for the wid th and height relative to the

values of the current wind ow (default setting).

n   PAGE sets the values for the w idth an d h eight to the values of the

current outpu t page.

^z~

6,=(:,1'2:

The above command sets WIDTH and HEIGHT to the current window dimensions.

6,=(:,'7+&0+(,*+7&0

The above command sets WIDTH to 3.5 cm and HEIGHT to 7.6 cm.

326,7,21:,1'2:

326,7,21;25,*,17:<25,*,17:

6,=(:,'7+7:+(,*+77:

%2;)5$0(7:

With the above commands, a frame is added to the current window. The frame edgesextend beyond the window itself, to avoid obscuring the leading and trailing textcharacters.

\Zl^S\z~]|

The CASE comm and is a special case of multi-level case d istinction

with IF comman ds. As a condition for the d ifferent cases, only one

symbol can be qu eried for equality with d ifferent values.

lz

&$6( symbol:+(1 value1

:+(1value2

:+(1 value n

:+(127+(56

(1'&$6(

The symbol entered in the CASE line is formatt ed. If it has a value

specified in the ind ividual WHEN lines, the text following the valid

WHEN line is outpu t. If none of the listed v alues app ly, the lines

Page 12: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 12/42

KLK SA Pscript M ade Easy | Release 4.6 

between the WHEN OTHERS line and  ENDCASE are outpu t. The

WHEN OTHERS case is optional. Compa rison is alwa ys carried out as

a literal comparison as for the IF comm and .

]^_bg^Soz~Z~m~l{

Text symbols receive their valu e th rough an explicit assignm ent. This

assignment can be m ade interactively in the ed itor by choosing

 Include → Symbols → Text . This step lists all the text sym bols of a

text module and those of the allocated form. If the transaction is

exited, the conten ts defined in this way are lost. To continueprinting the text mod ule, you w ould h ave to enter the symbol

values again.

The DEFINE comman d allows you to anchor this value assignment in

the text and t o have it available wh en you n ext call up the text.

Furtherm ore, you can allocate another value to a text symbol in the

course of the text.

lz

'(),1(symbolname¶value·

^z~

'(),1(UH¶<RXUFRUUHVSRQGHQFHRI·

'(),1(V\PERO¶[[[[[[[·

'(),1(V\PERO¶\\\V\PERO·

'(),1(V\PERO¶]]]]]]]·

k~S

&symbol2&→ yyyzzzzzzz

The assigned v alue ma y have a m aximum of 60 characters, but it can

also contain m ore symbols. When a symbol is defined using DEFINE ,

symbols which occur in th e value are not immed iately replaced by

their value. They are replaced on ly when the target sym bol isoutput.

If operator := is used in  DEFINE , the symbols that occur in the

value to be assigned are immed iately replaced by their current

values. The resulting character string is only then assigned to the

target symbol w hen all occur ring sym bols have been replaced. The

length of the valu e is limited to 80 characters, and the target

symbol mu st be a text symbol.

ENDCASE must end a CASE command, but the WHEN OTHERS command isoptional.

TechTalk

Page 13: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 13/42

SA Pscript Control Commands KLL

Zlz

'(),1(symbolname¶value·

a^qSa~z}~|z]zz

This comman d sends printer comm and s in a printer language directly

to a printer that sup ports that langu age. SAPscript d oes not interpret

the data en closed by the HEX an d  ENDHEX command pair, but

inserts un changed data into the ou tpu t stream. This techniqu e

allows objects with a pixel-oriented form at to be printed as part of 

a SAPscript text. The HEX an d  ENDHEX comm and pair enclose

the printer command s and data as hexadecimal text, so that the

prin ter formatting rou tines interpret each successive pair of 

characters as a single hexadecimal value in the 0..255 range.

The characters 0..9 and A ..F to rep resent t he va lues 10..15 are valid

hexadecimal characters. The text may also includ e comm ent 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.

lz

+(;>7<3( printer_language@

(1'+(;

 HEX denotes the start of the hexadecimal data . Subsequen t text linesare interpreted as described above. If the TYPE parameter is present,

the data w ill be sent to the printer only if the printer und erstand s the

specified p rinter langua ge. The following p rinter languag es are

currently supp orted:

n   POST (Postscript)

n   PRES (Kyocera Prescribe)

n   PCL (HP Printer Control Langu age)

+(;>7<3( printer_language@>;326x_position@><326

y_position@

Before the hexadecimal data is outpu t, the outpu t cursor is set to the

absolute position ind icated by th e specified X and Y position

param eters. If either th e X or the Y position is not specified, then 0 will

be assumed for this param eter.

+(;>7<3( printer_language@>+(,*+7height@>/()7left_indentation@

Page 14: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 14/42

KLM SA Pscript M ade Easy | Release 4.6 

The HEIGHT param eter determines the amount of space to be

reserved on the page for the ou tpu t of the hexadecimal data. Any

text after  ENDHEX will be outp ut below th is point. If the  LEFT  

par ameter is also specified, then the ou tpu t of the hexad ecimal

data will be ind ented from th e left m argin by the specified am ount.

^z~

&UHDWRUUHSRUW=4917(GDWHWLPHXVHU

6$36&5,37

%$%$%$%$'%$))))))

))))))

))%$))))))))))))&'')&)'

(1'+(;

This data will be printed only by an HP PCL printer (7.5 cm of space will allocated onthe page for the output of the data and the output cursor will be indented 2.25 cm tothe right of the form window edge).

b_S\}zm~h

With the IF control comman d, define those lines that are outpu t und er

certain cond itions. If the logical expression entered for the IF  

comman d is fulfilled, the lines parenth esized by IF ... ENDIF are

outp ut. If this expression is not enclosed in p arentheses, the

comm and s are ignored.

lz

,) Condition

(1',)

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

Page 15: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 15/42

SA Pscript Control Commands KLN

Z

In the cond ition, the following relational operators are p ossible:

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

The sequence of processing the logical operations and the sequen ce of 

processing the conditions is always from left to right. There is noorder of binding, and bra cketing is not allowed.

Comp arison is always carried out as a literal comp arison, that is,

symbols are comp ared in their formatted form as a character string

and not with th eir internal representation. This comp arison mu st be

taken into accoun t for program symbols whose format dep ends on

different para meters. Examp les include currency fields th at are outp ut

with d ifferent nu mber of places after the d ecimal p oint depen ding on

the currency key, or that use a comm a or a period as the decimal

separator dep ending on the setting.

The IF comm and can be extend ed to m ake a two-sided case

distinction with the ELSE comman d. If the sp ecified IF condition istrue, then th e lines listed between  IF an d  ELSE are formatted,

otherw ise the lines between ELSE an d  ENDIF are formatted.

lz

,)Condition

(/6(

(1',)

A m ultilevel case d istinction is possible using the  ELSEIF command.

lz

,)Condition

(/6(,)Condition

(/6(

(1',)

You can u se as man y ELSEIF comm and s as required. The

specification of an  ELSE comman d is optiona l in this case.

Table A–4 Relational operators overview

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

Page 16: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 16/42

KLO SA Pscript M ade Easy | Release 4.6 

bg\en]^Sb|}~h~m~

Use INCLUDE to includ e the conten ts of anoth er text into your

text. The text to be includ ed exists separately from you rs and is

only copied at the time of the ou tpu t forma tting. With INCLUDE ,

since the text is only read and inserted d uring the ou tpu t

formatting, the most cu rrent version of the required t ext is always

available.

lz

,1&/8'(name>2%-(&7o@>,'i@>/$1*8$*(l@>3$5$*5$3+ p@>1(:3$5$*5$3+np@

The name of the text to be inserted m ust be specified and can have u p

to 70 characters. If the text nam e contains blanks, put it in qu otes as a

literal. It can also be sp ecified with a sym bol. All further p aram eters of 

 INCLUDE are optional. If these param eters are m issing, SAPscript

uses default values based on the respective call environm ent for them.

^z~

,1&/8'(0<7(;7

The text MYTEXT is included in the language of the calling text.

,1&/8'(0<7(;7/$1*8$*(¶(·3$5$*5$3+¶$·

The text with the name MYTEXT and the language E is included, regardless of thelanguage in which the calling text is created. The paragraph format A1 is valid as thestandard paragraph for this call.

The condition must not extend over several lines, and must be contained in oneline 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, andif the condition is not true, nothing more is output after the IF command.

If a syntax error is found when interpreting these commands, the correspondingcommand is not executed. This can have various effects on the following textoutput. If, for example, the IF statement is incorrectly structured, since IF ismissing, the following ELSEIF or ELSE commands are ignored. All lines areoutput.

TechTalk

Page 17: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 17/42

SA Pscript Control Commands KLP 

Z

hzl~||z

n   LANGUAGE 

If a langu age is unspecified, the calling text’s language or the form

is set for the text to be includ ed. If a langu age is specified , the text

is alwa ys loaded in th is langu age, regardless of the langu age of 

the calling text.

n  PARAGRAPH 

The text to be included is formatted with its style allocation. With

this param eter, the standard p aragrap h of this style can be

redefined for the current call. All * paragr aph s of the inserted text

are formatt ed w ith the paragrap h specified here.

n   NEW-PARAGRAPH 

The first line of the includ ed text has this format flag, provided it

is not a comman d or comm ent line. If the optional entry

PARAGRAPH (see above) is emp ty, all * paragraphs of the

includ ed text are formatted w ith the paragrap h np sp ecified w ith

NEW-PARAGRAPH.

n  OBJECT 

To comp letely specify a text, create ad ditional specifications abou t

the text object. There are d ifferent ru les and restrictions for this

specification that depen ds on the calling text’s object type. All

texts can be included in a form. If no object is entered h ere, TEXT  

is used (standard texts). With a d ocumenta tion text (object

 DOKU ), you can on ly include d ocum enta tion texts. This object is

assum ed even if no object is specified in t his environment.

Only hypertext or docum entation text can be includ ed into a

hyp ertext (object DSYS). If the OBJECT specification is missing,

 DSYS is set as a default value.

Only stan dard text (object TEXT ), docum entation text or

hypertext can be included in any other typ e of text. The default

object is TEXT if nothing is entered.

n   ID

The text ID allows furth er text types w ithin 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 tab le, the text ID of the calling text is used .

Page 18: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 18/42

KLQ SA Pscript M ade Easy | Release 4.6 

The ID and the object are now the basis of a fur ther consisten cy check:

n  All text IDs are allowed for a form .

n  Only docum entation texts with the text IDs TX  (general texts), UO  

(authorization objects), and docum entation texts (with t he sametext ID as the calling d ocumentation text) may be includ ed in

documentation texts.

n  All DSYS texts may be included in DSYS texts, regard less of their

ID. Documenta tion texts that will be inserted m ay only have IDs

TX  an d UO .

n  Stand ard texts with th e allowed text IDs, DSYS texts with IDs, and

docum entation texts with IDs TX  an d UO may be includ ed in the

text types.

g^pFiZ`^S^|__~~}

SAPscript autom atically inserts a page break if MAIN of one page is

filled. Using NEW-PAGE , a pa ge break can be forced at an y poin t.

The text after this comman d is written on a n ew p age. The form

feed is ind epend ent of any conditions. The comm and now outp uts

the current page.

If you h ave entered  NEW-PAGE withou t add itional parameters, the

page defined in th e form as the n ext page is accessed. If, how ever,

there are various pages in your form, you can jum p to an y

particular n ext p age by specifying the p age name.

lz

1(:3$*(> page name@

^z~

1(:3$*(

The current page is completed and the text in the following lines is written on the nextpage as determined in the form.

1(:3$*(6

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 pagespecification is ignored. Make sure that there are no blank lines immediatelybefore a NEW-PAGE command. If an implicit form feed was carried out withinthese blank lines, this step could lead to an unwanted empty page being printed.

Caution

Page 19: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 19/42

SA Pscript Control Commands KLR

Z

g^pFpbg]hpSg~p}fZbg

You can h ave u p to 99 MAIN wind ows on one page. These window s

are distingu ished by a serial number (0..98) and assigned in th is

order. So, with SAPscript, it is possible to print labels or to ou tpu ttext in mu ltiple colum ns. If one  MAIN wind ow is filled, then the

next MAIN wind ow on th e page is au tomatically accessed. A page

break is inserted at the end of the final MAIN window.

Using NEW-WINDOW , even if the current w indow is not

completely filled, you can explicitly call the next w indow  MAIN . If 

you a re cur rently in the last MAIN wind ow of the page, the

command works as a NEW-PAGE.

lz

1(::,1'2:

i^k_hkfS\zZ[Zil{~

You can use the PERFORM command to call an ABAP subroutine

(form) from any p rogram , subject to the norm al ABAP runtime

auth orization checking. You can use su ch calls to subrou tines for

carrying out calculations, for obtaining d ata from the database that

is needed at display or p rint time, for formatting d ata, and so on .

PERFORM comman ds, like all control comm and s, are executed w hen

a docum ent is forma tted for display or printing. Commu nication

between a subrou tine that you call and the docum ent is by way of 

symbols whose values are set in the subrou tine.

lz

,QDIRUPZLQGRZ

3(5)250IRUP!,1352*5$0SURJ!

86,1*,19$5

86,1*,19$5

&+$1*,1*2879$5

&+$1*,1*2879$5

(1'3(5)250

INVAR1 an d INVAR2 are variable symbols and may be any of the four

SAPscript symbol typ es.

OUTVAR1 an d OUTVAR2 are local text symbols and m ust th erefore be

character strings.

Page 20: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 20/42

KMI SA Pscript M ade Easy | Release 4.6 

The ABAP subroutine called via the comma nd line stated above mu st

be defined in th e ABAP report prog as follows :

)250IRUP!7$%/(6,1B7$%6758&785(,7&6<

287B7$%6758&785(,7&6<

(1')250

The values of the SAPscript sym bols passed w ith 86,1* are

now stored in the interna l 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 h ow to access the variables.

The internal table OUT_TAB contains names and values of the

CHANGING param eters in the PERFORM statemen t. These

par ameters are local text sym bols, that is, character fields. See the

examp le below on h ow to return the variables within the

subroutine.

^z~

From within a SAPscript form, a subroutine GET_BARCODE in the ABAP program

QCJPERFO is called. Then the simple barcode contained there (‘First page’, ‘Nextpage’, ‘Last page’) is printed as local variable symbol.

]~~lZi|S

3(5)250*(7B%$5&2'(,1352*5$04&-3(5)2

86,1*3$*(

86,1*1(;73$*(

&+$1*,1*%$5&2'(

(1'3(5)250

%$5&2'(

\}~|zZ[ZizS

5(32574&-3(5)2

)250*(7B%$5&2'(7$%/(6,1B3$5678&785(,7&6<

287B3$56758&785(,7&6<

ikbgmF\hgmkheSb~i\\zz|~

This comm and allows you call certain p rinter functions fromSAPscript text. The control characters for the p rinter cannot be

directly entered into your text. First, with the spool transaction SPAD ,

define a p rint control that contains the required printer command s.

This print control can now be called w ith the SAPscript comm and

PRINT-CONTROL.

lz

35,17&21752/name

Page 21: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 21/42

SA Pscript Control Commands KMJ

Z

The name of the required pr int control can be entered with or w ithout

quotes.

After p erforming PRINT-CONTROL, SAPscript inserts a blank at t he

start of the following line. If this is not requ ired, this line m ust h avethe paragrap h format “=.”

ikhm^\mSi~|iz~[~z

You can determ ine whether a pa ragraph should or shou ld not be

separated by a page break in the style or form. If the attribute p age

protection is set, then all the lines of this paragrap h are always ou tpu t

together on one p age. This attribute is linked to the resp ective

paragraph.

It is not beneficial to provide all paragra ph s with a page p rotectionattribute to neutra lize un wan ted p age breaks. This event is too

dyn amic and on ly results from the current text. Furth ermore, you may

also want to protect only parts of a paragra ph from a pa ge break.

In principle, this problem could be solved w ith  NEW-PAGE byexplicitly starting a n ew page before the affected par ts of the text.

How ever, it is comp licated to change th is procedu re. Using N EW-

PAGE, if your text is form atted to ha ve no unw anted page breaks,

and new lines are inserted and existing ones are deleted, the  NEW-

PAGE comman ds inserted a fter this point w ill have to be checked

and can result in the m ovement of page breaks.

With the comm and pair PROTECT .. ENDPROTECT , SAPscrip toffers the option to ind ividu ally define protection from a page

break. If you parenthesize text with these comm and s, SAPscript

automatically gu arantees that all of its lines are print ed on one

page. If the lines fit on th e current ou tpu t p age, they are outp ut

there, as if PROTECT was not u sed. If, however, the sp ace is not

sufficient, PROTECT works like a NEW-PAGE and generates a

form feed.

SAPscript has no idea of what is contained in the print control. It cannot checkwhether the printer commands hidden behind it are functional. If problems resultwhen printing such a text, first print the text without the print controls, and thenactivate each PRINT-CONTROL command to help you locate the error moreeasily.

On completion, make sure that the defined print control sequences restore theprinter to a defined status. When printing subsequent texts, SAPscript assumesthat certain settings are still valid (type font, current page). If these settings arechanged by the called printer commands, this change can have unwantedeffects.

Caution

Page 22: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 22/42

KMK SA Pscript M ade Easy | Release 4.6 

So, you can view PROTECT  /ENDPROTECT are conditional NEW-

PAGE comm and s, that determine w hether the includ ed lines fit

into the current w indow  MAIN or not.

lz

3527(&7

(1'3527(&7

The lines to be protected lie between the tw o comman ds.

k^l^mSbz~h~izzz

The RESET comm and resets the nu mbering of an outline

par agrap h to its initial value. If the user does not u se RESET , all the

outline par agrap hs of a text are sequen tially nu mbered . If the

name of an ou tline p aragraph is entered in  RESET , the numbering

of this parag rap h, is initialized w ith subord inate outline levels.

lz

5(6(7 paragraph format

The paragrap h format specifies the outline para graph to be initialized.

^z~

Assume that paragraph N1 is defined in the style you are using. This paragraph

should be used for listings and each time it generates an output of a list number. Thisis the SAPscript editor:

$6,I\RXZDQWWRZRUNZLWKWKH6$356\VWHPSURFHHGDV

IROORZV

10DNHVXUHWKDW\RXKDYHD3&

16ZLWFKRQWKH3&

An ENDPROTECT command without a preceding PROTECT command isineffective.

If the last ENDPROTECT is missing, it is implicitly assumed at the end of the

text.

PROTECT .. ENDPROTECT commands cannot be nested. If a secondPROTECT command is recognized while another is active, the second isignored.

If the text between PROTECT and ENDPROTECT is so extensive that it wouldnot fit on an empty page, then only one form feed is generated and the text isnormally output. Thus, in this case, the section to be protected is separated by apage break.

TechTalk

Page 23: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 23/42

SA Pscript Control Commands KML

Z

1&OLFNRQWKH6$3LFRQ

$67KH6$3ORJRQVFUHHQDSSHDUV7RORJRQ\RXPXVWFDUU\

RXWWKHIROORZLQJVWHSV

5(6(71

1(QWHU\RXUXVHU,'

1(QWHU\RXUSDVVZRUG

1&KRRVHWKHDSSOLFDWLRQ\RXUHTXLUH

k~S

If you w ant to w ork with th e 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 app ears. To log on, you mu st carry out the

following steps:

1. Enter you r user ID

2. Enter your p assword

3. Choose the app lication you require.

If the RESET comman d between th e two lines in the previous examp le

is missing, then both of the listings w ould be sequen tially nu mbered :

k~S

If you w ant to w ork with th e 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 app ears. To log on, you mu st carry out the

following steps:

4. Enter you r user ID

5. Enter your p assword

6. Choose the app lication you require.

Page 24: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 24/42

KMM SA Pscript M ade Easy | Release 4.6 

l^m\hngmkrS\Fl~||_z

Some field types are formatted to be country-specific. This includes

the display of a date, the decimal p oint, or the thou sands separ ator.

Norm ally, the display types d efined in th e user m aster record are u sedhere. With the control comma nd SET COUN TRY , a form at

alternative to that in th e user m aster record can be chosen, which is

stored country -specifically in table T005X .

lz

6(7&28175<Country key

This country key can be entered either d irectly in quotes or w ith a

symbol.

^z~

6(7&28175<¶&$1·6(7&28175<Country key

By entering an empty country name, you can return to the values set in the usermaster record.

6(7&28175<¶¶

The corresponding ABAP command is called internally by SAPscript.

l^m]Zm^fZldS_z]z~_~}

Formatting date fields can be d efined with th e SAPscript comm and

SET DATE MA SK . After executing this comma nd , all the date fields

are outpu t with this display.

lz

6(7'$7(0$6.¶date mask·

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

Tips & Tricks

Page 25: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 25/42

SA Pscript Control Commands KMN

Z

In the date m ask, the following edit formats can be used:

All other characters in the mask are interp reted as text and copied

correspondingly.

^z~

Assume that the current system date is March 1, 2000.

6(7'$7(0$6.¶:DOOGRUI''00<<·

'$7(

k~S

Walldorf, 01.03.00

6(7'$7(0$6.¶''0000<<<<·

'$7(

k~S

01 March 2000

^z~

By specifying an empty string as the date mask, you can switch back to the defaultdisplay:

6(7'$7(0$6.¶¶

Table A–5 Date mask: Edit formats

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)

Page 26: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 26/42

KMO SA Pscript M ade Easy | Release 4.6 

g~

The texts for the month and day names, shortened or in full, are stored language-dependently in table TTDTG under the following arguments:

l^mlb`gSm~iDHF

For comm ercial app lications, it is common for the “+/ -“ signs to be

displayed to the right of the n um ber value. In certain cases, however,

it is necessary for these signs to be d isplayed to th e left of the nu mber

value. This position can be d etermined with th e control comman d

SET SIGN . All program symbols formatted using this command

and that have a “+/ -“ sign are displayed in the required fashion.

lz

6(76,*1/()7

The +/ - sign is displayed to the left of the nu mber.

6(76,*15,*+7

The +/ - sign is displayed to the right of the nu mber.

l^mmbf^fZldS_zm~_~}

With th e SAPscript comman d SET TIME M ASK time field s can be

alternatively formatted to the standard display.

lz

6(77,0(0$6.¶time mask·

The following ed it formats can be u sed in the tim e mask:

n  HH = hours (two-digit)

Table A–6 Table TTDTG: Date mask 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

Page 27: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 27/42

SA Pscript Control Commands KMP 

Z

n  MM = minu tes (tw o-digit)

n  SS = seconds (two-d igit)

All other characters in the mask are interp reted as text and printed

correspondingly.

^z~

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

6(77,0(0$6.¶++00·

7,0(

k~S

10:08

6(77,0(0$6.¶++KRXUV00PLQXWHV·7,0(

k~S

10 hours 08 minutes

By specifying an empty string as a time mask, you can switch back to the defaultdisplay:

6(77,0(0$6.¶¶

lmre^S\z~l~

The control comman d STYLE changes style with in a text. This other

style is used u ntil a new STYLE comm and is entered. If * is entered

as a style name, sw itch back to th e original style.

lz

67</(style67</(

If another text modu le is inserted by choosing  Include → Text an d

immediately d eleted, STYLE is autom atically set in the ed itor. The

same occurs if the text contents includ ed in  INCLUDE are copiedinto the text by choosing  Edit  → Selected  area → Delete INCLUDE .

lnffbg`

Program symbols can be add ed w ith the SUMMING comm and . The

comm and needs to be d efined only once. Each time th at thespecified symbol is edited, its current valu e is add ed to the sum

field. Several program symbols can also be add ed in a su m field .

Page 28: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 28/42

KMQ SA Pscript M ade Easy | Release 4.6 

lz

6800,1* program symbol,172sum symbol

Since SAPscript can not dyn amically d efine su m fields, the su msymbol mu st be in a calling program structure that w as declared with

TABLES .

mhiSl~a~z}~m~fZbg

In MAIN , lines that are always autom atically ou tpu t at the top of 

the w indow, called head er texts, can be determined . Header texts

can autom atically repeat the table head ing at the top of every page

for an extensive tabu lar list.

lz

723

(1'723

Those text lines between the tw o comm and s will be outpu t at the top

of  MAIN .

To switch a h eader text off, enter the comm and pair TOP .. ENDTOP,

with n o lines in between:

723

(1'723

Head er text will not app ear on subsequent pages.

If the document window contains text, then the header text is effective from thenext page.

The same applies to deleting a header text. That is, a header text that hasalready 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 alsowork with header texts in the form interface, which can lead to unwanted results.

Tips & Tricks

Page 29: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 29/42

SA Pscript Control Commands KMR

Zlz_zh

\z~oz~z\~

You can in crease or decrease th e value of SAPSCRIPT-COUNTER_x

(x=0.. 9) counter variable by 1, before the current counter value is

printed.

lz

6$36&5,37&2817(5B[,QFUHDVHVE\WKHFRQWHQWV

RIWKHFRXQWHUYDULDEOH[

[

6$36&5,37&2817(5B['HFUHDVHVE\WKHFRQWHQWV

RIWKHFRXQWHUYDULDEOH[

[

If you w ant to change the va lue of a counter v ariable without actually

printing the new value, use this formatting op tion together with an

add itional option to set the ou tpu t length to 0 (see above). If you wan t

to set a counter variable to some specific value, use the DEFINE  

control comm and .

^z~

Assume that &SAPSCRIPT-COUNTER_1& initially has the value 2 .

6$36&5,37&2817(5B!

6$36&5,37&2817(5B!

6$36&5,37&2817(5B!6$36&5,37&2817(5B!

6$36&5,37&2817(5B!

6$36&5,37&2817(5B!

\]~~}~_z

Certain fields are formatted specific to a p articular country. These

includ e fields for displaying a d ate and num eric fields containing

either a d ecima l point or a ‘thousand s’ separator character. The

formatting app lied is usu ally determ ined by the d efinitions contained

in the u ser master record. You can use th e SET COUN TRY controlcomman d to choose a different formatting operation . The various

country-dep endent formatting op tions are stored in table T005X .

lz

6(7&28175<country_key 

You can sp ecify this count ry key either by qu oting it directly enclosed

in inverted comma s or by using a symbol.

6(7&28175<&$1

6(7&28175<.1$/$1'

Page 30: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 30/42

KNI SA Pscript M ade Easy | Release 4.6 

You can revert to th e settings of the u ser ma ster record by u sing the

SET COUNTRY control comman d again w ith an empty country nam e.

6(7&28175< 

When SAPscript encounters th is comm and it calls the correspond ingABAP comm and intern ally. The effect of the SAPscript comm and is

thus iden tical with that of the ABAP comman d.

If the formatting tu rns ou t other th an expected, check the settings in

table T005X .

]z~fz

To forma t da te field s, use the SAPscript SET DATE MA SK command.

Executing this comman d cau ses all subsequ ent d ate fields to be

printed with th e specified formatting.lz

6(7'$7(0$6.¶date_mask·

In the date m ask, the following edit formats can be used:

Any other characters occurring in th e mask a re interpreted as simp le

text and are copied directly to the outpu t.

Table A–7 Date mask: Edit formats

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)

Page 31: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 31/42

SA Pscript Control Commands KNJ

Z^z~

Assuming a current system date of March 1, 2000.

6(7'$7(0$6.)RVWHU&LW\00''<<

'$7(

k~S

Foster City, 03.01.00

6(7'$7(0$6.0000''<<<<

'$7(

k~S

March 01, 2000

You can revert to the standard setting by using the SET DATE MASK command againwith an empty string in place of the date mask:

6(7'$7(0$6. 

^~_zig{~

How a floating point num ber is formatted d epends on w hether an

exponent is specified. The man tissa is adjusted by sh ifting the decimal

point an d, if necessary, introducing lead ing zeros, based on the chosen

exponent. An exponent value of 0 mean s that the exponentrepresentation will not be used t o display the symbol.

lz

V\PERO(n

^z~

In this example the PLMK-SOLLWERT field is assumed to have the value 123456.78and to be of data type FLTP.

Table A–8 Examples for floating point numbers

Symbol Result

&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

Page 32: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 32/42

KNK SA Pscript M ade Easy | Release 4.6 

_\zz|~

Leading spaces in a v alue can be replaced w ith a fill character. The

character immed iately following th e F in the specification is used as

the fill character.

lz

V\PERO)f

^z~

The figure for customer sales in the KNA1-UMSAT field is $700 . The Dictionary  description of the field specifies an output length of eight.

.

b\~k~

SAPscript conversion routines sp ecified in th e Dictionary are

autom atically recognized and u sed wh en program sym bols are

formatted. These conversions can be p revented w ith the K option.

lz

V\PERO.

e~z}l~e~

The leading sign is norm ally displayed to the right of a nu meric value,

except w hen u sing a floating point nu mber. This option allows you to

specify that the lead ing sign is placed to the left of the nu mber.

lz

V\PERO

Table A–9 Examples for fill characters

Symbol Result&KNA1-UMSAT& 700.00

&KNA1-UMSAT(F*)& **700.00

&KNA1-UMSAT(F0)& 00700.00

Table A–10 Examples for leading sign

Symbol Result

&ITCDP-TDULPOS& 100.00-

&ITCDP-TDULPOS(<)& -100.00

Page 33: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 33/42

SA Pscript Control Commands KNL

Z

e~z}l~k

The default setting outp uts the leading sign to the right of a nu meric

value. If you used the SET SIGN LEFT to specify that the leading sign

should be outp ut before the value, this specification can be

overridden for ind ividual symbols to enable these values to be outpu t

with the leading sign to the right.

lz

V\PERO!

g{~]~|z

A program symbol of one of the dat a types DEC , QUAN an d FLTP can

contain decimal place data. This option overrides the  Dictionary 

definition for the nu mber of decimal places to format this symbol

value.

lz

V\PEROn

^z~

The EKPO-MENGE field contains the value 1234.56 . The Dictionary definitionspecifies three decimal places and an output length of 17.

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

individual symbol.

Tips & Tricks

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

Tips & Tricks

Table A–11 Examples for number of decimals

Symbol Result

&EKPO-MENGE& 1,234.560

&EKPO-MENGE(.1)& 1,234.6

&EKPO-MENGE(.4)& 1,234.5600

&EKPO-MENGE(.0)& 1,235

Page 34: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 34/42

KNM SA Pscript M ade Easy | Release 4.6 

h~

Specifying an offset of “ n” causes the “n” left-most characters of the

symbol value w ill not be displayed. If the offset specified is greater

than th e length of the value, nothing is outpu t.

lz

V\PEROn

^z~

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

he~z}s~

Certain symbol values are outp ut w ith leading zeros. To supp ress

these values use the Z option.

lz

V\PERO=

^z~

Assuming the current date is January 1, 2000

.

Table A–12 Examples for offsets

Symbol Result

&symbol& 123456789

&symbol+3& 456789

&symbol+7& 89

&symbol+12& Blank

&symbol+0& 123456789

Table A–13 Examples omitting leading zeros

Symbol Result

&DAY& 01

&DAY(Z)& 1

Page 35: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 35/42

SA Pscript Control Commands KNN

Z

h~e~z}l

Program symb ols with n um eric values can have a leading sign, wh ich

usua lly appears at the r ight of the num eric value as a sp ace for

positive num bers, or as a minus sign for negative num bers. The S option ensures that the value is formatted w ithout the sign.

lz

V\PERO6

^z~

The ITCDP-TDULPOS field contains the value -100.00. The Dictionary definitionfor this field includes a leading sign.

h~l~zz¡mz}¯

Sym bols of the DEC , CURR, INT an d QUAN data typ es are

normally formatted with the “thou sands” separator character. The

T opt ion allow s you to specify that this separator chara cter shou ld

be omitted.

lz

V\PERO7

^z~

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.

he~

If you need only a par t of the symbol value, or if the outpu t has to fit

in an on-screen box or field withou t overlapp ing the ed ges of this

area, use an outp ut length sp ecification to d efine how man y character

positions should be copied from the value.

Table A–14 Examples of omitting leading sign

Symbol Result

&ITCDP-TDULPOS& 100.00-

&ITCDP-TDULPOS(S)& 100.00

Table A–15 Examples of omitting separator for thousands

Symbol Result

&EKPO-MENGE& 1,234.560

&EKPO-MENGE(T)& 1234.560

Page 36: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 36/42

KNO SA Pscript M ade Easy | Release 4.6 

If a length is specified that is greater than the current value length ,

then spaces are append ed to the symbol value.

The character * specifies the p rogram symbol length. This

specification causes the symbol value to be ou tpu t based on theoutput length d efined in the Dictionary.

lz

V\PEROl

^z~

If symbol has the value 123456789.

An ou tpu t length specification can be combined w ith an offset

specification. The specified length is then coun ted from the sp ecified

offset position.

V\PERO →

^z~

The SYST-UNAME field contains the logon name of a user called Einstein. TheDictionary entry for this field contains an output length of 12.

6<6781$0((LQVWHLQ

6<6781$0((LQVWHLQ

6<6781$0((LQVWHLQ

i~|~}z}l{~~m~

In add ition to u sing initial symbol values, add itional texts that are

outpu t only when th e symbol value is no longer the initial value can

be specified . You can sp ecify a text to be outp ut im mediately before

the symbol value (the pretext), and text to be outp ut im med iately after

it (the posttext). If the sym bol has its initial value, these texts aresuppressed.

lz

SUHWH[WV\PEROSRVWWH[W

Table A–16 Examples for output length

Symbol Result

&symbol(3)& 123

&symbol(7)& 1234567

Page 37: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 37/42

SA Pscript Control Commands KNP 

Z

^z~

The KNA1-PFACH field contains a customer PO Box number. Since “PO Box” isnot stored in the field with the value, you would normally write the following for thePO Box line of an address:

32%R[.1$3)$&+

However, if no “P.O. Box” has been specified then “PO Box” would still appear on itsown in the address. Prevent this step by using pretext and/or posttext (in this casepretext).

32%R[.1$3)$&+ →32%R[32%R[.1$3)$&+

If “P.O. Box” is specified, then this information will be displayed with the appropriatetext in the usual way.

32%R[.1$3)$&+ → 32%R[

kFc~}h

Symbol values other than n um eric values are normally formatted to

be left-justified. Right-justified form atting can be specified w ith the R 

option. This option has to be u sed w ith an ou tpu t length specification.

lz

V\PERO5

^z~

If symbol has the value 1234 .

Ensure that the symbol, the pretext and the posttext, all appear on a single lineof the editor. This may mean that you have to use a long line (paragraphattribute = or /= ) in the editor.

The apostrophe character delimits these texts. If this character also appears aspart of one of these texts, then it must be written twice at this point to avoidmisinterpretation. A pretext or posttext may contain symbols in addition tonormal text. These symbols are subject to the restriction that these symbols maynot have a pretext or a posttext.

Tips & Tricks

Table A–17 Examples for right-justified output

Symbol Result

&symbol& 1234

&symbol(8R)& 1234

Page 38: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 38/42

KNQ SA Pscript M ade Easy | Release 4.6 

lz|~\~

The symbol value is viewed a s 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 andshifting “w ords” to the left to close gaps. Leading sp aces are

completely removed. The results are the same as if the ABAP

command CONDENSE was used.

lz

V\PERO&

^z~

Assuming ’ Albert Einstein ’ is the symbol value.

l~bzoz~

The I option sup presses the outpu t of symbols that still contain their

initial value.

lzV\PERO,

^z~

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

If the field contains an amount other than 0 , this value will be output in the usual way.

m~fz

You can u se the SAPscript SET TIME MA SK comm and to format time

fields in a w ay that differs from the stand ard setting. Executing th is

comman d causes all subsequen t time fields to be printed w ith the

specified forma tting.

Table A–18 Examples for space compression

Symbol Result

&symbol& Albert Einstein

&symbol(C)& Albert Einstein

Table A–19 Examples for suppressing initial values

Symbol Result

&KNA1-UMSAT& 0.00

&KNA1-UMSAT(I)&

Page 39: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 39/42

SA Pscript Control Commands KNR

Zlz

6(77,0(0$6.time_mask

In the time m ask, the following ed it formats can be u sed:

Any other characters occurring in th e mask a re interpreted as simp le

text and are copied directly to the outpu t.

^z~

Assuming the current time is 10:08:12.

7,0(→

6(77,0(0$6.++00

7,0(

k~S

10:08

6(77,0(0$6.++KRXUV00PLQXWHV

7,0(

k~S

10 hours 08 minutes

6(77,0(0$6.++KRXUV00PLQXWHV

7,0(=

k~G

10 hours 8 minutes

You can revert to the standard setting by using the SET TIME MASK command againwith an empty string in place of the time mask:

6(77,0(0$6.

Table A–20 Time mask: Edit formats

Template Description

HH hours (two digits)

MM minutes (two digits)

SS seconds (two digits)

Page 40: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 40/42

KOI SA Pscript M ade Easy | Release 4.6 

l~ozz{~

?lZil\kbimF\hngm^kx?AVIGGRBS

These fields rep resent ten counter va riables that you can use in you r

text and forms for any coun ting pur poses. You can u se the ‘+’ and ‘-’

formatting options to increment or d ecrement a counter before its

value is pr inted. You can use th e DEFINE control comm and to

assign any specific value to a coun ter.

?lZil\kbimF]kbo^k?S

SAPscript form ats a text for a specific outpu t dev ice. The initial

formatting is indep enden t of the sp ecific language of this d evice.

SAPscript th en calls a d river to convert the d evice-indep enden t

format to device-specific control commands. This field contains the

nam e of the driver.

POST Postscript d river

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.

?lZil\kbimFln[k\?

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

?lZil\kbimF_hkfiZ`^l?

This contains the total n um ber of pages outp ut in a SAPscript form

(all outpu t between th e fun ctions START_FORM an d  END_FORM ).

The state of the page counter on th e individual form p ages(START,HOLD,INC ) is not ta ken into account.

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

Tips & Tricks

Page 41: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 41/42

SA Pscript Control Commands KOJ

Z

?lZil\kbimFch[iZ`^l?

This contains the total nu mber of pages ou tpu t in a SAPscript p rint

run (all outp ut betw een the fun ctions OPEN_FORM an dCLOSE_FORM ). The state of the page coun ter on the ind ividu al

form p ages (START,HOLD,INC ) is not taken into accoun t.

?lZil\kbimFm^e^eZg]?

This contains the country id entifier for the fax destination w ith fax

outpu t w ith SAPscript (field  ITCPO-TDTELELAND for th e

parameter OPTIONS of function OPEN_FORM ).

?lZil\kbimFm^e^gnf?

This contains the local fax num ber for the fax destination w ith fax

outp ut with SAPscript (field  ITCPO-TDTELENUM  for the

parameter OPTIONS of function OPEN_FORM ).

?lZil\kbimFm^e^gnf^?

This contains the complete fax num ber for the fax destination with fax

outp ut with SAPscript (field  ITCPO-TDTELENUME for the

parameter OPTIONS of function OPEN_FORM ).

ozz{~l|~lrlm

All variables of structure SYST , called system variables, can be used

in the form. Of part icular int erest are the variables for the system

date and time. These variables indicate the d ate and time that the

The CONDENSE option cannot be used on the program icon SAPSCRIPT- FORMPAGES (C) without an explicit length specification. This symbol isreplaced with a value only after the form has been completely edited, since thetotal number of pages of a form is first known in the program functionEND_FORM or CLOSE_FORM .

However, the symbol size (number of characters) is reserved correctly when thesymbol first occurs, with the current page number. Therefore, only one characteris reserved for option C (CONDENSE) on pages 1-9, two characters on pages10-99, and so on.

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

TechTalk

Tips & Tricks

Page 42: Control Commands

8/8/2019 Control Commands

http://slidepdf.com/reader/full/control-commands 42/42

KOK SA Pscript M ade Easy | Release 4.6 

outp ut was created. For the system d ate, use SYST-DATUM  

variable, for the system t ime, use SYST-UZEIT . Note that you have

the formatting options for date an d time variables.