Text elements
You use text elements to store texts that cannot be defined in the
program code. You can maintain them outside the program where they are
used (in the ABAP/4 Editor, select Goto -> Text elements . They
are particularly useful for maintaining texts intended for
multi-language applications.
The following text element types exist:
-
Selection texts (text belonging to selection criteria and program
parameters)
-
Text symbols (constant text passages)
The structure of text elements is determined by the
structure TEXTPOOL which contains the
following fields:
ID : A single character for the text element type. Possible
values are:
R - Report or program titles
T - List headings
H - Column headings
S - Selection texts
I - Text symbols
KEY : Key field that contains the following values depending on
the text element type:
H - Number of a line with column
headings (001 - 004)
S - Max. 8-character name of a selection
criterion or program parameter
I - 3-character number of a text symbol
For report or program titles and list headings, the field is blank.
ENTRY : Text belonging to the text element, max. 255 characters.
LENGTH : Length of text
Examples
The following table shows typical values for text
elements.
ID | KEY | ENTRY | LENGTH |
H | 001 | 'Name Age' | 10 |
I | 100 | 'Tax' | 10 |
R | | 'Test program' | 12 |
S | CUST | 'Customer' | 8 |
T | | 'Sales' | 10 |
Notes
LENGTH contains the text length. If the text is to
be translated into other languages, it is usual to choose a value for
LENGTH that is greater than in the original language. In this
way, you create extra space for text that may be longer in translation.
You can address text symbols in two different ways - with
TEXT-xxx or with '...'(xxx) . Here, xxx stands for
the number and ... for the text of the text symbol. The second
form makes programs easier to read. The text enclosed in quotation
marks should match the text stored under the text symbol. If it does
not, the text stored under the text symbol is used. Exception: If the
number xxx contains no text, the text enclosed in quotation
marks is used.
Example
If the text symbol with the number 001 contains
the text 'Please enter your name' , the command
-
WRITE: / TEXT-001,
/ 'Please enter your name'(001),
/ 'What is your name?'(001).
produces the same output (i.e. " Please enter your name ") three
times.
When you are in the ABAP/4 program editor, you can compare the texts
used in the program with the texts stored in text symbols by selecting
Goto -> Text elements -> Compare text symbols .
If the LENGTH value you specify for text symbols is greater
than the actual length of the text, the system pads the text up to the
length LENGTH with blanks. This means that when you use the
notation '...'(xxx) , the text enclosed by quotation marks must
be explicitly padded with blanks up to the length LENGTH .
Otherwise, the text stored under the text symbol would not match the
text specified in quotation marks (see note 2).
Example
If the text symbol with the number 036 contains
the text 'Name' , but the length is 10, the command
-
WRITE: / SY-VLINE, TEXT-036, SY-VLINE,
/ SY-VLINE, 'Tax '(036), SY-VLINE,
/ SY-VLINE, 'Tax'(036), SY-VLINE.
produces the same output (i.e. " | Tax | " three times. In
the third line, the text stored under the number 036 is output
with a length of 8 and not just the 3-character long text " Tax ".
If you perform a text element comparison here, (see note 2), the text
symbols in the second and third lines would be shown as different.
Index
© SAP AG 1996