‎2010 May 25 10:32 AM
Hi,
I'm facing an issue while division . I have piece of code which is working fine when it is run in a separate program and the same code included into a program its not able to divide.
This code is workign fine separately
DATA: V_ZAR TYPE NETWR_AK,
V_RATE TYPE KOMVD-KWERT value '4918.88',
lv_rate type kursk value '14.07301-',
lv_char(12).
break-point.
move lv_rate to lv_char.
if lv_char ca '-'.
v_zar = ( v_rate DIV lv_rate ) * -1.
endif.
break-point.And please check this code
The problem is with this code
DATA: V_ZAR TYPE NETWR_AK, " ZAR Currency Amount
V_RATE TYPE KURSK. " Exchange Rate
if lv_rate ca '-'.
V_ZAR = ( KOMVD-KWERT DIV V_RATE ) * C_1.
else.
V_ZAR = KOMVD-KWERT * V_RATE.
endif.
After division V_zar holds 0.00
Thanks & Regards
- Always Learner
‎2010 May 25 10:38 AM
Hi
what's the value of C_1??
you are sure that you are not multiply per 0?
or that all the value al valorized'??
regards
Marco
‎2010 May 25 10:38 AM
Hi
what's the value of C_1??
you are sure that you are not multiply per 0?
or that all the value al valorized'??
regards
Marco
‎2010 May 25 10:43 AM
Hi Menegazzo,
Thanks for your reply, C_1 is a constant.
constants : c_1 type i value '-1'.Thanks
‎2010 May 25 10:47 AM
Hi
have you tried if with
V_ZAR = KOMVD-KWERT * V_RATE.
V_ZAR is different of 0.00?
regards
marco
‎2010 May 25 10:51 AM
Thanks Marco,
V_ZAR = KOMVD-KWERT * V_RATE.V_ZAR is getting correct result in multiplication. The problem is in division. I
‎2010 May 25 10:55 AM
Hi
this issue is very strange because the data types are equal in both the code..
the only think can be that the values are not correct
try to replace DIV with /.....
regards
Marco
‎2010 May 25 10:58 AM
I replaced '/' with DIV because it was not working. Yes its a strange problem thats why i posted this thread, thought like i may get some ideas to overcome this issue. Anyways thanks Marco for your time spent on my issue.
‎2010 May 25 10:59 AM
‎2010 May 25 11:05 AM
Hi...
i have understand the problem.
The DIV not work because it cut the decimal number....so if the result is 0,45 you will see 0.00.... else if is 1,45 you will see 1.
with / you not resize the number for that if you have 0,45 you will se 0,45 and so on.
replace the value in you working code
DATA: V_ZAR TYPE NETWR_AK,
V_RATE TYPE KOMVD-KWERT value '1',
lv_rate type kursk value '2-',
lv_char(12).
break-point.
move lv_rate to lv_char.
if lv_char ca '-'.
v_zar = ( v_rate DIV lv_rate ) * -1.
endif.
break-point.
v_zar will be 0.00 and not 0.5.
regards
Marco
Edited by: Menegazzo Marco on May 25, 2010 12:07 PM
‎2010 May 25 11:25 AM
Hi,
Select the checkbox of your program attributes of FIXED POINT ARTHMETIC
in SE38 Select the ATTRIBUTES radion button and click on CHANGE button then select this CHEK BOX
This would resolve your issue
Cheerz
Ram
‎2010 May 25 11:56 AM
‎2010 May 25 11:02 AM
null
Edited by: luigi la motta on May 25, 2010 12:10 PM
Edited by: luigi la motta on May 25, 2010 12:10 PM
‎2010 May 25 11:03 AM
Hi ,
It may be because you are validating lv_rate not the v_rate variable , just check it out your code .
The problem is with this code
DATA: V_ZAR TYPE NETWR_AK, " ZAR Currency Amount
V_RATE TYPE KURSK. " Exchange Rate
if lv_rate ca '-'.
V_ZAR = ( KOMVD-KWERT DIV V_RATE ) * C_1.
else.
V_ZAR = KOMVD-KWERT * V_RATE.
endif.
After division V_zar holds 0.00
Best Regards,
Prasad