HI i am facing an error while updating a record in the invent table. I am using the following sample code.
static void Job4(Args _args)
{
CsInvBOMSplitQtyCalcHelper bomCalc;
Qty qty;
InventTable inventTable;
InventTable updateInventTable;
BOM bom;
boolean result;
BOMId bomId;
BOMVersion bomVersion;
ItemId item = "1000M-3C-Pcs";
select firstOnly * from bomversion
where bomversion.Active == true
&& bomversion.ItemId == item
&& csIsLengthItem(item) == false;
if (0 != bomVersion.RecId)
{
select * from bom
where bom.BOMId == bomversion.BOMId
exists join inventTable
where bom.ItemId == inventTable.ItemId
&& inventTable.CsIsLengthItem == true;
}
if (0 != bom.RecId)
{
result = true;
bomCalc = CsInvBOMSplitQtyCalcHelper::construct(item);
qty = bomCalc.getAdvicedBOMSpoolQty();
}
ttsBegin;
while select forUpdate updateInventTable
where updateInventTable.ItemId == item
{
updateInventTable.CsInvBOMSplitQty = qty;
updateInventTable.update();
}
ttsCommit;
info(strFmt('%1, %2, %3', result, qty, inventTable.CsInvBOMSplitQty));
}
This is the error I get:
Please help me in resolving this issue.
The error is obviously not caused by this job (but maybe an earlier version).
Just run this small job to reset the TTS level:
TTS level errors are usually caused by programming errors, say calling
return
beforettsCommit
.