Hello, this is my very first post here and I am new to SAP world.
I would like to build a query to show me all open lines from sales orders which I already have on hand in warehouse named 01.
I came up with the following :
SELECT DISTINCT
T0.CardCode AS 'CUSTOMER CODE',
T0.CardName AS 'CLIENT'
FROM dbo.ORDR T0
INNER JOIN dbo.RDR1 T1 ON T0.DocEntry = T1.DocEntry AND T1.LineStatus = 'O'
INNER JOIN dbo.OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN dbo.OITW T3 ON T2.ItemCode = T3.ItemCode AND T3.WhsCode = '01'
WHERE
T3.OnHand >= T1.Quantity
ORDER BY T0.CardName
It's working almost as I want but it still show orders that which contains items that I don't have on hand.
Can someone give me hint what's wrong with my query?