小崔说SAP技术博客 - 库位
type: channel
link: https://www.sapxiaocui.top/index.php/tag/%E5%BA%93%E4%BD%8D/
items: SAP B1 批次、库位交易明细表查询SQL

SAP B1 批次、库位交易明细表查询SQL
type: item
date: 2023-04-27T01:49:00+00:00
description: 项目上写的，供参考哈：SELECT T0."ItemCode" "物料编码",T0."ItemName" "物料名称",T2."DistNumber" "批次信息",T0."LocCode" "仓库",T4."BinCode" "库位",SUM(T3."Quantity") "数量",T2."MnfSerial" "批次属性1", T2."LotNumber" "批次属性2", CAST(T2."Notes" AS NVARCHAR(200)) "明细"FROM "OITL" T0 --批次交易主表INNER JOIN "ITL1" T1 ON T0."LogEntry" = T1."LogEntry" AND T0."ItemCode" = T1."ItemCode" AND ISNULL(T1."LogEntry",'') <>'' --批次交易明细表NNER JOIN "OBTN" T2 ON T1."ItemCode" = T2."ItemCode" AND T1."SysNumber" = T2."SysNumber" AND T1."MdAbsEntry" = T2."AbsEntry" --批次信息表LEFT JOIN "OBTL" T3 ON T2."AbsEntry" = T3."SnBMDAbs" AND T1."LogEntry" = T3."ITLEntry"INNER JOIN "OBIN" T4 ON T3."BinAbs" = T4."AbsEntry"INNER JOIN "OWHS" T5 ON T0."LocCode"= T5."WhsCode" WHERE T5."BinActivat"='Y'GROUP BY T0."ItemCode", T0."ItemName", T2."DistNumber",T0."LocCode", T4."BinCode", T2."MnfSerial", T2."LotNumber", CAST(T2."Notes" AS NVARCHAR(200)) HAVING SUM(T1."Quantity")<>0ORDER BY T0."ItemCode",T2."DistNumber" ;