Question: Floating point field to Decimal field problems
Hi...
I'm working on a user exit in SD and I've run into the following problem.
I'm trying to pass the quantity from structure field XVBAPF-ERLMENGE_L which is defined as a floating decimal field, into a decimal field TKOMP-MGLME (decimal field with 3 decimals). Normally I would expect that the conversion would be automatic... however, it appears as though the data is being passed into the last remaining decimals of the target field....
IE:
XVBAPF-ERLMENGE_L = '2.000000000E00'
data: test1 type p decimals 2,
test2 type p decimals 4,
test3 type p decimals 8.
Move: xvbapf-erlmenge to test1,
xvbapf-erlmenge to test2,
xvbapf-erlmenge to test3.
Results:
TEST1 = 0.02
TEST2 = 0.0002
TEST3 = 0.00000002
WTF? Is there any standard conversion routine to accurately move floating point with exponent E00 into a packed field???
Thanks,
Dave
Most likely that the main program of user-exit has flag 'Fixed-point arithmetic' cleared in its properies. Workaround - move your calculations into separate subroutine pool or function group and make sure that that very flag is set (actually it is set by default).
_________________
Best regards, Sergey Korolev
Hi ,
Use FM : CHAR_FLTP_CONVERSION_TO_SI.
Thanks,
PrabhuRajesh.
Hi...
I'm working on a user exit in SD and I've run into the following problem.
I'm trying to pass the quantity from structure field XVBAPF-ERLMENGE_L which is defined as a floating decimal field, into a decimal field TKOMP-MGLME (decimal field with 3 decimals). Normally I would expect that the conversion would be automatic... however, it appears as though the data is being passed into the last remaining decimals of the target field....
IE:
XVBAPF-ERLMENGE_L = '2.000000000E00'
data: test1 type p decimals 2,
test2 type p decimals 4,
test3 type p decimals 8.
Move: xvbapf-erlmenge to test1,
xvbapf-erlmenge to test2,
xvbapf-erlmenge to test3.
Results:
TEST1 = 0.02
TEST2 = 0.0002
TEST3 = 0.00000002
WTF? Is there any standard conversion routine to accurately move floating point with exponent E00 into a packed field???
Thanks,
Dave