‎2007 Sep 05 7:30 AM
Hi ,
price is in curr with 2 decimals, while qty is in data type DEC, 5.
cal = ( price / qty )
i want to get the calc in 3 decimal points.
when i put calc as p decimal 3 it gave a different value.
Eg, 58.467/10 gave as 0.585 where as it should be 5.847
Can any one advise as to which data type i should use for calc field.
Thanks
Keshi
‎2007 Sep 05 7:51 AM
data : l_price type bseg-dmbtr,
l_qty type p decimals 5,
l_cal type p decimals 3.
l_price = '58.467'.
l_qty = 10.
l_cal = l_price / l_qty .
WRITE 😕 l_cal.
‎2007 Sep 05 9:09 AM
Hi,
the problem is with the <b>attribute of the program</b> where your are writing the code for division.
open the prog in SE38 and check the <b>Fixed point arithmetic</b> parameter - i guess u ll find it dechecked. To get proper result <b>u need to have it checked</b>.
if you are inside a customer exit/include then you will have to create a function module for doing the calculations and related stuffs.
hope it solves ur prob.