I made a report that validate every line in General Journal this my code , I tried to remove ttsbegin and ttscommit , put them in try or in catch but doesn't work
It doesn't hit the catch statement
while select LedgerJournalTrans
order by LedgerJournalTrans.LineNum
where LedgerJournalTrans.JournalNum == JournalId
//outer join ledgerJournalTable
// where ledgerJournalTable.JournalNum == LedgerJournalTrans.JournalNum
outer join LedgerJournalProject
where LedgerJournalProject.RefRecId == LedgerJournalTrans.RecId
{
LedgerJournalTmp.clear();
LedgerJournalTmp.JounralNum = LedgerJournalTrans.JournalNum;
LedgerJournalTmp.LineNumber = LedgerJournalTrans.LineNum;
try
{
LedgerJournalPost::simulatePost(JournalTrans,JournalTransId,true, true, false, formStr(LedgerJournalTransDaily), ledgerJournalEngine);
}
catch
{
sysInfologEnumerator = SysInfologEnumerator::newData(infolog.infologData());
infolog.cut();
while (sysInfologEnumerator.moveNext() )
{
message = sysInfologEnumerator.currentMessage();
str dim = 'You must select a value in the Department field in combination with the following dimensions values that are valid:';
if (strScan(message,dim,1,strLen(dim)) || strScan(message,'Dimension values were validated with this account structure: Contrack FM - With Dimensions',1,1000))
LedgerJournalTmp.DefaultDimension = NoYes::Yes ;
if( message == 'Project stage Finished does not allow recording in this project.')
LedgerJournalTmp.ProjectStatus = NoYes::Yes;
if (strScan(message,strFmt( 'MainAccount %1 is closed.',mainAccount),1,strLen(strFmt( 'MainAccount %1 is closed.',mainAccount))) || strScan(message,strFmt( 'MainAccount %1 is closed.',mainAccount),1,strLen(strFmt( 'MainAccount %1 is closed.',mainAccount))))
LedgerJournalTmp.LedgerSuspend = NoYes::Yes ;
//else if(( message == 'Dimension values were validated with this account structure: Contrack FM - With Dimensions')||(message == strFmt("Account structure SystemGeneratedHierarchyProject for the combination %1 is not valid for ledger CFM" ,projId)))
//LedgerJournalTmp.DefaultDimension = NoYes::Yes;
if( message == strFmt("Period for %1 does not exist." ,LedgerJournalTrans.TransDate) || strFmt("Fiscal period for %1 is not open." ,LedgerJournalTrans.TransDate))
LedgerJournalTmp.TransDate = NoYes::Yes;
if(strScan(message,"The combination project/category is mandatory, but does not exist for project",1,1000) != 0)
LedgerJournalTmp.CategoryCombination = NoYes::Yes;
}
LedgerJournalTmp.insert();
}
}