‎2008 Jul 30 9:00 AM
HI guys,
fixed point arithemtic in my program is unticked and I want it that way. But I have a question on what's the explanation behind this issue
v_netprice like LIPS-NETPR
v_net value like bapiitemin-req_qty
v_qty type lips-lgmng
v_net_value = 436927.2000
v_qty = 240.000
v_netprice = v_net_value / v_qty.
In v_netprice, I am getting 1.8205... Why is this so?
Thanks a lot!
‎2008 Jul 30 9:11 AM
Hi Mark,
If you mark this checkbox, *all caluculations in the program will use fixed point arithmetic
If you do not, packed numbers (ABAP/4 type P, Dictionary types CURR, DEC or QUAN) will be treated as integers when they are used in assignments, comparisons and calculations, irrespective of the number of decimal places defined. Intermediate results in arithmetic calculations will also be rounded to the next whole number. The number of decimal places defined is only taken into account when you output the answer using the WRITE statement.
Regards,
Swapna.
‎2008 Jul 30 9:06 AM
Hi,
Check fixed point arithmetic option F1 help.
goto->attributes-> fixed point arithmetic
press F1.
Regards
Adil
‎2008 Jul 30 9:06 AM
Please declare v_netprice as a packed number.
Thanks and Regards ,
Debojyoti.
‎2008 Jul 30 9:07 AM
hi Mark,
I have tried the below code on my system and i am getting the value correctly ...
data : v_netprice type NETPR,
v_net_value type NETPR,
v_qty type lips-lgmng.
v_net_value = '436927.2000'.
v_qty = '240.000'.
v_netprice = v_net_value / v_qty.
write : v_netprice.
‎2008 Jul 30 9:09 AM
hiii
just set from menu->goto->attributes->mark checkbox fixed point arithmetic..it will give you a correct answer
regards
twinkal
‎2008 Jul 30 9:09 AM
look at the field description for field bapiitemin-req_qty
'Order qty in sales units - 00009001 corresponds to 9.001'
Might be U got the result as .. 1820.5.. but it is showing as
1.8205 ..
‎2008 Jul 30 9:11 AM
Hi Mark,
If you mark this checkbox, *all caluculations in the program will use fixed point arithmetic
If you do not, packed numbers (ABAP/4 type P, Dictionary types CURR, DEC or QUAN) will be treated as integers when they are used in assignments, comparisons and calculations, irrespective of the number of decimal places defined. Intermediate results in arithmetic calculations will also be rounded to the next whole number. The number of decimal places defined is only taken into account when you output the answer using the WRITE statement.
Regards,
Swapna.