Posting and printing sales/purchase updates

One of the most commonly used classes in AX are the form letter service classes—theses classes define how to post different status updates against sales orders and purchase orders.

The following figure shows the class hierarchy of FormLetterServiceController with all its subclasses:

Posting and printing sales/purchase updates

As you can see, there are four main operations on both the sales side and the purchase side that are fairly similar:

,

Sales

Purchase

Confirmation

Purchase order confirmation

Picking list

Receipt list

Packing slip

Packing slip

Invoice

Invoice

In addition, the class hierarchy contains classes for updating Request For Quotes (RFQ).

Since the process of posting orders can include several orders in one update and also only posts parts of an order, AX uses the Parm tables that are filled with data before the actual posting. For example, on the sales side, the SalesParmUpdate table contains information regarding the update taking place and can be linked to several records in the SalesParmTable table, which again contains information regarding the sales orders being updated. The SalesParmLine table is linked to the SalesParmTable table and contains information regarding the lines being updated.

The normal flow when a posting is being performed is that the Parm tables are populated with data and then the update itself is being performed.

Updating a single sales order is, however, a lot easier, as shown in the following example. It will then update only that order and update all the lines in the order. The code is as follows:

static void postSalesInvoice(Args _args)
{
  // Define a classvariable according to the
  // type of posting being performed
  SalesFormLetter_Invoice     invoice;
  SalesTable                  salesTable;
  // Select the salesTable to update
  salesTable = SalesTable::find("SO-101297");
  // Create a new object of the SalesFormLetter_Invoice
  // by using the construct-method in SalesFormLetter
  invoice = SalesFormLetter::construct(DocumentStatus::Invoice);
  // Post the invoice
  invoice.update(salesTable,
  SystemDateGet(),
  SalesUpdate::All,
  AccountOrder::None,
  false,
  true); // Set to true to print the invoice
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.109.201