Thursday, December 29, 2016

X++ code to cancel Sales order and Purchase orders in AX 2012



                   
X++ Code to cancel Sales order

static void DMSSOCancel(Args _args)
{
    SalesTable salestable;
    SalesUpdateRemain SalesUpdateRemain;

    changeCompany('f898')
    {

        salestable = salestable::find("F898-000460");

        SalesUpdateRemain::cancelRemainderOnOpenSalesLines(salestable);

    }
}


X++ Code to cancel Purchase order
static void DMSCancelPO(Args _args)
{
    PurchFormLetter Purch;
    PurchTable PurchTable;
    PurchCancel PurchCancel ;

    changeCompany("f898")
    {
        PurchTable =PurchTable::find("F898-000079");

        PurchCancel PurchCancel::construct();
        PurchCancel .parmPurchTable(PurchTable);
        PurchCancel .run();
    }

}

2 comments:

  1. Do you have, or can you help me with, the X++ code for cancelling Purchase Requisition? I need to create a custom functionality to cancel purchase requisition that also logs the reason for cancellation.

    ReplyDelete
  2. PurchParmTable method is protected in D365fo . i'm unable to use it in my class .. any suggestions please asap

    ReplyDelete

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...