Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Posting Invoice to Purchase Order - through web service/code unit

Posted on by Microsoft Employee

Hi everyone,

I am trying to post an invoice for a purchase order that has been received. I am trying to achieve this through web services or odata services. I would like to know how we can use the  codeunit 90/91 to achieve this job? Is it even possible as I am unable to see where i can pass which PO number to post invoice over codeunit 90 web service.

Secondly, the other way I was am trying is to use the "Purchase Invoice 51" to directly create an invoice however from front end we can associate receipts with that purchase invoice but through this service I am unable to find a way to associate receipts with the purchase invoice.

Any help would be great!

Thanks

*This post is locked for comments

  • Suggested answer
    Andrey Baludin Profile Picture
    Andrey Baludin 3,941 on at
    RE: Posting Invoice to Purchase Order - through web service/code unit

    Hi! I made the same task. But not this way. I made Invoice lines buffer, published it as web service (Page) and created a job which handled transferred invoice lines 1 time per day. So all the logic was in handling codeunit.

    In your case you can create new codeunit and publish it as web service:

    1. Purchase codeunit works with Purchase Header record. only order number is not enough. You need to get Purchase Header record and pass it to codeunit 90:

    PurchasePost.RUN(PurchaseHeader);

    2. Receipt association can be made by code. You need to:

    - Create Invoice header

    - get Receipt lines buffer (lines which need to be invoiced)

    -use codeunit 74 (Purch. -Get Receipt):

    GetReceipts.SetPurchHeader(InvoiceHeader);

    GetReceipts.CreateInvLines(PurchaseReceiptLinesBuffer);

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans