Hi,
Check this below :
select T0.docentry,T0.Quantity, t0.BaseEntry
,(select sum(T1.Quantity) from rpd1 T1
where T1.docentry <= T0.docentry and t1.ItemCode = t0.itemcode) as RunningTotal
from rpd1 T0 where t0.baseentry = '86' or t0.BaseEntry = '87' order by T0.docentry
Not sure the results would be fine as I did not have the data as required but just give it a try and see what is the result.
Kind Regards,
Jitin
SAP Business One Forum Team