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)

Error while creating Purchase order in Dynamics AX 2012

(0) ShareShare
ReportReport
Posted on by 10,796 User Group Leader

Hi friends, 

I have been facing the below error while creating new Purchase order in AX 2012. I don't know why it is happening but after digging more into code it crashed while writing code in IL. Some web services running in this may causing this issue please give me any pointer how can I track this as I don't have much idea web services in AX 2012.

NOTE: This error is coming in only one company and I am able to create PO in other companies. 

 

Cannot create a record in Purchase orders (PurchTable). Purchase order: COM-0000XX, COM-00XXXX.

The record already exists.

 

Microsoft.Dynamics.Ax.Xpp.DuplicateKeyException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.DuplicateKeyException' was thrown.

 

   at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue)

 

   at Microsoft.Dynamics.Ax.MSIL.cqlCursorIL.insert(IntPtr table)

 

   at Microsoft.Dynamics.Ax.Xpp.Common.doInsert()

 

   at Dynamics.Ax.Application.PurchTableType.Insert(Boolean _interCompanySilent, Date _accountingDate, Boolean , Boolean ) in PurchTableType.insert.xpp:line 21

 

   at Dynamics.Ax.Application.PurchTable.Insert(Boolean _interCompanySilent, Date _accountingDate, Boolean , Boolean ) in PurchTable.insert.xpp:line 7

 

   at Dynamics.Ax.Application.PurchTable.@Insert(Boolean _interCompanySilent, Boolean )

 

   at Dynamics.Ax.Application.PurchTable.Insert(Boolean _interCompanySilent)

 

   at Dynamics.Ax.Application.PurchCreateOrderForm.writeOnServer(Object[] _params) in PurchCreateOrderForm.writeOnServer.xpp:line 25

 

   at PurchCreateOrderForm::writeOnServer(Object[] )

 

   at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)

 

   at Dynamics.Ax.Application.SysDictClass.invokeStaticMethod(Object[] _params) in SysDictClass.invokeStaticMethod.xpp:line 26

 

   at SysDictClass::invokeStaticMethod(Object[] )

 

   at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)

 

   at Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.runAsInvoke(String className, String staticMethodName, Object[] parms, Object[]& exportInfolog)

*This post is locked for comments

I have the same question (0)
  • Tim Schofield Profile Picture
    on at

    Check the setting on the purchase order number sequence. If it's set to continuous - switch that off

  • Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Thanks for your reply. Number sequence is not set to continuous.

  • Community Member Profile Picture
    on at

    Did you find reason behind this?  I have same type of error but different table.

  • Martin Dráb Profile Picture
    239,022 Most Valuable Professional on at

    Randy, please create your own thread and explain your problem there (with all details that you omitted here).

  • jgracak Profile Picture
    on at

    Hi Faisal,

    Did you check the SystemSequences recID for purchase orders? I had the same problem of corrupted RecId and the system trying to create the same RecId for documents that already existed.

    Kind regards,

    Josip

  • Anton Venter Profile Picture
    20,656 Super User 2026 Season 1 on at

    Hi Faisal, are there any custom indices on the table that might be causing this? If not then it's probably the purchid or recid values that already exist in the table. To find out, check the highest values of these fields and compare them to the number sequence and the sydtemsequence.

  • Martin Dráb Profile Picture
    239,022 Most Valuable Professional on at

    Guys, Faisal created this thread in year 2012; I don't think he is still waiting for your answers.

  • Verified answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Hi All,

    I created this thread in 2012 and I don't recall what was the actual issue and how did I resolve it exactly. It was not related to RecId and indexes in system, for these points I am sure as I checked these points before posting the question. As per my gut feelings this was related to CIL genertion issue.

    If anyone is having such type of issue please raise start new thread as Martin suggested.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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