查询带库位的批次交易数量
小于 1 分钟
查询带库位的批次交易数量
通过此案例可查询交易单据交易的批次数量,切记本段关系需要包含库位信息的T0.[TransType]需要等于基本单据类型
SELECT T0.[DocEntry], T0.[TransType] , T0.[ItemCode], T4.[BatchNum],T1.[Quantity]
FROM OILM T0
INNER JOIN OBTL T1 ON T0.[MessageID] = T1.[MessageID]
INNER JOIN OBTN T3 ON T3.ABSENTRY = T1.[SnBMDAbs]
INNER JOIN IBT1 T4
ON T4.[BatchNum] = T3.[DistNumber]
AND T4.itemcode = t0.itemcode
AND T4.[WhsCode] = T0.[LocCode]
AND T4.[BaseEntry] = T0.[DocEntry]
ORDER BY T0.DocEntry DESC,t0.DocLineNum