11-21-2005 4:52 PM
I have two field
a LIKE MBEWH-LKBUM (QUAN 13)
b LIKE MBEWH-VERPR (CURR 11)
When I multiply them together
e.g. a = 10.000, b = 50.00
It gives 500000.00 rather than 500.00
I don't know why and can't figure out what's the problem. Please help. Thanks!
11-21-2005 4:59 PM
In your program, do you have "Fixed point arithmatic" checked in the program attributes? click goto -> attributes. Check the box for it and run it again.
I just check it in my system. I do think that this is your problem. Please make sure that you check that box in the program attributes.
report zrich_0001
no standard page heading.
data:
a type mbew-lbkum value '10.000',
b type mbew-verpr value '50.000'.
data: result type mbewh-lbkum.
result = a * b.
write:/ result.
Please reward points and mark your post as solved. Thanks.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
11-21-2005 4:59 PM
In your program, do you have "Fixed point arithmatic" checked in the program attributes? click goto -> attributes. Check the box for it and run it again.
I just check it in my system. I do think that this is your problem. Please make sure that you check that box in the program attributes.
report zrich_0001
no standard page heading.
data:
a type mbew-lbkum value '10.000',
b type mbew-verpr value '50.000'.
data: result type mbewh-lbkum.
result = a * b.
write:/ result.
Please reward points and mark your post as solved. Thanks.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
11-21-2005 5:09 PM
I agree with Rich, check the attribute "Fixed point arithmatic" of your program.
Max
11-21-2005 5:00 PM
Hi Gundam,
i tried this code:
data:a LIKE MBEWH-LBKUM,
b LIKE MBEWH-VERPR.
a = '10.000'.
b = '50.00'.
a = a * b.
a now is 500.000
try to check the the type of result variable.
It may be caused by it.
Regards, Manuel
11-21-2005 5:24 PM
Hi Gundan,
The currency field behaviour is little confusing in SAP. Every amount field has reference field for the currency in which amount is being represented. Though the field might see to contain 500000, but if you use write statement with currency clause ( write MBEWH-VERPR currency T001-WAERS ), it will give you the correct amount.
The reson behind this that every currency has fixed number of decimal places ( table TCURX , currecies not in this table are assumed to have 2). The amount in the currency field is devided by ( 10 power number of decimal places in currency). Therefore, for USD, the amount will be devided by 100.
11-21-2005 10:27 PM
Are you doing this calculation in some kind of user exit? If so, check the attributes of the main program of this transaction as suggested by others here. It is not the attribute of the include in which you are writing the user exit code.
If it an user exit that you are doing this in, then you need to manually do the divisions.
Srinivas