2014 Apr 14 11:41 AM
Hello expert,
I make an enhancement in PO when i make some calculation the result get zero as the example below
SELECT SINGLE NETWR
FROM ESSR
INTO EKKO_VAL
WHERE EBELN = WA-EBELN
AND EBELP = WA-EBELP.
SELECT SINGLE BRTWR
FROM EKPO
INTO EKPO_VAL
WHERE EBELN = WA-EBELN
AND EBELP = WA-EBELP.
EKKO_VAL = 15000,00
EKPO_VAL = 50000,00
BALANCE = EKKO_VAL / EKPO_VAL .
BALANCE must be 0.03 but it is coming zero ,any body can help ,thanks.
2014 Apr 14 11:53 AM
Hi Ahmed,
Please mention the type declaration used for EKKO_VAL , EKPO_VAL and BALANCE in the program.
2014 Apr 14 11:53 AM
Hi Ahmed,
Please mention the type declaration used for EKKO_VAL , EKPO_VAL and BALANCE in the program.
2014 Apr 14 12:21 PM
2014 Apr 14 1:01 PM
If the enhancement belongs to a program with the flag "fixed point arithmetic" switched off, you will get 0. If it is switched on, you will get 0.30.
In older ABAP programs, find the "fixed point arithmetic" flag switched off. In more recent programs, and when creating new programs, the flag will be switched on by default.
If "fixed point arithmetic" is switched off, all decimal points will be ignored, and all intermediate results will be rounded to integers.
data: x type p length 7 decimals 2,
y type p length 7 decimals 2,
z type p length 7 decimals 2.
x = '15000.00'.
y = '50000.00'.
z = x / y.
write z. " --> 0.30 with fixed point arithmetic, 0.00 without fixed point arithmetic
Regards,
Rüdiger
2014 Apr 14 1:32 PM
Thanks rudiger for your replay,
but it is include program where can I find the flag of 'fixed point arithmetic' because the result still coming zero
2014 Apr 14 2:01 PM
Hi Ahmed, an include program is included in a main program. It is the flag of the main program that counts.
But for old SAP programs, you'll mess them up by changing that flag, so changing the flag to 'X' would be no solution. If you're in an exit, you have two options:
Regards,
Rüdiger
2014 Apr 14 2:20 PM
thanks guru I change the "fixed point arthimetic" in the main program and now it is working correctly.
2014 Apr 14 2:22 PM
That's what I said you better NOT do! 🙂 As I said in my last reply, in old programs you will mess up all the other (old) computations of the standard when changing their fixed point arithmetic flag!!!
2014 Apr 14 2:45 PM
yes yes i just test it but i create new function and assigned it to the include program and working.