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 |
SAPscript is not dead (yet). For example it is still widely used for outputting accounting documents which did not make the leap to Smartforms.
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.
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
Is value there in variable BSEG-SGTXT?
Yes, SAP Script is not dead. I need to change a SAP Script that prints AP Checks. We were suppressing leading zeroes and filling with ‘*’ – for example $*******100.00*. But the bank now wants only two ‘*’ prior and after the currency – so like this $**100.00**. I have used (ZC) but I get this $**100.00 **. I have not been able to remove the space after the dollar amount. I have read up on compress and sounds like it always puts a space after the symbol. Any suggestions?
Hi
use a perform in sapscript.
in the form in related program :
use following statements :
split -value at ‘$’ into lv1 lv2.
like split $*******100.00* at ‘$’ into lv1 lv2
now lv2 has value: *******100.00*
REPLACE ALL OCCURRENCES OF ‘*’ in lv2 WITH space.
now lv2 has value: 100.00
concatenate ‘$**’ lv2 ‘** into lv2
now lv2 has value : $**100.00**
Thank you for sharing your blog, seems to be useful information can’t wait to dig deep!
sir what is cz in smartforms