2010 Aug 02 7:51 AM
In the user exit MV45AFZZ, when dividing a figure, I always get an incorrect result.
For example, 75.00 / 1.500 = 0.05 << it should be 50
here is my code (simplified for testing):
DATA: wa type vbap.
SELECT *
FROM vbap
INTO corresponding fields of wa
WHERE VBELN = '...' and
POSNR = '...'.
wa-NETWR = wa-NETWR / wa-KWMENG. <-- 75.00 / 1.500 = 0.05
wa-CMPRE = wa-CMPRE / wa-KWMENG. <-- 53.50 / 1.500 = 0.04
ENDSELECT.
If I copy the same code to a ZProgram, I get a correct result.
Would you please tell me what's wrong and how to solve the problem in the user exit MV45AFZZ?
In the user exit MV45AFZZ, when dividing a figure, I always get an incorrect result.
For example, 75.00 / 1.500 = 0.05 << it should be 50
here is my code (simplified for testing):
DATA: wa type vbap.
SELECT *
FROM vbap
INTO corresponding fields of wa
WHERE VBELN = '...' and
POSNR = '...'.
wa-NETWR = wa-NETWR / wa-KWMENG. <-- 75.00 / 1.500 = 0.05
wa-CMPRE = wa-CMPRE / wa-KWMENG. <-- 53.50 / 1.500 = 0.04
ENDSELECT.
If I copy the same code to a ZProgram, I get a correct result.
Would you please tell me what's wrong and how to solve the problem in the user exit MV45AFZZ?
2010 Aug 02 7:56 AM
I think main program's "Fixed Point Arithmetic" attribute is unchecked. You can use a custom function module to make the calculation.
2010 Aug 02 8:01 AM
>
> I think main program's "Fixed Point Arithmetic" attribute is unchecked. You can use a custom function module to make the calculation.
Can I check the "Fixed Point Arithmetic" attribute? Will it solve the problem?
2010 Aug 02 8:04 AM
The main program must be SAP standard program, so it will take a repair to do this. Besides, it can effect any other part of the program. So developing a little function module according to your need will be a better idea.
2010 Aug 02 9:24 AM
Try with this
wa-NETWR = ( wa-NETWR / ( wa-KWMENG * 1000 )) *1000
wa-CMPRE = ( wa-CMPRE / ( wa-KWMENG * 1000))* 1000
2010 Aug 02 9:34 AM
Dear Kerem Kayacan,
I'll try to create the FM, and award more points if it works.
Dear Sridhar N,
Your formula works if it's in a ZProgram; however, it still doesn't work when it's in the user exit. The result I get is 0.00
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |