Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Modify a field on Purchase Header

Posted on by 35

We have a lot of old purchase orders that we need to invoice.  They have all been received in.  Each time you go and invoice the PO it requires a Vendor Invoice No..  I am trying to create a report that we can run and have it add the vendor invoice no into each PO and auto increment the no.  I was able to get it to add a vendor invoice no but can't get to increment the number for each new PO that we need to invoice. Is there a way to do this?

Thank you in advance.

*This post is locked for comments

  • mjcjyk Profile Picture
    mjcjyk 35 on at
    RE: Modify a field on Purchase Header

    Hi AJ,

    I set a variable type Integer as you suggested but how can I translate that into update the Vendor Invoice No field?

  • Verified answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Modify a field on Purchase Header

    Hi Mjcjyk,

    My vote for No. Series as suggestions of AJ Ansari and Amol Salvi.

    Take a look at NoSeriesManagement codeunit, GetNextNo function will provide you more information.

  • Verified answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Modify a field on Purchase Header

    Vendor Invoice No is Code Field and I would suggest create one no series for get it increment automatically .

  • Verified answer
    AJAnsari Profile Picture
    AJAnsari 5,754 on at
    RE: Modify a field on Purchase Header

    Hi mjcjyk,

    Just a quick comment (if you know this already, you can skip to the next paragraph): The Vendor Invoice No. field is meant to be populated with the invoice number provided by the vendor so that it can be referenced at a later time in the Vendor Ledger Entries, payments, etc.

    Assuming you're writing a Processing Report in NAV with Purchase Header as a dataitem, it should be pretty easy to create a variable of type Integer (let's say we call this variable VendInvNo), set it to a starting value of something like 10000, and then use it in the OnAfterGetRecord trigger set the value of the Vendor Invoice No., and then have it self-increment with a statement like:

    VendInvNo := VendInvNo + 1;

    That way, when the report loops back in with the next record, the next PO will get Vendor Invoice No 10001, and the next one gets 10002 and so on.

    If you wish to make it alphanumeric, then you can follow the same concept but concatenate this variable with an alphabetical prefix (defined as a constant) before filling in the value in the Vendor Invoice No. field.

    Or, you could also create a No. Series in NAV for it, then use the No. Series Management codeunit to find the next available number and use it (and the codeunit is responsible for autoincrementing).

    I hope this helps. If my response has answered your question, please verify by clicking Yes next to "Did this answer your question?"

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans