Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sales Summary Query

Hello All --

We use this Query below to get a summary of Invoice / Credit Memo Postings each day. However, noticed that the numbers have changed when we checked today compared with last time -- maybe a week ago.

Shouldn't these numbers stay the same! Please advise why the numbers are different now than before. These are for sales generated in Sept.

Thanks!

Mike

SELECT T1.RefDate, SUM(T0.Debit - T0.Credit) as 'Net Balance'

from JDT1 T0

Inner Join OJDT T1 ON T1.TransId = T0.TransID and

(T1.TransType = '13' or T1.TransType = '14')

Inner Join OCRD T2 ON T2.CardCode = T0.ShortName

INNER JOIN OINV T3 ON T3.TransId = T1.TransId

Where T3.DocDate Between '[%0]' and '[%1]' and T2.CardType = 'C'

Group by T1.RefDate

Order By T1.RefDate

Former Member
Former Member replied

Please try this:

SELECT T1.RefDate, SUM(T0.Debit - T0.Credit) as 'Net Balance' 
from JDT1 T0
Inner Join OJDT T1 ON T1.TransId = T0.TransID and
(T1.TransType = '13' or T1.TransType = '14')
Inner Join OCRD T2 ON T2.CardCode = T0.ShortName
LEFT JOIN OINV T3 ON T3.TransId = T1.TransId
LEFT JOIN ORIN T4 ON T4.TransID = T1.TransId
Where (T3.DocDate Between '[%0]' and '[%1]' or T4.DocDate
 Between '[%0]' and '[%1]') and T2.CardType = 'C' 
Group By T1.RefDate
Order By T1.RefDate

Thanks,

Gordon

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question