07-04-2007 7:34 AM
Hi Guys/Gals,
I'm going the foll. arithmetical operation in MV45AFZZ include...
Data: NUM type VBAP-KWMENG,
DEN type VBAP-KWMENG,
RES type VBAP-KWMENG.
clear:num,den,res.
num = 1000.000.
den = 10000.000
res = num / den .
This gives me zero(0) as result....
suppose the value of num = 10000 and den = 1000
then the res is 0.10 ...
Can anyone help me in this...
Regs.
Jiku
07-04-2007 7:39 AM
Hi
First it will give syntax error.
see this it will work
Data: NUM type VBAP-KWMENG,
DEN type VBAP-KWMENG,
RES type VBAP-KWMENG.
clear:num,den,res.
num = '1000.000'.
den = '10000.000'.
res = num / den .
write:/ res.
Reward points for useful Answers
Regards
Anji
07-04-2007 7:41 AM
07-04-2007 7:44 AM
In your code 'KWMENG' is a quantity field, so when you divide the values the decimal points are truncated. If you want the output to be in your required format,
change the type of result to 'Float' i.e., RES TYPE F DECIMALS 2.
Regards,
Pavan P.
07-04-2007 7:55 AM
THE NUM = 10000.00 AND DEN = 100000.00....THIS IS NOT A HARD CODED VALUE...
THIS GETS POPULATED IN RUNTIME....
07-04-2007 7:54 AM
Hi,
you have to check ' Fixed point arithmetik' in your program attributes (e.g. when you create the program).
VBAP-KWMENG is type p. Type p is handled like a whole number (without decimals), if you haven't check ' Fixed point arithmetik' .
Regards, Marina