Start of Content Area

Text Symbols  Locate the document in its SAP Library structure

A text symbol is a named data object that is generated when you start the program from the texts in the text pool of the ABAP program. It always has the data type c. Its field length is that of the text in the text pool.

Text symbols, along with the program title, list headings, and selection texts, belong to the text elements of a program. Text elements allow you to create language-independent programs. Any text that the program sends to the screen can be stored as a text element in a text pool. Different text pools can be created for different languages. When a text element is changed or translated, there is no need to change the actual program code. Text elements in an ABAP program are stored in the ABAP Editor (see Text Element Maintenance).

In the text pool, each text symbol is identified by a three-character ID. Text symbols have a content, an occupied length, and a maximum length.

Example

Examples for text symbols in an ABAP program:

ID

Contents

Occupied length

Maximum length

010

Text symbol 010

15

132

030

Text symbol 030

15

100

AAA

Text symbol AAA

15

15

In the program, you can address text symbols using the following form:

text-###

This data object contains the text of the text symbol with ID ### in the logon language of the user. Its field length is the same as the maximum length of the text symbol. Unfilled characters are filled up with spaces. You can address text symbols anywhere in a program where it is also possible to address a variable.

If there is no text symbol ### in the text pool for the logon language, the name text-### addresses the predefined data object space instead.

You can also address text symbols as follows:

... 'textliteral'(###) ...

If the text symbol ### exists in the text pool for the logon language, this is the same as using text-###. Otherwise, the literal 'textliteral' is used as the contents of the text symbol. This is only possible at positions in the program where a variable can occur. You can create a text symbol for any text literal by double-clicking the literal in the ABAP Editor and replacing the literal with the text symbol.

You should use text symbols in your program whenever they need to be language-specific - for example, in a WRITEstatement.

If you program a list whose layout depends on field lengths, you should be careful, since the field length of text symbols will be different in different languages. You should therefore set the maximum field length of the field symbol so that there is enough space to translate it into other languages. For example, the English word 'program' has seven letters, but its equivalent German translation 'Programm' has eight.

Example

The following example shows the use of text symbols in WRITE statements.

SET BLANK LINES ON.

WRITE:   text-010,
       / text-aaa,
       / text-020,
       / 'Default Text 030'(030),
       / 'Default Text 040'(040).

If the text symbols of the above screen shots are linked to this program, the output looks as follows:

This graphic is explained in the accompanying text

Text symbols 020 and 040 have no text symbols. For text symbol 020, the system displays a space. This is only displayed in this case because the blank line suppression has been turned off (see Creating Blank Lines). For text symbol 040, the literal specified in the program code is displayed.

 

 

 

End of Content Area