‎2022 Feb 03 12:10 PM
KONP-KBETR is type KBETR_KOND. This is a currency field of length 11 and 2 decimal points.
In this piece of code then, how is it L_KBETR can hold 3 decimals points?
CONSTANTS: c_decimals_3(5) VALUE '3 '.
DATA: out_value(15) TYPE c,
l_kbetr TYPE konp-kbetr.
l_kbetr = '1.234'. "<-- should only be able to hold 1.23?
WRITE l_kbetr TO out_value CURRENCY c_decimals_3.
WRITE:/ out_value. "--> 1.234
‎2022 Feb 03 6:26 PM
omg I'm a moron! lol
That was it, the flag was off.
Thank-you Sandra!
‎2022 Feb 03 1:40 PM
Hello,
I am assuming your question is how to round off, as it is not clear what is it exactly that you need help with.
Have you tried using ROUND function module .
‎2022 Feb 03 2:10 PM
why didn't you put a real currency after CURRENCY keyword ? EUR --> 1.23 JPY --> 123
‎2022 Feb 03 3:16 PM
First of all, I cannot reproduce the behavior.
Check in the debugger the ABAP type of l_kbetr. It must be P(6) DECIMALS 2.
Then, after assigning '1.234', it contains 1.23.
Then, your are applying the character 3 to CURRENCY of WRITE TO.
Look into tables TCURC/TCURX which number of decimal places is assigned to currency '3'.
See WRITE, format_options, Addition 6 on how the CURRENCY addition works.
"For data objects of type p, the decimal places specified by the definition of the data type are ignored completely. Independently of the actual value and without rounding, decimal separators and thousands separators are inserted between the digits in the places determined by cur. "
If there are three decimal places behind the currency specified, it produces 0.123 from 1.23.
See also DDIC - Currency Fields
‎2022 Feb 03 3:40 PM
Hi Horst,
Not sure if system version affects why you cannot reproduce the behaviour. The code is as pasted above. I confirmed KONP-KBETR is a currency field, length 11 decimals 2.
Kernel 777 SP 429
SAP_BASIS 754 SP 3
Attached is a screenshot of debug. But what you wrote about type P certainly would suggest why the P variable can 'hold' 3 decimals places even though is defined with only 2.

Frederic,
To rule out any currency-related configuration issues in this test. Defining the explicit number of 'currency' decimals points eliminates this extra factor.
‎2022 Feb 03 4:51 PM
it looks like this old good "floating decimal point" flag in program attributes...
‎2022 Feb 03 6:26 PM
omg I'm a moron! lol
That was it, the flag was off.
Thank-you Sandra!
‎2022 Feb 03 7:08 PM
+1 not for first sentence, but for switching on the "floating decimal point" program attribute!