Lot Number check BPM

Update on the Code:

{Bpm/Bpm.i &OBJECT_NAME=ReceiptsFromMfg}
{ud/csgBPMexception.i}

procedure ReceiveMfgPartToInventoryBefore:
define input-output parameter table for ttPartTran.
define input-output parameter table for ttSelectedSerialNumbers.
define input-output parameter table for ttSNFormat.
define input-output parameter pdSerialNoQty as decimal.
define input-output parameter plNegQtyAction as logical.
define input-output parameter pcMessage as character.
{&TRY_PRIVATE}


Find first parttran where parttran.LotNum = ttparttran.lotnum no-lock no-error.
if available parttran then
do:
find first partlot where partlot.LotNum = ttparttran.LotNum
no-error.
if available partlot then
do:
if(partlot.onhand = no) then
do:
throwexception("update","This Lot has Already been Issued").
end.
end.
end.
{&CATCH_PRIVATE}
end procedure.
I'm writing a BPM to check whether there is LOT stock on hand. If not then a warning screen comes up.

{ud/csgBPMexception.i}
Find first parttran where parttran.LotNum = ttparttran.lotnum
no-error.
if available parttran then
do:
find first partlot where partlot.LotNum = ttparttran.LotNum
no-error.
if available partlot then
do:
if(partlot.onhand = true) then
do:
throwexception("update","This Lot has Already been Issued").
end.
end.
end.


This is what I've done to date, but although the code validates - when saving it it comes up with the following error:

Exception caught in: Epicor.Mfg.BO.BpMethod

Error Detail
============
Message: Compilation error: Missing END statement. Already defining OnChangeLotNumPre63_A1. You cannot nest procedure, function, or method definitions. (5908)
** E:\epicor\mfgsys803\Server\ud\csgBPMexception.i Could not understand line 8. (196)

Type: Error
Program: Bpm/Misc.p
Method: DeployProcedure
Table:
Row:
Field:



Stack Trace
===========
at Epicor.Mfg.Proxy.BpMethodImpl.Update(BpMethodDataSet ds)
at Epicor.Mfg.UI.Adapters.BpMethodAdapter.Update()
at Epicor.Mfg.UI.App.BpMethodEntry.Transaction.adapterUpdate()
at Epicor.Mfg.UI.FrameWork.EpiMultiViewTransaction.Update()