SAP Scripts - Format Options



In SAPscript, the text output format is controlled by paragraph formats or you can combine text with styles. In the output format, you can use placeholders to create flexible data. In SAPscript, the placeholders are called symbols and they are used to show the data that is not added to the text until a later point.

These are used to format the output and all the symbols in the text gets replaced with the actual current values. This replacement is done only in the output of the text module and the original text module remains the same.

There are four kinds of symbols in SAPscript −

  • System Symbols − Different type of system symbols can be retrieved from tables - SAPSCRIPT, SYST, TTSXY. They are global variables and are retrieved from system tables.

  • Standard Symbols − They are predefined and maintained in TTDTG table. They are based on language settings of script.

  • Program Symbols − This represents the data from a database table or an internal table. Print programs are used to provide necessary data for these symbols.

  • Text Symbols − They are defined locally and is used to define recurring terms or text fragments in the document.

Placeholder / Symbol Structure

Each symbol is presented with a name and call to a symbol is made in a line of text that also contains the other text. These symbols are differentiated from the normal text, and the call is performed so that it identifies a call to a symbol or to other section of the module.

Following rules should be used while using symbols −

  • You shouldn’t use blank characters in the name of a symbol.

  • Always use ampersand ‘&’ immediately before and after the symbol.

  • You shouldn’t use editor line break occurs between the symbols.

  • Note that the symbol names are not case-sensitive and contains a maximum of 130 characters and only the first 32 characters are used to identify the symbol.

Examples of Valid Symbols

  • &symbol&
  • &MY_symbol&
  • &DATE&

Examples of Invalid Symbols

  • &mysymbol − It doesn’t contain the closing character

  • &symbol(Z& − No closing parentheses

  • &my symbol& − In this, symbol name contains a space

  • &mysymbol)& − In this, name contains an invalid character

Common Symbols Used in SAPScript

Current Date &DATE&
Current Day Number &DAY&
Current Month Number &MONTH&
Current Year Number &YEAR&
Minutes Component of Current Time &MINUTES&
Seconds Component of Current Time &SECONDS&
Current Page Number &PAGE&
Output Length &symbol(length)&
Omitting the Leading Sign &symbol(S)&
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)&
Advertisements