Job to delete un-posted journals in Ax 2009
Simple job to delete un-posted journals in Ax 2009
LedgerJournalTable LedgerJournalTable;
LedgerJournalTrans LedgerJournalTrans;
Container journalList = [['DAT','JN-011111']];
str 10 company,journalnum;
int i;
;
for(i=1; i <= conlen(journalList); i++)
{
[company, journalnum] = conpeek(journalList,i);
info(strfmt("%1 - Company: %2, JournalNum: %3", 1, company,journalnum));
changecompany(company)
{
LedgerJournalTrans = null;
LedgerJournalTable = null;
ttsbegin;
delete_from LedgerJournalTrans
where LedgerJournalTrans.JournalNum == journalnum;
delete_from LedgerJournalTable
where LedgerJournalTable.JournalNum == journalnum;
ttscommit;
info(strfmt("Recid after deletion: %1", LedgerJournalTable::find(journalnum).RecId));
}
}
info("Execution completed");
LedgerJournalTable LedgerJournalTable;
LedgerJournalTrans LedgerJournalTrans;
Container journalList = [['DAT','JN-011111']];
str 10 company,journalnum;
int i;
;
for(i=1; i <= conlen(journalList); i++)
{
[company, journalnum] = conpeek(journalList,i);
info(strfmt("%1 - Company: %2, JournalNum: %3", 1, company,journalnum));
changecompany(company)
{
LedgerJournalTrans = null;
LedgerJournalTable = null;
ttsbegin;
delete_from LedgerJournalTrans
where LedgerJournalTrans.JournalNum == journalnum;
delete_from LedgerJournalTable
where LedgerJournalTable.JournalNum == journalnum;
ttscommit;
info(strfmt("Recid after deletion: %1", LedgerJournalTable::find(journalnum).RecId));
}
}
info("Execution completed");
Comments
Post a Comment