Shipping Data Entry via BOI with large number of documents - odd behaviour

SOLVED

Experts,

I created BOI script that pulls picked orders from a SQL server and creates Shipping Data Entries for these orders. The data originates from the Sage Sales Orders and I have all necessary information available. Here is the issue that I am running into:

At times the script might process 100 or even 300 orders/invoices with 1 to 5 items on each of them. I am currently establishing the necessary objects once, and then go through my data with the same objects in place. Here is how I establish the objects in my Sage class:

retVal = m_oSS.nSetProgram(m_oSS.nLookupTask("SO_Shipping_UI"))
Set m_oShip = m_oScript.NewObject("SO_Shipping_bus",m_oSS)
Set m_oShipLines = m_oShip.oLines
Set m_oTier = m_oShipLines.oACS_MultiBin_OBJ  (this one is necessary because the system has Scanco MB running)
.
Here is how I create a new invoice or access an existing one (there is error handling in between, that I took out):
.
retVal = m_oShip.nSelectBatch(sBatch)
retVal = m_oShip.nGetNextInvoiceNo(sNextInv)
retVal = m_oShip.nSetKey(sNextInv)
retVal = m_oShip.nSetValue("ShipperID$"m_arrSage(4))
retVal = m_oShip.nSetValue("SalesOrderNo$", sSONo)
'
....
'
retVal = m_oShip.nSelectBatch(sBatch)
retVal = m_oShip.nSetKey(sInvNo)
retVal = m_oShip.nSetValue("ShipperID$"m_arrSage(4))
.
The part above works fine. Depending on if I have a new invoice or an existing one with quantities already on it, I either trigger the ship remaining and loop through the line items or I just modify the quantities on the existing lines.
.
The problem now is: If I do that with the same object in place, I end up with invoices that have nothing shipped (the QTYs remain zero). My error handling doesn't catch those, meaning that the retVal's don't indicate something went wrong.
.
Now, when I destroy the objects after each invoice and recreate them, then I don't have any issues with the data. The problem is, that this extends the script running time like crazy (from a few minutes to 1.5 hours if I have a lot of invoices).
.
Does anyone know what could cause the problems and how I could get around them? What would be best practice for this kind of mass insert into Shipping Data Entry? I would be fine with recreating the objects after each invoice if I could speed that up.
.
Thanks!
.
Bastian