10-04-2016 10:34 AM
Hello everyone,
the ABAP documentation says that the "WRITE TO" statement can be replaced with "string templates" in most cases. So this means, that there are some cases that are not covered with "string templates".
Unfortunately the documentation does not clarify, which cases are left out.
I cannot find a "string template" equivalent to the following "WRITE TO" additions:
Am I missing something, or is there no equivalent?
Does anyone know, if there are plans to make all functionalities of "WRITE TO" available for "string templates"?
ps. The string expression "ALIGN = LEFT" is not the same as "WRITE ... TO... LEFT JUSTIFIED".
10-04-2016 1:15 PM
Hi Andre,
formatting option "align = left" will replace LEFT-JUSTIFIED, but for UNIT I can't find an option .
Regards,
Klaus
10-04-2016 1:15 PM
Hi Andre,
formatting option "align = left" will replace LEFT-JUSTIFIED, but for UNIT I can't find an option .
Regards,
Klaus
10-04-2016 1:19 PM
Thanks for your reply. But "ALIGN = LEFT" has different behavior regarding leading zeros
Edit: I have to correct that. You are right.
I made further tests and found out that "ALIGN = LEFT" is equivalent to LEFT-JUSTIFIED.
The difference, that a saw was coming from a conversion exit.
So thanks again
10-04-2016 2:26 PM
That brings me to another difference. "WRITE TO" does an implicit conversion (when the underlying domain is assigned to a conversion exit). "string templates" do not provide a functionality to call conversion exits (except ALPHA conversion).
10-04-2016 6:13 PM
I'd say it's mainly the conversion routines. But since string formatting should not be mixed up with screen handling, that's OK.
And UNIT, well, well. Look at its documentation and forget it ...
Besides that, the string templates should have it all and more.
10-04-2016 7:08 PM
Horst Keller wrote:
I'd say it's mainly the conversion routines. But since string formatting should not be mixed up with screen handling, that's OK.
Yes, that makes sense.
Horst Keller wrote:
And UNIT, well, well. Look at its documentation and forget it ...
OK, after reading the documentation of UNIT carefully I think to understand what you mean.
Nobody can want to reimplement such a strange and implicit behavior for string templates.
There are some functionalities and bad implicit behavior of WRITE TO that are not worth being covered by string templates.
09-23-2020 2:32 PM
So previously when you would output a quantity field (e.g. 99.000) with a unit of EA
WRITE qty UNIT 'EA'
which would output 99 instead of 99.000
To achieve the same in a String Template
|{ qty STYLE = SIMPLE }|.
which will retain any decimals if present, otherwise will just output the whole number.