Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Division in MV45FZZ ......Very urgent

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

Define RES as type '<b>F</b>'.

Regards

Raj

Former Member
0 Kudos

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.

0 Kudos

THE NUM = 10000.00 AND DEN = 100000.00....THIS IS NOT A HARD CODED VALUE...

THIS GETS POPULATED IN RUNTIME....

marina_plag
Explorer
0 Kudos

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