Hello,
take a look at OITL and ITL1 tables which records all batch and serials transactions. Warehouse should be the LocCode column.
select
t0.ItemCode
,t0.LocCode
,t2.DistNumber
,sum(t0.StockQty)asQuantity
from
OITLt0
joinITL1t1ont0.LogEntry=t1.LogEntry
joinOBTNt2ont1.SysNumber=t2.AbsEntry
groupby
t0.ItemCode
,t0.LocCode
,t2.DistNumber
Regards
Pierre