ā2014 Nov 03 2:00 PM
Hi Group,
Hi ,
its regarding ABAP arithmetic,In my input file I am getting 3 currency fields name LM,PM, CM every time
I need to check the condition PM = LM - CM ,if it is not true needs to raise error message.
this is all working fine , but when I am getting negative values in the file my calculation going wrong ,instead of subtraction it is doing addition.I am getting the below scenarios:
LM +
PM +
CM -
LM -
PM -
CM +
Can any body suggest how I can handle this in ABAP.
ā2014 Nov 03 2:53 PM
Hi Rajiv,
this is normal mathematic behaviour LM - (-CM) is the same as LM + CM...
If this behaviour is unwanted, check if the value is below 0 and then multiplicate with -1
Regards,
Dominik
ā2014 Nov 04 12:01 AM
Hi Rajiv,
If you do not want to consider the sign of each currency you can use the abs(variable) mathematical function.
Thanks & Regards,
Vijeta Galani.
ā2014 Nov 04 5:31 AM
Hi,
PM = LM - CM is same as LM = PM + CM. This will solve the - sign problem.
ā2014 Nov 04 5:37 AM
ā2014 Nov 04 6:39 AM
Let's say:
LM = 5
CM = -3
LM-CM = 8. So PM must be 8.
LM = -5
CM = 3
LM-CM = -2. So PM must be -2.
Why do you expect anything else? What are you actually trying to do? What is the business scenario.
ā2014 Nov 05 9:53 AM
I guess he wants to find difference of absolute values, ignoring sign.
ā2014 Nov 05 10:59 AM