Need to develop a part of code that does compare 2 sums and allow a slight difference.
Now our code is:
IF NOT Invoice sum = Purchase order sum (exact amount)
EXIT.
We want to make both these sums to be + / - 5 in the sum of the amounts, to allow the differences in pennies.
What is the best way to go about it?
Help will be rewarded.
make a Range table...
Eg Invoice Sum = 100.. So Range table should have a value as
Low = 99.5 and High 100.5.
And then check PO sum is BETWEEN this range or not..
Hi,
This is one way. It will show OK or NOT OK based on difference of 0.05. (you can change that value).
data : l_invoice type p decimals 2,
l_po type p decimals 2.
data : l_diff type p decimals 2.
*------------------ Values for testing
l_invoice = '100.78'.
l_po = '100.86'.
*----- Find difference
l_diff = l_invoice - l_po.
l_diff = abs( l_diff ).
write l_diff.
if l_diff <= '0.05'.
write 'OK'.
else.
write 'NOT OK'.
endif.
Regards,
Amit Mittal.
Add a comment