X++ Confirm, Invoice and cancel purchase order

static void POConfirm(Args _args)
{
    PurchTable      pTable;
    PurchFormLetter purchFormLetter;
    AxPurchTable    axPurchTable;
   
    select pTable where pTable.PurchId == "POnumber";
 
 
    //Posting PO Confirmation
    //You cannot do invoice without doing PO confirm
    //purchTable = axPurchTable.purchTable();
    purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
    purchFormLetter.update(pTable, strFmt("%1", pTable.PurchId));

    //Posting PO Invoice
   // purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
    //purchFormLetter.update(pTable, strFmt("%1", pTable.PurchId)); 


}

Cancel a PO

static void cancelPO(Args _args)
{
    PurchTable      pTable;

    PurchCancel     pCancel;
    xArgs           _xar;


    _xar = new xArgs();

    select forUpdate pTable where pTable.PurchId == "PO number";
    {
        if(pTable.PurchStatus == PurchStatus::Backorder)
        {

            _xar.record(pTable);
            _xar.parmEnum(NoYes::Yes);
            _xar.parmEnumType(enumNum(NoYes));
            PurchCancel::main(_xar);
        }

    }

Comments

Popular posts from this blog

AX 2012 DEVOPS Build, Release setup and configuration

AX 2012 Build process using AZURE DEVOPS

What is Microsoft Power Platform?