Show TOC

 Maintaining Text SymbolsLocate this document in the navigation structure

Use

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.

Prerequisites

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.

Tip

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).

Procedure

Creating Text Symbols

  1. In the Object Navigator (transaction SE80), open the program you want to edit.
  2. Double-click one of the entries in the WRITE statement.

    If the text symbol does not exist, a dialog box appears.

  3. Confirm that you want to create the text symbol.

    The text symbol maintenance screen appears:

  4. Enter your text.

    The text may be up to 132 characters long.

  5. Save the text symbol.

    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

  1. In the Sym column, enter a three-character ID for the new text symbol.
  2. Enter the text in the Text column.
  3. Save the text symbol.

    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>.

Note

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.