Skip to Content

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

Query To Display Qty Purchased & Used

Hello Experts

I need a query that asks a user to input a range of stock codes and a date range

The query results should display the Stock Code, Quantity purchased and Quantity used in a production order

I don't know which tables I need to use to even try

Would someone please help me

Thanks and Regards



Hi Rahul,

Then please use this query

SELECT T1.[ItemCode] as 'Stock Code',

T1.[ItemName] as 'Stock Description',

Sum(T0.InQty) as 'Total Purchased',

Sum(T0.OutQty) as 'Total Used'

FROM [dbo].[OINM]

  T0 INNER JOIN [dbo].[OITM]  T1 ON T0.ItemCode = T1.ItemCode


T1.[ItemCode] >=[%0] and

T1.[ItemCode] <=[%1] and

T0.[DocDate] >=[%2] and

T0.[DocDate]  <=[%3]

GROUP BY T1.[ItemCode], T1.[ItemName]

ORDER BY T1.[ItemCode]



0 View this answer in context

Helpful Answer

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