11-07-2014 12:46 PM
The value of <LFS_DECFLOAT> is correct whereas <LFS1_DECFLOAT> looks to be incorrect. Can anyone explain why the value of <LFS_DECFLOAT> GT 1?
Many Thanks, Tanmoy
11-07-2014 1:00 PM
May be u use the same memory space. Try this
DATA: lv_dec16 TYPE DECFLOAT16,
lv_dec34 TYPE decfloat34,
lv_dec34_2 TYPE decfloat34.
FIELD-SYMBOLS: <lf_dec> TYPE decfloat,
<lf_dec1> TYPE decfloat.
lv_dec34 = 1 / 9.
lv_dec34_2 = 1 / 9.
ASSIGN lv_dec34 TO <lf_dec>.
ASSIGN lv_dec34_2 TO <lf_dec1> CASTING TYPE decfloat34."changed to 34
IF sy-subrc IS INITIAL.
ENDIF.
Regards,
Alberto Montes
11-07-2014 2:19 PM
I don't understand why does the value get changed? It should still be 0.111111111111111 at most.
Thanks, Tanmoy
11-11-2014 9:10 AM
DATA: lv_dec16 TYPE DECFLOAT16,
lv_dec34 TYPE decfloat34,
lv_dec34_2 TYPE decfloat34.
FIELD-SYMBOLS: <lf_dec> TYPE decfloat,
<lf_dec2> TYPE decfloat.
lv_dec34 = 1 / 9.
lv_dec16 = 1 / 9.
ASSIGN lv_dec34 TO <lf_dec>.
ASSIGN lv_dec16 TO <lf_dec2>.
IF sy-subrc IS INITIAL.
ENDIF.
I think you cant do that, because decfloat do the conversion automaticly. So if you have a decfloat16 variable, the assign to decfloat do the conversion decfloat16->decfloat. And the same with decfloat34. I supose you force the conversion of decfloat to decfloat16, first the assign to decfloat from decfloat34 and then the forced conversion to decfloat16. The data changes because you are watching the number of a decfloat like a decfloat16.