Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

PurchStatus automatically set to "Cancelled" on PurchLine

(0) ShareShare
ReportReport
Posted on by 1,250

Hi,

We have a situation where suddenly all purchase orders created after midnight on January 1st get PurchStatus set to Cancelled.  We did a reboot of the AOS and SQL, and now it is back to normal.  E.g. PurchStatus is set to "Open order".

But now, I have several PurchLines with status Cancelled.  I am not able to deliver, invoice or delete these lines, so I am a bit stuck.  I would prefer to delete them.  I have tried importing a new status, but that does not work.  Any suggestions to what might have gone wrong, and/or how to fix this?

Thanks :)

Regards

Thor

*This post is locked for comments

  • Thor Hansen Profile Picture
    Thor Hansen 1,250 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Thanks André

    Our consultant removed the linkage between the SO/PO/IC and we were able to delete and replace the orders.

    Thanks again for your help :)

    Regards

    Thor

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Hi Thor,

    It is indeed very challenging when you have intercompany links. Probably the best would be trying to remove the links on both sides and recreate the Purchase orders.

    Doing anything with changing the status would not be sufficient as you probably now not have inventory transactions related to the PO lines. These needs to be created as well and the InventSum table should be updated.

    So you can try to remove the link (doupdate command within a job), delete and recreate the orders. Or (second option) when the link is removed, correct the PO's and put back the link. You have to look carefully on all fields from several tables if it is correct if you choose the second option.

    I have done a similar task some years ago.

  • Thor Hansen Profile Picture
    Thor Hansen 1,250 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Hi André

    The POs were created from SOs using the Autocreate intercompany orders function. So the PO is also connected to an intercompany SO.

    Neither the initial SO, nor the PO is possible to delete. The info log says that the SO has to be invoiced first.

    It is just a handful of orders, but since I cannot delete nor invoice them, it is a pain.

    Regards

    Thor

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Hi Thor,

    Your initial question did not mention the related sales orders. Can you tell us how the purchase orders are created (e.g. batch job, customization)? That would be helpful in finding the best solution. Also the number of error purchase orders and lines could be relevant.

    The Deliver remainder function is not useful when you have too many errors to correct. You also need the exact line quantities for all lines.

    Probably the best would be deleting the PO's and recreate them, but that depends also on how they were created.

  • Bilal Issa Profile Picture
    Bilal Issa 4,370 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Hi Thor,

    there is method on purchLine table that set the purchase status , so you can create while loop on PO line that have wrong status and call this method to correct it.

    Regards,

    Bilal

  • Thor Hansen Profile Picture
    Thor Hansen 1,250 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Hi Bilal,

    What do you mean by "use purchline.SetPurchStatus?  How do I do that?

    Regards

    Thor

  • Thor Hansen Profile Picture
    Thor Hansen 1,250 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Hi Nitesh

    If I change Delivery Remainder (which by the way was empty on the PO), then this updates the Intercompany Sales Order as well.  So, if I have Qty = 1 on the SO, and I change Deliver Remainder from 0 to 1 on the PO, Delivery Remainder changes to 2 on the SO, even though the Qty ordered is 1.

    /Thor

  • Bilal Issa Profile Picture
    Bilal Issa 4,370 on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    Hi ,

    Please use purchline.setPurchStatus();

    Regards,

    Bilal

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: PurchStatus automatically set to "Cancelled" on PurchLine

    when Deliver remainder quantity on a purchase line gets zero then line gets status cancelled

    I suggest you should utilize Deliver remainder function (which you will find for each line) to set the deliver remainder value to change the status of Purch line from Cancelled to Open

    Please verify if this helps you

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,387 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans