Text symbols are special text constants that you maintain independently of the program code. Using text symbols instead of hard-coded texts makes programs language-independent and easier to maintain. For more information about literals and text symbols, see literals and text symbols in the ABAP User's Guide.
You must assign a three-character ID to each text symbol. You define this in the WRITE statement as follows:
WRITE... TEXT-<idt>...
When you run the program, the system searches in the text pool for a text symbol with the ID <idt> and displays it. If no text symbol <idt> is found, the system ignores that part of the WRITE statement. The ID may not begin '%_', and may not contain spaces.
The rest of this section is based on the following coding example:
PROGRAM TEXT_ELEMENTS_2.
WRITE: TEXT-010,
/ TEXT-AAA,
/ TEXT-020,
/ 'Default Text 030'(030),
/ 'Default Text 040'(040).
Creating Text Symbols
If the text symbol does not exist, a dialog box appears.
The text symbol maintenance screen appears:
The text may be up to 132 characters long.
The maximum length mLen is automatically set to the defined length dlen (actual length of the text).The text symbol is included in the text pool in the relevant language. You can create other text symbols, or change existing ones.
Creating Additional Text Symbols
The maximum length mLen is automatically set to a value greater than the defined length dlen (actual length of the text) to provide enough space for translation into other languages.
Using Text Symbols with Text Literals
You can link a text symbol to a text literal as follows:
WRITE... '<textliteral>'(<idt>)...
If the text symbol <idt> exists, the system uses it. If it does not exist, the system uses the text literal <textliteral> .
If the text symbols with IDs 020 and 040 did not exist in the above example, the system would display the following:
Program TEST_ELEMENTS_2
Text symbol with ID 010
Text symbol with underscores______________
Text symbol with ID 030
Default text 040
The system ignores the WRITE statement for the missing text symbol 020 and uses the default text (defined as a literal in the WRITE statement) for the text symbol 040.