Rateio por quantidade
Banco de dados SQL SERVER©:
select T0.DocEntry,T0.DocNum,T0.Type,T0.ItemCode,T0.Status,T0.Warehouse
from OWOR T0
where isnull(T0.U_LG_Cancel,'N') = 'N'
and exists ( select 'A' from OINM T3
where T3.AppObjAbs = T0.Docentry
and T3.ApplObj = '202'
and T3.ItemCode = T0.ItemCode and T3.DocDate between '20150101' and '20150131')
Banco de dados HANA STUDIO©:
select T0."DocEntry",T0."DocNum",T0."Type",T0."ItemCode",T0."Status",T0."Warehouse"
from OWOR T0
where IFNULL(T0."U_LG_Cancel",'N') = 'N'
and exists ( select 'A' from OINM T3
where T3."AppObjAbs" = T0."DocEntry"
and T3."ApplObj" = '202'
and T3."ItemCode" = T0."ItemCode" and T3."DocDate" between '20150101' and '20150131')
⚠️Atenção: Em ambos os casos, antes de executar a consulta, ajustar as datas para as datas iniciais e finaisdo período o qual está sendo analisado.