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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Duplicate Purchase order

(0) ShareShare
ReportReport
Posted on by 1,260

Hi,

How can I remove the duplicate purchase order lines from AX 2012 R3. I have figured out 64 PO's and they have duplicate items in the order; is there a way I can remove those items from the order?

*This post is locked for comments

I have the same question (0)
  • Guy Terry Profile Picture
    28,968 Moderator on at

    Hi D_Meethu,

    Do you mean you want AX to automatically detect duplicate lines in a purchase order and delete them for you? Or do you mean you want to delete the lines manually, but for some reason can't?

  • Israel Gonzalez Profile Picture
    746 on at

    Hello D_Meethu R,

    When you refer duplicate you mean that 2 product of the same ItemId is creating in the detail of the purchase order?

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    Hi Guy/Israel

    Guy I have 64 PO's that I have detected so far, and all this PO's have duplicate itemid created (don't know how) - but now I want to delete them. Is there a way to delete this extra duplicate from AX or from my side that I can perform quickly?

    Israel yes you are correct.

  • Suggested answer
    Israel Gonzalez Profile Picture
    746 on at

    Yes, you can create a job and use this code reference:

    delete_k   delete_k;

    delete_k   delete_k_select;

    delete_k   delete_k_delete;  

       while select delete_k group by

           d1, d2, d3

       {                

           select firstOnly RecId from delete_k_select

               where delete_k_select.d1 == delete_k.d1 &&

                     delete_k_select.d2 == delete_k.d2 &&

                     delete_k_select.d3 == delete_k.d3;

           delete_from delete_k_delete

               where delete_k_delete.d1 == delete_k.d1 &&

                     delete_k_delete.d2 == delete_k.d2 &&

                     delete_k_delete.d3 == delete_k.d3 &&

                     delete_k_delete.RecId != delete_k_select.RecId;        

       }

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    Hi Israel,

    Is there a way I can do from front end or SQL as I will have to provide them the steps and the user who had issues don't have access to AOT.

  • Suggested answer
    Israel Gonzalez Profile Picture
    746 on at

    Sure, for to do it in a secure way I recommend using this link:

    support.microsoft.com/.../139444

    Let me know if you need help.

  • Guy Terry Profile Picture
    28,968 Moderator on at

    Deleting purchase order lines via SQL is a terrible idea. The lines will be linked to things like Inventory transactions, they might be received or invoiced. Deleting records in PurchLine via SQL won't handle any of this other stuff.

    Why not open each Purchase order (which has duplicate lines) in turn. Tick each line that should be deleted using the tick box on the left, and then click 'Remove'?

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    Guy,

    I have already found out 64 PO's where there can be more - going through all 64 lines seems like whole day work.

  • Weaveriski Profile Picture
    23,620 Moderator on at

    You will potemtially create a lot more than a days work from the back end.

    64 PO's, but you do not say how many lines. Just delete them from the front end, identify the correct line and remove it, you presumably have to also resend the PO's to the vendors. Also look at how these are being created - solve the original issue as well to prevent repitition.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans