RE: Stored procedure that computes batch totals
Not sure if this is what you are talking about, but I wrote some code to calculate the number of transactions and batch total for batches. I often move invoices to new batches for troubleshooting or selective posting so I often have to recalculate the batch totals.
Declare @NumofTrx int = 0
, @BchTotal numeric(19,5) = 0
Select @NumofTrx = count(*)
, @BchTotal = sum(DOCAMNT)
from SOP10100 s
where BACHNUMB = @BachNumb
group by bachnumb
Update SY00500 set NUMOFTRX = @NumofTrx, BCHTOTAL = @BchTotal where bachnumb = @BachNumb