Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Microsoft Dynamics AX 2009 : Processing Business Tasks - Posting sales orders

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
1/30/2012 5:29:11 PM
Sales order posting is also done in a very similar way to posting a purchase order. The posting function can be executed from code and can be integrated into various customizations.

In this recipe, we will use a standard Dynamics AX API to post and print a sales packing slip document from code. As an example, we will post and print a packing slip for the sales order created in the previous recipe.

How to do it...

  1. 1. In AOT, create a new class called SalesOrderPost with the following code (replace SO-100160 with your number):

    class SalesOrderPost

    {
    }
    public static void main(Args _args)

    {
    SalesFormLetter salesFormLetter;
    salesTable salesTable;
    ;
    salesTable = SalesTable::find('SO-100160');
    salesFormLetter = SalesFormLetter::construct(
    DocumentStatus::PackingSlip);
    salesFormLetter.update(
    salesTable,
    systemdateget(),
    SalesUpdate::All,
    AccountOrder::None,
    NoYes::No,
    NoYes::Yes);
    }

  2. 2. Run the class to create a packing slip for the specified sales order and display the Packing slip document on the screen:

  1. 3. Open Accounts receivable | Sales Order Details, select the previously specified sales order, the click Inquiries button, and choose Packing slip to view results:

How it works...

First, we create a new class named SalesOrderPost with a main() method.

The method starts with finding sales order SO-100160, which we created in the previous recipe. Here, we would normally replace this code with user input or an output from another source.

Next, we call construct() on the SalesFormLetter class to create a new salesFormLetter instance. The method accepts an argument of type DocumentStatus, which defines the type of posting. Here, we use DocumentStatus::PackingSlip for sales packing slip posting. construct() also accepts a second optional boolean argument, which controls whether a new SalesParmUpdate record, used for sales order posting grouping, should be created. The default is true.

And finally, we call update() on salesFormLetter, which does actual posting. It accepts a number of arguments:

  • The sales order header record, i.e. SalesTable.

  • The transaction date. The default is system date.

  • The quantity to be posted. The default is SalesUpdate::All.

  • This argument is not used. The default is AccountOrder::None.

  • A boolean value defining should preview or actual posting be done.

  • A boolean value defining should document be printed.

  • A boolean value specifying should printing management be used. The default is false.

  • Keep the remaining quantity on order; otherwise it is set to zero. This argument is used when posting credit notes.

  • A container of a number of TmpFrmVirtual records. This argument is optional and is used only when posting sales invoices.

There's more...

SalesFormLetter could also do other types of posting, like order confirmation, picking list, or invoice. For example, to invoice for the sales order, replace the code:

salesFormLetter = SalesFormLetter::construct(
DocumentStatus::PackingSlip);

with:

salesFormLetter = SalesFormLetter::construct(
DocumentStatus::Invoice);

Run the class and notice that now the sales order was invoiced:

Open Accounts receivable | Sales Order Details, select the previously specified sales order, click the Inquiries button, and choose Invoice to view the results:

Other -----------------
- Active Directory Domain Services 2008 : Add a Computer to a Group
- Active Directory Domain Services 2008 : Move a Computer Object
- Windows Server 2008 Server Core : Starting and Configuring the Registry Editor (part 2)
- Windows Server 2008 Server Core : Starting and Configuring the Registry Editor (part 1)
- Microsoft BizTalk 2010 : Consuming ASDK-based Adapters - Installation
- Microsoft BizTalk 2010 : Understanding the ASDK-based adapter
- Microsoft Dynamics CRM 4.0 Accelerators : eService Accelerator (part 4)
- Microsoft Dynamics CRM 4.0 Accelerators : eService Accelerator (part 3) - Modify the New Workflows & eService Configuration
- Microsoft Dynamics CRM 4.0 Accelerators : eService Accelerator (part 2)
- Microsoft Dynamics CRM 4.0 Accelerators : eService Accelerator (part 1) - Configuring ASP.NET Membership
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server