we created a new controls (allow customer invoice , dis allow customer invoice )
allow customer invoice change value of line property of category in PO to be nonchargeable (if chargeable set it noncharge ) and dis allow customer invoice gets value of line property from category and set it in line property in PO
I tried to debug update in purch line table after changing this values but I got this error I tried to build model and sync database but no thing is working


This is our code in class allow customer invoice :
public class AllowCustomerInvoiceCFM extends RunBase
{
public static void main(Args args)
{
if (args)
{
PurchTable PurchTable, _PurchTable;
PurchLine PurchLine, _PurchLine ,_purchLineOrig;
AllowCustomerInvoice AllowCustomerInvoice;
FormRun PurchForm = args.caller();
FormDataSource PurchLine_DS;
DialogButton diagBut;
purchLineType purchLineType;
str strMessage = "Are you sure you want to allow customer invoice?";
str strTitle = "Allow Customer Invoice";
diagBut = Box::yesNo(strMessage, DialogButton::Yes, strTitle);
if(diagBut == DialogButton::No)
{
//your own code when user click on No button
return;
}
else if(diagBut == DialogButton::Yes)
{
//your own code when user click on Yes button
select * from PurchTable
where PurchTable.RecId == args.record().RecId;
while select PurchLine
where PurchLine.PurchId == PurchTable.PurchId
&& PurchLine.PurchStatus != PurchStatus::Invoiced
&& PurchLine.PurchStatus != PurchStatus::Canceled
{
ttsbegin;
select forupdate AllowCustomerInvoice
where AllowCustomerInvoice.PurchLine == PurchLine.RecId;
if(AllowCustomerInvoice)
{
AllowCustomerInvoice.AllowInvoice = NoYes::Yes;
AllowCustomerInvoice.update();
}
else
{
AllowCustomerInvoice.PurchLine = PurchLine.RecId;
AllowCustomerInvoice.AllowInvoice = NoYes::Yes;
AllowCustomerInvoice.insert();
}
ttscommit;
if(PurchTable.DocumentState ==VersioningDocumentState::Draft)
{
select forupdate _PurchLine where _PurchLine.PurchId == PurchTable.PurchId;
if (_PurchLine)
{
_PurchLine.ProjLinePropertyId = 'Noncharge';
purchLineType = _PurchLine.type();
ttsBegin;
_PurchLine.update();
ttsCommit;
}
}
else
{
select forupdate _PurchTable where _PurchTable.PurchId == PurchTable.PurchId;
_PurchTable.DocumentState = VersioningDocumentState::Draft;
ttsBegin;
_PurchTable.doUpdate();
ttsCommit;
select forupdate _PurchLine where _PurchLine.PurchId == PurchTable.PurchId;
if (_PurchLine)
{
_PurchLine.ProjLinePropertyId = 'Noncharge';
purchLineType = _PurchLine.type();
ttsBegin;
_PurchLine.update();
ttsCommit;
}
_PurchTable.DocumentState = PurchTable.DocumentState;
ttsBegin;
_PurchTable.doUpdate();
ttsCommit;
}
}
}
Info("Done");
}
}
}
How can I fix this issue ? Its a cloud environment with version 33