Read the documentation about arithmetic expressions, calculation type and conversion rules.
As an ABAP developer you should know that.
Try below sample code. You will see the desired result.
CONSTANTS c_val TYPE c LENGTH 50 VALUE '49.4099999999'.
DATA lv_result TYPE p DECIMALS 4.
DATA(out) = cl_demo_output=>new( ).
lv_result = round( val = c_val dec = 4 mode = 5 )."ROUND_DOWN
out->write( lv_result ).
out->display( ).
I got the output. I had to break the formula to 3 parts and store the value in a local variable with 4 decimal places.
This was done because the formula contained some variables which were declared as 2 decimals.
Because of this the final value was coming out to be with 2 decimals.
The local variable now displays the value with 4 decimals.
Thanks everyone for the help!
:)
Add comment