Entering content frameProcedure documentation Maintaining Text Symbols Locate the document in its SAP Library structure

Text symbols are special text constants that you enter and maintain independently of the program code. In the final versions of your programs, you should use text symbols instead of hard-coded texts. This makes the programs language-independent and easier to maintain.

For further information about literals and text symbols, refer to Structure link literals and Structure link 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 it does not find text symbol <idt>, it ignores that part of the WRITE statement.
The ID may not begin '%_', and may not contain spaces.

Example

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

From the ABAP Editor:

  1. Enter your WRITE statement with the three-character ID and default texts.
  2. Double-click one of the entries in the WRITE statement.
  3. If the text symbol does not yet exist, a dialog box appears. Confirm that you want to create the text symbol.
    The text symbol maintenance screen appears.
  4. Enter the text.
    It may be up to 132 characters long.

    This graphic is explained in the accompanying text
  5. Save the text symbol.
    The maximum length mLen is automatically set to the defined length dlen (actual length of the text).

Result

The text symbol is included in the text pool in the relevant language. You can now carry on and create other text symbols, or change existing ones.

Other Functions

Creating Further Text Symbols

  1. Choose Edit ® Append new lines.
  2. In the Sym column, enter a three-character ID for the new text symbol, and enter the text in the Text column.
  3. Save the text symbol.
    The maximum length mLen is automatically set to the defined length dlen (actual length of the text).

    This graphic is explained in the accompanying text

Note

Spaces in text symbols are no longer represented by underscores. This means that you can now output underscores as characters in a text symbol.

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

For an example, see above.

If we did not create text symbols with the IDs "020" and "040" in the above example, the system would display the following:


This graphic is explained in the accompanying text

Here, 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 text symbol 040, since there is no text symbol defined for it in the text pool.

Deleting Text Symbols

To delete a text symbol, select the appropriate line and choose Delete.

Leaving content frame