Skip to Content
Feb 03, 2015 at 04:03 AM

Query for calculating raw material requirements for the remaining quantities in sale order.


Dear SAP Experts,

Clients requirement :

Client wish to know the quantities of raw materials needs to run the production order inorder to complete the remaining quantities in sale order.

Need Clarification:

I"m using the below query for this requirement. I wish to know whether this query suits for my clients requirement or not. If its so, I need to know how to group by T4.[Code] (Raw material Name) and need to get the sum of T4.[Quantity] (BOM quantity) and (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY under each raw material group

SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode],T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity] as salesorderQty , T1.[OpenQty], T2.onhand, T4.[Code] as Raw material Name,T4.[Quantity] as BOMQTY, (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OITT T3 ON T2.[ItemCode] = T3.[Code] INNER JOIN ITT1 T4 ON T3.[Code] = T4.[Father] WHERE T0.[DocStatus] ='o'