Skip to Content

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

Sales by Bill To State Query question

I have the following query that shows sales by Bill to State for a specified period of time.

SELECT T2.[State] AS 'Bill-To State', SUM(T0.[Max1099]) AS 'Gross Sales Amount' FROM  [dbo].[OINV] T0  INNER  JOIN [dbo].[OCRD] T1  ON  T1.[CardCode] = T0.[CardCode]  INNER  JOIN [dbo].[CRD1] T2  ON  T2.[CardCode] = T1.[CardCode]  AND  T2.[Address] = T0.[PayToCode]   WHERE T1.[GroupCode] <> 28 AND T0.[DocDate]>=[%0] AND T0.[DocDate]<=[%1] AND T2.[AdresType]='B' GROUP BY T2.[State]

If I create another query to capture credit memos (below), I get the following error:

"Can not add row without complete selection of batch/serial numbers"

SELECT T2.[State] AS 'Bill-To State', SUM(T0.[Max1099]) AS 'Gross Sales Amount' FROM  [dbo].[ORIN] T0  INNER  JOIN [dbo].[OCRD] T1  ON  T1.[CardCode] = T0.[CardCode]  INNER  JOIN [dbo].[RIN1] T2  ON  T2.[CardCode] = T1.[CardCode]  AND  T2.[Address] = T0.[PayToCode]   WHERE T1.[GroupCode] <> 28 AND T0.[DocDate]>=[%0] AND T0.[DocDate]<=[%1] AND T2.[AdresType]='B' GROUP BY T2.[State]



Does anyone have advice?


Thanks


Gary

replied

Hi Gary,

[RIN1] is not the right table to join. It is CRD1.


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