BAM Additional Alert Procedure

I am trying to run a .P file on the PartWhse.OnHandQty. In the file I run a for loop to sum up all of the PartWhse.OnHandQty values. Afterward I run an updatebuffer and assign the totalOnHandQty value to PartPlant.Number01. Seems simple.

I even have Create Log checked to let me know that the BAM was triggered.

BUT my update to the PartPlant.Number01 field is not happening. I still have zero qty. Can anyone look at my procedure and see if there is anything wrong with it?

Dan


{ud/GlbAlert.i &TableName = "PartWhse"}
SendEmail = False.

/*cur-plant*/

DEFINE VARIABLE onhand AS DECIMAL INIT 0 NO-UNDO.

FOR EACH PlantWhse WHERE PlantWhse.Company = cur-comp AND PlantWhse.Plant = cur-plant AND Plantwhse.PartNum = MfgSys.PartWhse.PartNum NO-LOCK.

FOR EACH PartWhse WHERE PartWhse.company = cur-comp AND PartWhse.WarehouseCode = PlantWhse.WarehouseCode AND PartWhse.PartNum = PlantWhse.PartNum NO-LOCK.
onhand = onhand + PartWhse.OnHandQty.
END.
END.

FIND FIRST PartPlant WHERE PartPlant.Company = cur-comp AND PartPlant.Plant = cur-plant AND PartPlant.partNum = Mfgsys.PartWhse.PartNum NO-ERROR.

IF AVAIL PartPlant THEN DO:
RUN lib\UpdateTableBuffer.p(INPUT BUFFER PartPlant:HANDLE, 'Number01', onhand).
END.