web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / DAX Beginners / How to: Cancel Deliver Rema...

How to: Cancel Deliver Remainder through X++

Christian Silva Profile Picture Christian Silva 707

The following code is used to cancel deliver remainder through X++, if you want to know how to do it through client click here.

You don’t know what is Deliver Remainder? For example, you have a purchase order for 10 items, the supplier ships 8 there are 2 on order, the supplier tells you they will never ship them. By using deliver remainder you close the line. This shows you you ordered 10 (you could change the quantity to 8) and were sent 8, so the vendor failed to deliver to the commitment impacting on vendor performance. Same is applicable on sales orders when a customer cancels but you want to show the original commitment.

Now, I have created a new Job just to show how to do it through X++:

static void _CancelDeliverRemainder(Args _args)
{
    PurchLine purchLine = PurchLine::find('000023', true);
    ;
    
    if (purchLine)
    {
        // Set remaining inventory Qty to zero
        purchLine.RemainInventPhysical  = 0;

        // Set remaining physical Qty to zero
        purchLine.RemainPurchPhysical   = 0;
                        
        // We have to cancel the purchLine
        // Not necessary, I did this to do exactly like AX does
        purchLine.PurchStatus           = PurchStatus::Canceled;

        // Update PurchLine
        purchLine.update();

        // This method will update the inventory transactions
        InventMovement::bufferSetRemainQty(purchLine);
    }
}

This was originally posted here.

Comments

*This post is locked for comments