Hi Experts,
I americium trying to make a query to show each unfastened draught documents with the enactment details for goods receipt PO. this includes Bin locations nevertheless ive deed a partition arsenic incorperating ODRF and DRF1 into OPDN, PDN1 has thrown my results fully. tin immoderate counsel wherever im going incorrect connected the below:
SELECT
OPDN.DocNum,
pdn1.ItemCode,
OBTL.Quantity AS Quantity,
OBin.BinCode,
Ousr.U_NAME
FROM
opdn
INNER JOIN
pdn1 ON opdn.docentry = pdn1.docentry
INNER JOIN
OITM ON pdn1.ItemCode = OITM.ItemCode
INNER JOIN
oivl ON oivl.ItemCode = pdn1.ItemCode
AND oivl.TransType = 20
AND pdn1.LineNum = oivl.DocLineNum
LEFT JOIN
OBTL ON oivl.MessageID = obtl.MessageID
LEFT JOIN
OBIN ON obin.AbsEntry = obtl.BinAbs
LEFT JOIN
POR1 ON pdn1.BaseType = 22
AND PDN1.BaseEntry = POR1.DocEntry
AND PDN1.BaseLine = POR1.LineNum
LEFT JOIN
OPOR ON OPOR.DocEntry = POR1.DocEntry
LEFT JOIN
OUSR ON OPDN.UserSign = OUSR.USERID
WHERE
opdn.DocStatus = 'O' AND opdn.draftkey IS NOT NULL