Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Cannot insert multiple records in Vendor invoice lines. The record already exists

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi 

While invoice matching in Accounts payable, an error occured. Is it a locking in the tables?

2018_2D00_05_2D00_17_5F00_17h29_5F00_34.png

*This post is locked for comments

  • _MGP Profile Picture
    _MGP 500 on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    I found this post looking for help on creating an import routine for vendor invoice lines after hitting the same error message on Line number.

    Having created a line manually in the form I was trying to use a simple Job to first create a new line in x++ by copying the existing line using buf2buf() and then changing the VendInvoiceInfoLine.LineNum to a new number but I kept getting the error message.

    It turns out there is another unique index (unique across companies too) on the VendInvoiceInfoLine table (SourceDocumentLine) that covers VendInvoiceInfoLine.SourceDocumentLine. You need to reset this to 0 before calling VendInvoiceInfoLine.write() and this creates a unique value that satisfies the index.

    Not sure why AX thinks that the Line number is a problem when it appears that it isn't (in my case at least).

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,820 Super User 2024 Season 2 on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    Hi Bob,

    There is one unique index on this table which holds a LineNum field. In my environment it has 4 fields. Can you verifiy if the TableRefIdx index in your environment also has 4 fields? (TableRefId, OrigPurchId, LineNum, RecId). In my environment there is a KB number visible on this index (KB3199741) which might indicate that there was a fix in the past for a certain issue. Probably the issue you are facing now, but I'm not sure.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    Hi André - yes, by 1 in the System Line number field. Havn´t found an solution. The Invoice- PO matching is for like + 100 POs to one invoice (summary invoice). Cannot find the anything interesting in the pending invoice form. Any clue where to proceed? Thanks for your effort.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,820 Super User 2024 Season 2 on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    Not completely sure, but did you setup the Increment field on the System parameters?

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans