Tuesday, February 28, 2012

AX2012 : X++ code to update picking list for sales order

Hi Friends,

Use the following code to generate the picking list for a sales order. This will give you the same results when you do Sales Order --> Pick and Pack --> Generate picking list.


static void SalesOrder_UpdatePickingList(Args _args)
{
    SalesFormLetter_PickingList salesFormLetter;
    SalesTable      salesTable = salesTable::find('SO-101292');

    ;
    salesFormLetter = SalesFormLetter_PickingList::newPickingList();
    salesFormLetter.transDate(systemDateGet());
    salesFormLetter.update(salesTable,
                            systemdateget(),
                            SalesUpdate::All,
                            AccountOrder::None,
                            NoYes::No,
                            NoYes::No);
}


12 comments:

  1. Normally you start all the updates with the construct method of the formletter like this one:
    salesFormLetter = SalesFormLetter::construct(DocumentStatus::PickingList);

    ReplyDelete
  2. wat if there is a partial picking list??

    ReplyDelete
    Replies
    1. In case of partial picking list you can update the deliver now qty before running the job and instead of SalesUpdate::All you can pass SalesUpdate::DeliverNow

      Delete
    2. Hi Rachit ,

      I am using AX 2009 RU 6 and I want to automate below Sales Order Packing slip:

      1. SalesLine --> Inventory Reservation
      2. Release sales order for picking. This divided into 2 sub step:
      2. a) Activation of all physically reserved sales orders
      2. b) Release for pick ( Picking List posting)
      3. Post Packing Slip

      I have automated the step 1 : Reservation ( i.e. I am able to reserve based on Inventory dimension like serial number or batch id ). But regarding step 2 I have below questions:

      1. Can I update Deliver Now QTY through code without following step 2. i.e. bypass step 2 ?
      2. How to post packing slip using x++?

      Regards
      Sudhesh Dessai



      Delete
    3. hi buddy were you successful in doing this?

      Delete
  3. Hi Rachit,
    How can I pass new Inventory Dimension like InventBatchId for picking list Item???

    ReplyDelete
    Replies
    1. Hi Sumit, Can you please elaborate what do you want to achieve. Thanks!!

      Delete
  4. How to get created pick list PickingRouteId?

    ReplyDelete
  5. Hi Rachit ,

    I am using AX 2009 RU 6 and I want to automate below Sales Order Packing slip:

    1. SalesLine --> Inventory Reservation
    2. Release sales order for picking. This divided into 2 sub step:
    2. a) Activation of all physically reserved sales orders
    2. b) Release for pick ( Picking List posting)
    3. Post Packing Slip

    I have automated the step 1 : Reservation ( i.e. I am able to reserve based on Inventory dimension like serial number or batch id ). But regarding step 2 I have below questions:

    1. Can I update Deliver Now QTY through code without following step 2. i.e. bypass step 2 ?
    2. How to post packing slip using x++?

    Regards
    Sudhesh Dessai

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete