2020-08-14 23:15发布
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
大家好,
我正在通过sql查询从bin位置获取批次数量。
箱位定位功能是Business One 9版中的新功能。
有人通过sql查询从装箱位置获取现有批次的批次吗?
此致
李安(Joanne Lee)
嗨乔安妮,
下面的查询将返回在特定bin位置中批次或序列号管理的项目的数量记录集:
声明@WhsCode nvarchar( 9),@ ItemCode nvarchar(21),@ BinLocation nvarchar(228)
set @WhsCode ='01' set @ItemCode ='B10000' 设置@BinLocation = '01 -ABC'
选择 T0。 BinAbs,T0.ItemCode,T2.onHandQty,T4.DistNumber,T4.MnfSerial, T4.LotNumber,T5.DistNumber,T5.MnfSerial,T5.LotNumber,T4.AbsEntry, em> T1.BinCode,T4.AbsEntry,T5.AbsEntry,T1.WhsCode 来自 OIBQ T0 T0.BinAbs = T1.AbsEntry和T0.onHandQty <> 0上的内部连接OBIN T1,T0.BinAbs = T2.BinAbs和T0上的左外部连接OBBQ T2 .ItemCode = T2.ItemCode和T2.onHandQty <> 0 左外连接OSBQ T3在T0.BinAbs = T3.BinAbs和T0.ItemCode = T3.ItemCode和T3.onHandQty <> 0 左外连接T2.SnBM上的OBTN T4 DAbs = T4.AbsEntry和T2.ItemCode = T4.ItemCode 左外连接在T3上连接OSRNT5。SnBMDAbs= T5.AbsEntry和T3.ItemCode = T5.ItemCode 其中 T1.AbsEntry> = 0和T1.WhsCode> = @WhsCode和T1.WhsCode <= @WhsCode和(T2.AbsEntry不为空) 和T0.ItemCode in((从OITM U0内部连接中选择U0.ItemCode,在U0.ItmsGrpCod = U1.ItmsGrpCod上连接OITB U1 其中U0.ItemCode不为null,并且 U0.ItemCode> = @ItemCode和U0.ItemCode <= @ItemCode)) 和T1.BinCode = @BinLocation 全部联合 选择 T0.BinAbs,T0.ItemCode,T3.onHandQty,T4.DistNumber,T4.MnfSerial, T4.LotNumber ,T5.DistNumber,T5.MnfSerial,T5.LotNumber,T5.AbsEntry, T1.BinCode,T4.AbsEntry,T5.AbsEntry,T1.WhsCode < 来自 OIBQ T0的em> 内连接OBIN T1在T0.BinAbs = T1.AbsEntry和T0.onHandQty <> 0 左外部连接T0.BinAbs = T2.B上的OBBQ T2 inAbs和T0.ItemCode = T2.ItemCode和T2.onHandQty <> 0 左外连接OSBQ T3在T0.BinAbs = T3.BinAbs和T0.ItemCode = T3.ItemCode和T3。 onHandQty <> 0 左外部联接T2上的OBTNT4。SnBMDAbs= T4.AbsEntry和T2.ItemCode = T4.ItemCode 左外部联接OSRN T5 在T3.SnBMDAbs = T5.AbsEntry和T3.ItemCode = T5.ItemCode 其中 T1.AbsEntry> = 0和T1.WhsCode> = @ WhsCode和T1.WhsCode <= @WhsCode和(T3.AbsEntry不为null) 和T0.ItemCode in((从OITM U0内部选择U0.ItemCode在U0.ItmsGrpCod上连接OITB U1 = U1.ItmsGrpCod 其中U0.ItemCode不为null,U0.ItemCode> = @ItemCode和U0.ItemCode <= @ItemCode)) T1.BinCode = @BinLocation 全部联合 选择 T0.BinAbs,T0.ItemCode,T0.onHandQty ,T4.DistNumber,T4.MnfSerial, T4.LotNumber,T5.DistNumber,T5.MnfSerial,T5.LotNumber,T4.AbsEntry, T1 .BinC ode,T4.AbsEntry,T5.AbsEntry,T1.WhsCode 来自 OIBQ T0内部联接在T0上的OBIN T1.BinAbs = T1.AbsEntry和T0 .onHandQty <> 0 左外部联接T0上的OBBQT2。BinAbs= T2.BinAbs和T0.ItemCode = T2.ItemCode和T2.onHandQty <> 0 左外部联接在T0上的OSBQ T3.BinAbs = T3.BinAbs和T0.ItemCode = T3.ItemCode和T3.onHandQty <> 0 左外部联接在T2.SnBMDAbs上的OBTN T4 = T4.AbsEntry和T2.ItemCode = T4.ItemCode 左外连接在T3上的OSRN T5.SnBMDAbs = T5.AbsEntry和T3.ItemCode = T5.ItemCode 其中 T1.AbsEntry> = 0和T1.WhsCode> = @WhsCode和T1.WhsCode <= @WhsCode 和(T2。 和T0.ItemCode in((从OITM U0内部选择U0.ItemCode在U0.ItmsGrpCod = U1.ItmsGrpCod上联接OITB U1 和T1.BinCode = @BinLocation 其中 U0.ItemCode不为null且U0.ItemCode> = @ItemCode和U0 。项目 代码<= @ItemCode))
亲切问候,
欧文
嗨乔安娜,
尝试一下:
选择 T0.ItemCode, T0.DistNumber AS BatchNumber, T2.Location, T1.Quantity 从OBTN AS T0 外部连接dbo.OBTQ AS T1 ON T0.ItemCode = T1.ItemCode和T0.SysNumber = T1.SysNumber 内部联接dbo.OBTW作为T2开启T0.ItemCode = T2.ItemCode和T0.SysNumber = T2.SysNumber AND T1.WhsCode = T2。 WhsCode
此查询对我有用
从OBBQ中选择不同的OBIN.BinCode,OBTN.DistNumber,OBBQ.OnHandQty。OBIN.WhsCode = OBBQ.WhsCode和OBIN.AbsEntry = OBBQ.BinAbs LEOB JOIN OIBT ON OBBQ.ItemCode = OIBT.ItemCode和OBBQ.WhsCode = OIBT.WhsCode 在OBBQ.SnBMDAbs上左加入OBTN = OBTN.AbsEntry 其中,OBBQ.itemcode ='02101154',而obtn.DistNumber在('80T4814B7/1 ','80T4814B7#')和OBBQ.OnHandQty> 0
最多设置5个标签!
嗨乔安妮,
下面的查询将返回在特定bin位置中批次或序列号管理的项目的数量记录集:
声明@WhsCode nvarchar( 9),@ ItemCode nvarchar(21),@ BinLocation nvarchar(228)
set @WhsCode ='01'
set @ItemCode ='B10000'
设置@BinLocation = '01 -ABC'
选择
T0。 BinAbs,T0.ItemCode,T2.onHandQty,T4.DistNumber,T4.MnfSerial,
T4.LotNumber,T5.DistNumber,T5.MnfSerial,T5.LotNumber,T4.AbsEntry, em>
T1.BinCode,T4.AbsEntry,T5.AbsEntry,T1.WhsCode
来自
OIBQ T0
T0.BinAbs = T1.AbsEntry和T0.onHandQty <> 0上的内部连接OBIN T1,T0.BinAbs = T2.BinAbs和T0上的左外部连接OBBQ T2 .ItemCode = T2.ItemCode和T2.onHandQty <> 0
左外连接OSBQ T3在T0.BinAbs = T3.BinAbs和T0.ItemCode = T3.ItemCode和T3.onHandQty <> 0
左外连接T2.SnBM上的OBTN T4 DAbs = T4.AbsEntry和T2.ItemCode = T4.ItemCode
左外连接在T3上连接OSRNT5。SnBMDAbs= T5.AbsEntry和T3.ItemCode = T5.ItemCode
其中
T1.AbsEntry> = 0和T1.WhsCode> = @WhsCode和T1.WhsCode <= @WhsCode和(T2.AbsEntry不为空)
和T0.ItemCode in((从OITM U0内部连接中选择U0.ItemCode,在U0.ItmsGrpCod = U1.ItmsGrpCod上连接OITB U1
其中U0.ItemCode不为null,并且 U0.ItemCode> = @ItemCode和U0.ItemCode <= @ItemCode))
和T1.BinCode = @BinLocation
全部联合
选择
T0.BinAbs,T0.ItemCode,T3.onHandQty,T4.DistNumber,T4.MnfSerial,
T4.LotNumber ,T5.DistNumber,T5.MnfSerial,T5.LotNumber,T5.AbsEntry,
T1.BinCode,T4.AbsEntry,T5.AbsEntry,T1.WhsCode
< 来自
OIBQ T0的em>
内连接OBIN T1在T0.BinAbs = T1.AbsEntry和T0.onHandQty <> 0
左外部连接T0.BinAbs = T2.B上的OBBQ T2 inAbs和T0.ItemCode = T2.ItemCode和T2.onHandQty <> 0
左外连接OSBQ T3在T0.BinAbs = T3.BinAbs和T0.ItemCode = T3.ItemCode和T3。 onHandQty <> 0
左外部联接T2上的OBTNT4。SnBMDAbs= T4.AbsEntry和T2.ItemCode = T4.ItemCode
左外部联接OSRN T5 在T3.SnBMDAbs = T5.AbsEntry和T3.ItemCode = T5.ItemCode
其中
T1.AbsEntry> = 0和T1.WhsCode> = @ WhsCode和T1.WhsCode <= @WhsCode和(T3.AbsEntry不为null)
和T0.ItemCode in((从OITM U0内部选择U0.ItemCode在U0.ItmsGrpCod上连接OITB U1 = U1.ItmsGrpCod
其中U0.ItemCode不为null,U0.ItemCode> = @ItemCode和U0.ItemCode <= @ItemCode))
T1.BinCode = @BinLocation
全部联合
选择
T0.BinAbs,T0.ItemCode,T0.onHandQty ,T4.DistNumber,T4.MnfSerial,
T4.LotNumber,T5.DistNumber,T5.MnfSerial,T5.LotNumber,T4.AbsEntry,
T1 .BinC ode,T4.AbsEntry,T5.AbsEntry,T1.WhsCode
来自
OIBQ T0内部联接在T0上的OBIN T1.BinAbs = T1.AbsEntry和T0 .onHandQty <> 0
左外部联接T0上的OBBQT2。BinAbs= T2.BinAbs和T0.ItemCode = T2.ItemCode和T2.onHandQty <> 0
左外部联接在T0上的OSBQ T3.BinAbs = T3.BinAbs和T0.ItemCode = T3.ItemCode和T3.onHandQty <> 0
左外部联接在T2.SnBMDAbs上的OBTN T4 = T4.AbsEntry和T2.ItemCode = T4.ItemCode
左外连接在T3上的OSRN T5.SnBMDAbs = T5.AbsEntry和T3.ItemCode = T5.ItemCode
其中
T1.AbsEntry> = 0和T1.WhsCode> = @WhsCode和T1.WhsCode <= @WhsCode
和(T2。
和T0.ItemCode in((从OITM U0内部选择U0.ItemCode在U0.ItmsGrpCod = U1.ItmsGrpCod上联接OITB U1
和T1.BinCode = @BinLocation
其中
U0.ItemCode不为null且U0.ItemCode> = @ItemCode和U0 。项目 代码<= @ItemCode))
亲切问候,
欧文
嗨乔安娜,
尝试一下:
此查询对我有用
从OBBQ中选择不同的OBIN.BinCode,OBTN.DistNumber,OBBQ.OnHandQty。OBIN.WhsCode = OBBQ.WhsCode和OBIN.AbsEntry = OBBQ.BinAbs
LEOB JOIN OIBT ON OBBQ.ItemCode = OIBT.ItemCode和OBBQ.WhsCode = OIBT.WhsCode
在OBBQ.SnBMDAbs上左加入OBTN = OBTN.AbsEntry
其中,OBBQ.itemcode ='02101154'
,而obtn.DistNumber在('80T4814B7/1 ','80T4814B7#')和OBBQ.OnHandQty> 0
一周热门 更多>