Error Executing Code : Call To TTSCOMMIT without first calling TTSBEGIN

Hi,

I was trying to delete a Contact person who has a document in docref table.

this error appears in the ContactPerson Table/ delete method’s super() line.

Error Executing Code : Call To TTSCOMMIT without first calling TTSBEGIN

Does anyone have information about it?

Thanks…

Hi Sevim,

If ur doing any update or delete operation in a table you should do it inside ttsbegin and ttscommit.As per error statement give I think u missed to add ttsbegin in your code.

Hi Karthik, thank you for your reply.

I controlled the ttsbegin, ttscommit bloks. There are ok.

There is a switch blok like this,

If DialogButton::No case choosed it runs ok, but DialogButton::Cancel case give this error. So it is not work.

switch (box::yesNoCancel(strfmt("@", completeFilename), DialogButton::Yes, “@”) )
{
case DialogButton::No:
break;

case DialogButton::Cancel:
//Throw an error to cancel transaction with delete operation
throw error("@");

}

Can we have the full tts Block of code here(if possible) to understand the issue?

Docuref Table → Delete method

void delete(recId _interCompanyFromRecId = 0)

{

DocuValue docuValue;

Filename completeFilename, onlyFilename;

NumberSequenceCode numSeqCode;

DocuType docuType;

;

ttsbegin;

smmTransLog::initTrans(this, smmLogAction::delete);

super();

InterCompanyDocu::synchronize(this,_interCompanyFromRecId);

if (!this.existAnotherValue())

{

docuValue = DocuValue::find(this.ValueRecId, true);

if (docuValue.RecId)

{

completeFilename = this.completeFilename(this.path(true));

onlyFilename = docuValue.FileName;

docuValue.delete();

docuType = this.docuType();

if( completeFilename )

{

if (docuType.FilePlace == DocuFilePlace::Archive ||

docuType.FilePlace == DocuFilePlace::NoCopy)

{

//Check if we need to remove the physical file along with the database record

switch (docuType.RemoveOption)

{

case DocuRemoveOption::DocumentOnly:

//Keep the file

break;

case DocuRemoveOption::DocumentAndFile:

if (docuType.FileRemovalConfirmation == NoYes::No)

{

DocuOpenFile::removeFile(completeFilename);

}

else

{

switch (box::yesNoCancel(strfmt("@", completeFilename), DialogButton::Yes, “@”) )

{

case DialogButton::Yes:

DocuOpenFile::removeFile(completeFilename);

break;

case DialogButton::No:

break;

case DialogButton::Cancel: // THE PROBLEM IS OCCUR IN THİS CASE

//Throw an error to cancel transaction with delete operation

throw error("@");

}

}

break;

}

if (smmDocuments::mustArchiveFiles(docuType))

{

numSeqCode = DocuParameters::numRefDocuNumber().NumberSequence;

if (numSeqCode && onlyFilename)

{

// Delete the value in the numberseq list

NumberSeq::release(numSeqCode,onlyFilename);

}

}

}

else

{

DocuOpenFile::removeFile(completeFilename);

}

}

}

}

ttscommit;

}