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(); } }
I'm not going to duplicate the discussion; find my reply in the original thread.
Hi Menna, I think even if you manage to get Catch statement hit, your code will not work. You are trying to insert error logs in a temporary table. Instead you should create a regular Log table. (Not sure why your catch statement is not hit).
check this article
I asked you another questions but you didn't answer
This is a duplicate. It's already discussed in Try catch doesn't work in RDP class ProcessReport () method x++.
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156