‎2008 Aug 29 2:42 PM
Hello gurus,
I am dividing 0.7600 by 1000 --- the value shoud be 0.00076
The variable in which this value is calculated is type P decimal 6.
Now after dividing i get a value equals 0.000008.
I dont know how to go abt it.
also when i changed the type of the variable to F then i got an exponential value in the output.
Please help me.
Regards,
Roshan Lilaram Wadhwani.
‎2008 Aug 29 2:47 PM
‎2008 Aug 29 2:43 PM
Hi,
Welcome to SDN.
declare type P decimal 9 in place of type P decimal 6.
Regards,
Anirban
‎2008 Aug 29 2:47 PM
Sorry sir,
On trying that i was getting a value 0.000000008.
If you dont mind then can i ask you on what basis did you ask me to change it to 9, does this type P works on multiples of 3???
Regards,
Roshan.
‎2008 Aug 29 2:45 PM
‎2008 Aug 29 2:51 PM
Hello,
Thanks for replying to my query.
kalc-value = 0.7600
ekpo-peinh = 1000
gv_unitprice = KALC-VALUE / EKPO-PEINH .
This is my basic requirement.
here i am unable to get that 0.000760
‎2008 Aug 29 2:52 PM
kalc-value has 4 decimal places in Data Dictionary. How did you define it in your program?
‎2008 Aug 29 2:55 PM
Hello,
Actually this program is a copy of the standard program.
We are directly using it, we have not defined it explicitly.
Regards,
Roshan.
‎2008 Aug 29 2:47 PM
‎2008 Aug 29 2:53 PM
Hello,
Thanks for the reply.
Fixed point arithmetic is not checked
Regards,
Roshan.
‎2008 Aug 29 2:53 PM
tha pls. check and try agaon. also check the definition of calc-value!
‎2008 Aug 29 2:58 PM
Hello,
Sir, This is an include program, we dont have that option there and in the main program it is not checked.
KALC-VALUE is a standard field with decimal places 4.
Regards,
Roshan.
‎2008 Aug 29 3:02 PM
>
> KALC-VALUE is a standard field with decimal places 4.
in this case, there is no chance, the value of 0.00076 will be automatically rounded to 0....8 by the system (because of the 4 decimals).
you say the copied program still using the standard include? probably you can copy the include as well and make the necessary modifications
‎2008 Aug 29 3:08 PM
Hello,
Sorry to offend you but what exactly do you mean by " there is no chance, the value of 0.00076 will be automatically rounded to 0....8 by the system (because of the 4 decimals)."
should i transfer the below two variables to decimal 6 local variables and then they shoud be divided.
kalc-value = 0.7600
ekpo-peinh = 1000
gv_unitprice = KALC-VALUE / EKPO-PEINH .
Regards,
Roshan Lilaram.
‎2008 Aug 29 3:14 PM
It looks like, your main program does not have the "Fixed Point Airtmetic" checkbox set in the Program > Attributes.
data: gv_unitprice type p decimals 8,
l_value type p decimals 4,
l_peinh type ekpo-peinh.
l_value = '0.7600'.
l_peinh = 1000.
gv_unitprice = l_VALUE / l_PEINH .
write: gv_unitprice.
With the "Fixed Point Airthmetic" checkbox set, I got the this result:
0.00076000
Without the "Fixed Point Airthmetic" checkbox set, I got the this result:
0.00000008
Regards,
Naimesh Patel
‎2008 Aug 29 3:01 PM
Hello Roshan.
In Agreement with Rich.
His code works fine and may be you might have divided with something else which has given you "0.000008"
Good Luck & Regards.
Harsh Dave