If you need to update a sales order or a purchase order without any user dialogs, Axapta provides you with a simple interface to do just that.
The SalesFormLetter and PurchFormLetter classes contain the update method, which gives you an easy interface to setup and run posting of a sales order or a purchase order.
The following job is an example on how you use this method to update invoices on sales orders:
static void postSalesFormLetter(Args _args)
{
SalesFormLetter salesFormLetter;
salesTable salesTable;
ttsBegin;
while select salesTable
where salesTable.DocumentStatus < salesid ="=">
{
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice); // Get a new instance of SalesFormletter
salesFormLetter.transDate(SystemDateGet()); // Set the invoicedate
salesFormLetter.update(salesTable, // SalesTable SalesUpdate::All, // Quantity to update (SpecQty) AccountOrder::None, // AccountOrder false, // Proforma only? true); // Printout? }
ttsCommit;
}
No comments:
Post a Comment