Skip to Content
avatar image
Former Member

A/P Cash Discounts Query

Hello Experts,

I am trying to query the list of all Open AP Invoices which are eligible for Cash Discounts.

Scenario : For Instance in OEC Computers,I have the following Open documents in SAP

DocNum CardCode PostingDate DueDate PaymentTerms

110 V10000 06/18/2010 07/19/2010 2P10Net30 ( Eligible for 2 % discount if paid within 10 days from posting date)

114 V20000 06/18/2010 08/09/2010 2P10Net45 ( Eligible for 2 % discount if paid within 10 days from posting date)

Let us say a user wants to run a check today and would like to know what documents are eligible for cash discounts based on duedate 07/02/10.

I am using the following query but does not seems to be working exactly:

select t0.DocNum,t0.CardCode,t0.CardName

,t0.DocTotal as Amount

,t0.DocDate as PostingDate

,t0.DocDueDate as DueDate

,t1.PymntGroup as PaymentTerms

,t2.Discount

,t1.ExtraDays

,t2.NumOfDays

from OPCH t0 inner join OCTG t1 on t0.GroupNum=t1.GroupNum

inner join CDC1 t2 on t1.DiscCode=t2.CdcCode

where T0.DocDate>= '[%0]' AND T0.DocDueDate<= '[%1]'+DATEADD(DAY,10,t0.DocDate) and t0.DocStatus='O'

Any help would be appreciated.

Thanks,

Praneeth

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jun 24, 2010 at 03:26 AM

    Hi,

    It's working fine, except that you have to change

      '%0' to [%0] 

    Cheers 😊

    Edited by: Yeni Amin on Jun 24, 2010 5:26 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 24, 2010 at 06:15 AM

    Hi Praneeth,

    Try this:

    from OPCH t0

    inner join OCTG t1 on t0.GroupNum=t1.GroupNum

    inner join CDC1 t2 on t1.DiscCode=t2.CdcCode

    where t0.DocStatus='O' AND DateDiff(DD,T0.DocDate, GetDate())< T2.NumOfDays

    Thanks,

    Gordon

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 09, 2010 at 10:11 PM

    Self Resolved

    Add comment
    10|10000 characters needed characters exceeded