Skip to Content
1
Dec 05, 2021 at 11:50 AM

text symbols: pro and cons of text-nnn vs text(nnn) ?

122 Views Last edit Dec 05, 2021 at 11:53 AM 2 rev

Hi.

In comments to another question, both Sandra Rossi and Matthew Billingham advised against this form, text-nnn, while, apparently, text(nnn) should be preferred. That got my attention and puzzled me: I had always assumed the older syntax was text(nnn) while text-nnn was newer but I couldn't find anything in ABAPDOCU to this effect, either way, perhaps because "text" is a horrible keyword to look for.

So I wrote a minimal test program in my 7.52SP04 demo environment:

WRITE / 'translatable text with trailing number'(001).

* Intentionally re-used same number!
WRITE / 'different text with trailing number'(001).

WRITE / TEXT-002.

WRITE / TEXT-003.

In the text symbols I have the following definitions:

screenshot-20211205-122250.png

Next I checked the translation screen:

screenshot-20211205-122616.png

(the only possible translation is EN to DE in this system)

It doesn't matter if the line with the number repetition is active or not, in both cases the string does not show up in the translation screen. So far, so good: one has to double-click the text number to create the corresponding symbol, just like I remembered.

Click on the first line and text-001 is created with "translatable text with trailing number".

Click on the second line and text-001 is updated with "different text with trailing number":

screenshot-20211205-123537.png

Here comes my question: how is text(nnn) the form to be preferred when I can write a different text with the same number and never know which is the authoritative version? If the code is in a INCLUDE it's potentially even worse.

The way I see it, one possible advantage is that you see the text in the program flow. Not bad but, on the other hand, if your text has to appear multiple times in the code you have to type it verbatim each time; if you want to change it, you have to change all occurrences instead of just once in the symbols definition, else you run into the issue I artificially created above.

Here is the output with the final version of the program:

screenshot-20211205-125138.png