I noticed the strange behavior of the new syntax CONDwhen used within a string template. This applies to the default string length. It seems that the string length will by default always match what comes after THEN, even if the condition is not met.
See the following code snippet:
REPORT zzz.
CLASS lcl_main DEFINITION FINAL CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS:
main.
ENDCLASS.
CLASS lcl_main IMPLEMENTATION.
METHOD main.
DATA(l_bool) = abap_true.
DATA(l_v_line) = |{ COND
DATA(l_v_line2) = |{ COND
DATA(l_v_line3) = |{ COND
DATA(l_v_line4) = |{ COND
WRITE /: l_v_line, l_v_line2, l_v_line3, l_v_line4.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
lcl_main=>main( ).
Output
BBB
BBBΒ·
BBBB
BBBB
The first two variables l_v_lineand l_v_line2truncated, even if the condition is false. If I put a space after AAAin l_v_line3, then this is OK. Setting BBBBafter THENfor l_v_line4solves the problem.
My question is: is this behavior documented anywhere in the SAP documentation? I could not find any clues that would lead me to this.