I have a requirement to format a decimal number with a semicolon as a decimal separator and without a thousand separator (neither a dot nor a space).
I would not be myself if I did not want to do this as one liner, but I could not find such a solution.
What I have now is a workaround.
DATA: l_value TYPE p LENGTH 9 DECIMALS 2 VALUE '-3450354.25'.
DATA(l_formatted_value) = |{ l_value SIGN = LEFTSPACE COUNTRY = 'DE ' }|.
REPLACE ALL OCCURENCES OF '.' IN l_formatted_value WITH ''.
WRITE: l_formatted_value.
I tried to do this with a parameter NUMBER = RAW, but then I didn't seem to find an easy way to specify the decimal separator as a comma.
DATA(l_formatted_value) = |{ l_value SIGN = LEFTSPACE NUMBER = RAW }|.
REPLACE '.' IN l_formatted_value WITH ','.
How can I achieve this as one liner? I would also like to avoid using WRITE.
source
share