SAPScript symbols and formatting options

List of SAPscript system symbols and formatting option compiled in one page from help.sap.com . I know sapscript is dead and nobody care about it but it seem I am the lucky one who often get to work/fix sapscripts. If you are as lucky as I am then this will surely help you out.

SAP Script System Symbol

Description Code Example
Current Date &DATE&
Current Day Number &DAY&
Current Month Number &MONTH&
Current Year Number &YEAR&
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&
Minutes Component of Current Time &MINUTES&
Seconds Component of Current Time &SECONDS&
Current Page Number &PAGE&
Page Number of the Next Page &NEXTPAGE& 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& Possible values are:
PRINTER
SCREEN
TELEX
TELEFAX
ABAP (ABAP list display)
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.

SAP Script Formatting Options

Description Code Example
Offset &symbol+offset& If < symbol> has the value 123456789, the following will be displayed:

&symbol& -> 123456789
&symbol+3& -> 456789
&symbol+7& -> 89
&symbol+12& ->
&symbol+0& -> 123456789
Output Length &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
Omitting the Leading Sign &symbol(S)&
&ITCDP-TDULPOS& -> 100.00-
&ITCDP-TDULPOS(S)& -> 100.00
Leading Sign to the Left &symbol(<)&
Leading Sign to the Right &symbol(>)&
Omitting Leading Zeros &symbol(Z)&
Space compression &symbol(C)&
Number of Decimal Places &symbol(.N)&
Omitting the Separator for ‘Thousands’ &symbol(T)&
Specifying an Exponent for Floating Point Numbers &symbol(EN)& In this example, the PLMK-SOLLWERT field is assumed to have the value 123456.78 and to be of data type FLTP.

&PLMK-SOLLWERT& -> +1.23456780000000E+05
&PLMK-SOLLWERT(E3)& -> +123.456780000000E+03
&PLMK-SOLLWERT(E6)& -> +0.12345678000000E+06
&PLMK-SOLLWERT(E0)& -> +123456.780000000
&PLMK-SOLLWERT(E)& -> +123456.780000000
Right-Justified Output &symbol(R)&
Fill Characters &symbol(Ff)&
&KNA1-UMSAT& -> 700.00
&KNA1-UMSAT(F*)& -> **700.00
&KNA1-UMSAT(F0)& -> 00700.00
Suppressing Output of Initial Values &symbol(I)&
Ignoring Conversion Routines &symbol(K)&
Changing the Value of a Counter &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 set a counter variable to some specific value, use the DEFINE control command.
Preceding and Subsequent Texts (Pre-Text / Post-Text) &‘pre-text’symbol‘post-text’& Very useful if you want to supress printing of pre-text and post-text if symbol is initial.
Country-Dependent Formatting /: SET COUNTRY country_key
Date Mask /: SET DATE MASK = ‘date_mask’
/: 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
Time Mask /: SET TIME MASK = ‘time_mask’
&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

4 Comments

 Add your comment
  1. SAPscript is not dead (yet). For example it is still widely used for outputting accounting documents which did not make the leap to Smartforms.

  2. Abdul H Quraishi almakhzumi

    Great post – been doing SAPscripts for 20 years – Done Smartforms, adobe, Zebra forms, Jetforms, Optio and so on.
    But I still say SAPscript is the best – you can actually debug it line by line & It is integrated into SAP.

  3. Great post. Please can you help me with how to display the content of BSEG-SGTXT in my credit memo. The form is not displaying the description field as expected

Leave a Reply