Stack trace: call to ttscommit without first calling ttsbegin

hi guys!!
while i debug class for posting purchase order i found this i warning message :“Stack trace: call to ttscommit without first calling ttsbegin”.

Can someone tell me why this error occur? I’m helpless:(

Hi misha,

Basically this error arrives when there is some mismatch between ttsbegin and ttscommit (or) i can say that ttscommit is wrriten without declaring ttsbegin.

Bythe way may i know which class you are debugging ??

Hi Misha,

The problem will occure only when the TTSCOMMIT calls first without calling TTSBEGIN. So check the code wethere ttsbegin has been commented or removed by customization.

Regards,

Abbas

Thanks Abbas and Vishal,

This is the method that i created inside the PO Creation class:

public void InsertPOHeader(POHeaderTable _PoHeaderTbl)
{
NumberSeq numberSeq;
PurchTable purchTable;
VendTable tblvend;
LedgerDimensionAccount ledgerDimAcc;
VendGroup tblvendgroup;
Currency tblcurrency;
DimensionAttributeValueCombination tblLedgerDimension;
PurchLine tblline;
DimensionStorage clsdimensionstorage;
InventDimId invntdimid;
InventTable tblinvent;
InventDim tblInventDim;

POLineTable POLineTable;
PurchFormLetter purchFormLetter;
PurchLine purchLine;
AccountNum strAccountNo;
;

ttsBegin;
{
select purchTable where purchTable.PurchId == _PoHeaderTbl
if(!purchTable)

{
purchTable.initValue();
purchTable.PurchId = _PoHeaderTbl
purchTable.CurrencyCode = _PoHeaderTbl
strAccountNo = _PoHeaderTbl
tblvend = VendTable::find(strAccountNo);
purchTable.initFromVendTable(VendTable::find(tblvend.AccountNum));

if(!purchTable.validateWrite())
{
throw Exception::Error;
}
purchTable.insert();

while select forUpdate POLineTable;
where POLineTable;.POID == _PoHeaderTbl
&& POLineTable;.Process == IDS_SPEProcess::New
&& POLineTable;.ProcessedDate == systemDateGet()
{

purchLine.clear();
purchLine.purchId = purchTable.PurchId;
purchLine.ItemId = POLineTable.ItemId;
purchLine.PurchPrice = POLineTable.UnitPrice;
purchLine.QtyOrdered = POLineTable.QtyOrdered;

select tblInventDim where tblInventDim.InventSiteId == POLineTable.Site;
if(tblInventDim)
{
tblInventDim.InventSiteId = POLineTable.Site;
purchLine.InventDimId = InventDim::findOrCreate(tblInventDim).inventDimId;

tblInventDim.InventLocationId = POLineTable.Location;
tblInventDim.inventBatchId = POLineTable.Batch;
purchLine.InventDimId = tblInventDim.inventDimId;
purchLine.createLine(true, true, true, true, true, true);
}

POLineTable.Process = IDS_SPEProcess::Done;
POLineTable.update();
}

}
purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
purchFormLetter.update( purchTable, ‘79544444’, systemDateGet(), PurchUpdate::All, AccountOrder::None, NoYes::No, NoYes::Yes);
purchFormLetter.run();
}
ttsCommit;
info(strFmt(“Purchase order ‘%1’ has been created”,purchTable.PurchId));

}

Would help me to find out where i made mistake? And another problem i encounter during the posting of purchase order through code is , i select a purchase order number for example “PO-123” for the posting. But the error message display error for one particular PO Number for example “PO-456”. This error keep on occur when i run the class to post invoice also. Its populating error message for this same number “PO-456” as if it is defaulted but when i debug the code everything seems okay. So, I couldn’t find out where is the problem. Any suggestion?

Update quantity is greater than remaining quantity on order line.

This isn’t exactly the code, is it? It contains several syntactic errors, so it wouldn’t compile at all.

Hi Misha,

Can you please tell me while compiling this method have you facing any error? if not then POHeaderTable and POLineTable are the customized table is it right? and for ttsbegin and ttscommit just try to write separate ttsbgin and ttscommit for both insertion as well as update. it will solve the ttscommit problem…

Regards,

Abbas

Dear Abbas,

Thanks for the suggestion. Its work out. I solve the problem ready:)

Hye Martin,

You are right. there were many synthetic errors. And I able to solve it.

Anyway thanks to notice it.

Hi,

https://groups.google.com/forum/?fromgroups#!topic/microsoft.public.axapta/mvOPxEbAwJg

this might help you…