How to cancel a Sales or Purchase orders or How to get cancel status to a Sales order or Purchase order in MS Dynamics AX 2012

Hi All,

we are going to discuss about how to cancel a sales or Purchase order. If a Sales order or Purchase order  gets a Cancelled status if it is cancelled in below way.

Here let us take example of Sales order cancellation process and same process holds for Purchase order also.

First create a new sales order and have one sales line for example.


Go to Sales order –> select sales line—> click Update line as shown in the below screenshot—> select Deliver remainder


New Update remainging quantity form is opened—> Click Cancel quantity button as shown in below screenshot.


once you perform this for a single line where no items are not delivered then automatically sales line status will be changed to Cancelled as shown in below screenshot.


Once you perform this for all lines which are not processed (means no items were delivered from all the lines) then automatically sales order header status will be changed to Cancelled as shown in below screenshot.


By rambabuyelisetty

40 comments on “How to cancel a Sales or Purchase orders or How to get cancel status to a Sales order or Purchase order in MS Dynamics AX 2012

  1. Hi I have tried the procedure to cancel sales order line remaining quantities, but it doesn’t change the status. Any setup is needed for this? I have tried using a new sales order, an order which is partially shipped, but it fails and doesn’t give any error. Appreciate your time to reply on this. Thanks

    • Hi Mohan, You can cancel Order if it is partially shipped. only you can do canceling remaining qty and not the order. If you want to cancel then reverse the partially shipped order and follow the steps in blog.

      • Hi Ram, Thanks for quick reply. I am not cancelling an order which is partially shipped. I am trying to cancel line items balances quantity by using the steps you’ve provided and doesn’t work. Can you advice is there is any setup to allow/disallow ‘cancel balance quantity’ feature?

      • Hi, For this you have to same process, select the line which you want to cancel for balances Qty. click Functions button–> select Deliver remainder –> Put ‘0’ in the Deliver remainder qty field and click OK. check the status of the line.

        HOpe this helps you.

      • Hi Ram,

        Thanks for the quick reply. As I mentioned, this line items status is not changing even after cancel for balance quantity using delivery remainder. May I know whether any setup is required to use this function? Any know issue why it is not functioning?

        Thanks in advance.

    • when you cancel the qty that has not shipped where do you see this qty amount for that item move back into inventory or is there another step?

  2. On the AX 2012 in the Maintain Action tab just click cancel after selecting the PO. it will cancel all the lines and the entire PO you wish to cancel.

    • Try to select all the lines and perform same action. I am not sure whether this option is enabled when all the lines are selected. try and see. If disabled means we need to do one by one only. or need to search for any other alternative.

  3. Rather than cancel the sales order I want to delete it. Say it’s been entered in error. No transactions posted on it, delete the lines, but error when trying to delete the header saying ‘not posted transactions exist’. any ideas?

    • Looks strange, request to look into line level. try to delete line by line and then target header. if you delete in this way then you will understand as which line is stopping you in deleting. Look into saleline transactions and try to delete it. If there is Automatic reservation set for that Item also it is equal to trasaction as well. so take care here in reservation form as well.

  4. Hi

    i voided sales order and i need to make restore for my sales order (SO – 000013970). i searched by internet how i can make restore, i found one code to run in X++ by create a class to provide an option of restoring the orders

    static void restoreDeletedSO(Args _args)


    SalesTableDelete salesTableDelete;

    SalesLineDelete salesLineDelete;

    SalesTable salesTable;

    SalesLine salesLine;


    SalesTableDelete = SalesTableDelete::find(’SO – 000013970′, true);


    switch (salesTableDelete.Cancelled)


    case Voided::Voided :

    salesTable = conpeek(salesTableDelete.SalesTable, 1);


    while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId


    salesLine = conpeek(salesLineDelete.SalesLine, 1);





    case Voided::linesVoided :

    while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId


    salesLine = conpeek(salesLineDelete.SalesLine, 1);









    When i make compile for my code there is error appearing syntax error for line number 1 and 3

    how i can solve this issue??

  5. I cancelled items on a sales order and then when I created a return order the cancelled item still displayed on that sales order whne I pulled it in. Why did the cancelled item still show when I cancelled the item on the sales order. I was also able to pull that cancelled item in on the return order which was an error on my part but thought the item would not even show up?

    • HI Shiva,

      select the particular PO line, go to registration form and deregister it by checking the check box again. (uppper pane line with Registered status). once you deregister it it comes to ordered status for inventory.
      Now you can come out of this line and delete the line or change the quantity.

      Try this one and let me know if this solved your problem

  6. Hi there,

    I have the following scenario – goods have been received and is currently in a quarantine warehouse. How do I go about returning this goods to a sender if no invoice has been created yet?

    • HI,
      If they are not yet invoiced means we can do in this way. you have to change the qty to negative in the same line and do Packing slip or product receipt list. if this is not feasible we can add another line in same PO lines with negative and post the packing slip or product receipt list.
      The other way is scap them in Quarantine wareshouse only and dont perform packing slip (this option is applicable only if packing slip is not posted)


  7. Pingback: Purchase Order Form Ax 2012 | Order Letters

  8. Do you know of a way in AX2012 that you can tell WHEN a line was cancelled? We are pros at cancelling now but need to see the dates of when the cancellation occurred and I cannot seem to be able to do this? Any ideas?

  9. Hi, I processes the same as above and the remaining quantity is canceled, i ordered 1900 and received 1000 and i canceled the remaining 900, the LineQuantity in General tab shows Deliver remainder is 0 but the PO line is still show the quantity 1900, how to update the ordered quantity in Purchase Order line?

      • The line quantity field is read-only, I can’t change the quantity, although if I don’t cancel the remaining quantity I unable to change the line quantity for those items which is partially received and invoices. Currently I’m using Dynamics AX R3

      • can you give some more details like, have you delivered some items as of now? Try to put 0 in the Inventory quanity section field and click cancel quantity and update me with your results

    • we can do it by clicking update line in so or po lines and click deliver reminder option and click cancel quantity buttion and close the form. This is equal to closing the PO or SO after partials.

    • We can do partial cancellation by doing the same process by editing the quanity in deliver reminder. or you can use close check box in Packing slip or invoice posting form in the lines.
      Try this and update me.

  10. Hi What happens when you click on the Cancel tab under Receive- Product Receipt and nothing after you select the line you want to cancel. The item remains never leaves not matter what .
    What would cause this?

    • Hi Sorry for delay was bit busy with project.
      For above query if PO is invoiced you cannot cancel or correct the line received. If it is not invoiced then still you are not able to cancel means we need to debug it techncially by techie.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s