Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ax 2012 tts error

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:

enter image description here

Please help me in resolving this issue.

like image 950
user3226663 Avatar asked Sep 30 '22 07:09

user3226663


1 Answers

The error is obviously not caused by this job (but maybe an earlier version).

Just run this small job to reset the TTS level:

static ttsAbort(Args args)
{
    ttsabort;
}

TTS level errors are usually caused by programming errors, say calling return before ttsCommit.

like image 70
Jan B. Kjeldsen Avatar answered Oct 06 '22 19:10

Jan B. Kjeldsen