‎2017 Feb 21 2:31 PM
Hi all,
in a normal se38 report one could write someting like
DATA: two TYPE i VALUE 2.
WRITE:
/ 'I have '(t01) && two && ' eyes.'(t02), "I have2 eyes. <-- wrong spacing
/ `I have ` && two && ` eyes.`, "I have 2 eyes. <-- ok
/ |I have | && two && | eyes.|. "I have 2 eyes. <-- okThe two text symbols T01 and T02 can be translated. But I would like to use string templates because I don't want to care about trailing spaces. You can not use text symbols with string templates as far as I know.
It results in a syntax error:
/ `I have `(t01) && ... <-- Syntax error
/ |I have |(t01) && ... <-- Syntax errorWithout text elements the Code Inspector complains (informational): "Strings without text elements are not translated."
Is this crippled by design? Am I missing something?
BTW: I know CONCATENATE and pragmas and a few other ways to work around. That's not the question.
‎2017 Feb 21 2:37 PM
What about embedded expressions inside string templates? These work as desired.
|{ 'I have'(t01) } |
|{ text-t01 } |
‎2017 Feb 21 2:37 PM
What about embedded expressions inside string templates? These work as desired.
|{ 'I have'(t01) } |
|{ text-t01 } |
‎2017 Feb 22 1:00 PM
It looked promising until I tried. But you left out the important part: the trailing blank. It does not work with ` instead of '. More ideas?
‎2017 Mar 22 1:28 PM
I don't see your problem ....
|{ 'I have'(t01) } | && two && | { 'eyes'(t02) }.|gives "I have 2 eyes."
Same for
|{ 'I have'(t01) } { two } { 'eyes'(t02) }.|
‎2017 Mar 22 2:55 PM
My fault. I tried to stick the space to the text. But it's hidden in what i thougt was syntax. Thank you very much for explaining.
For the records (and for my future reference because I will not remember this in 100 years): Here are the blanks:

‎2017 Mar 22 3:17 PM
"But it's hidden in what i thougt was syntax"
Without embeddeed expressions in { ... }, string templates are simply a kind of string literals |...| where blanks (and especially trailing blanks) are nothing but normal characters.
Their merit of course comes with embedded expressions |...{ ... }...{ ... }...|, where inside the curly brackets you have ABAP operand positions.
Therefore writing it as
|{ 'I have'(t01) } { two } { 'eyes'(t02) }.|makes it more clear.
‎2017 Feb 22 7:00 AM
Just to note that using text elements to construct sentences like
'I have '(t01)&& two &&' eyes.'(t02)is not a good idea, as word order varies from language to language. OK, for this sentence, it works at least in French and German, but you'd get problems with
You must check the table table_name
Since the German would be: Sie müssen die Tabelle table_name kontrollieren.