Skip to Content
author's profile photo Former Member
Former Member

Compare 2 sums for invoices

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Apr 26, 2012 at 10:38 AM

    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..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 26, 2012 at 12:58 PM


    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
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 26, 2012 at 01:37 PM

    Basic

    Locked.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.