Monday, August 31, 2015

Delete all transactions Ax2012

There is a class named "SysDatabaseTransDelete" in Axapta which can be used to delete all the transactions from your Ax Db but will not delete the base setups. In that case we can use the same DB as Production Db.
NOTE: It works perfectly with Ax2012 CU3 and above as it is now updated for new DB structure. Otherwise you may face issues with General Journal/Trial balance data.
It deletes all data from tables in the Transaction, WorksheetHeader and WorksheetLine table groups plus the following tables...
       SalesTable
       PurchTable
       WMSPallet
       CustInterestJour
       CustCollectionLetterJour
       ProjControlPeriodTable
       ProjInvoiceJour
       ProjJournalTable
       PdsRebateTable
       PdsBatchAttributes
You can run it from the AOT by right clicking on the SysDatabaseTransDelete class node and selecting "open" - this isn't the sort of thing you would want to put on a menu anywhere.
Here is a job for the same:
static void deleteTransactions(Args _args)
{
SysDatabaseTransDelete delete;
;
delete = new SysDatabaseTransDelete();
delete.run();
}

No comments:

Post a Comment