Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Linking Purchase Invoices against Purchase Receipts

Posted on by 627

Trying out BC 365 SaaS sandbox and I had a question when it comes to Purchase Orders, Purchase Receipts, and Purchase Invoices. Let's say we have the following scenario:

  • We order an item from the vendor, on a new Purchase Order.
  • We receive the item from the vendor, without being invoiced yet. So a Purchase Receipt.
  • Before being invoiced by the vendor, we sell that item to a customer. So a new Sales Order.
  • We then are ready to pay the vendor, so proceed into creating a new Purchase Invoice.

Based on that workflow above, we should be able to tie the Purchase Invoice line back to the originating Purchase Receipt, correct? Currently testing out a few transactions, it appears as if the new Purchase Invoice isn't correlating the Purchase Receipt for the specific item. So a duplicate Posted Purchase Receipt is being generated when the Purchase Invoice posts. And when I go into the Get Receipt Lines function I don't find any items to link into the new Purchase Invoice.

Am I missing something basic?

  • Greg Kujawa Profile Picture
    Greg Kujawa 627 on at
    RE: Linking Purchase Invoices against Purchase Receipts

    Yes, that's definitely correct when it comes to inserting those two field values. I did try this, but then ran into a knock-on effect. Since I'm also associating serialized item tracking with these Purchase Invoice lines. Using routines like this --> community.dynamics.com/.../how-to-create-reservation-entry-in-al. Ran into thrown errors about the reservation type being incorrect. The system was looking for Prospect as being the reservation type, rather than the Surplus reservation type I had been choosing.

    I'll take a look behind the scenes with Codeunit 74 and try to grasp all of the ins and outs of how the Get Receipt Lines handles these transactions. Thanks for the feedback!

  • Suggested answer
    KasparsSemjonovs Profile Picture
    KasparsSemjonovs 3,934 Super User 2024 Season 2 on at
    RE: Linking Purchase Invoices against Purchase Receipts

    As Inge said - basically You are trying to create an alternative Get Receipt Lines process - so look at the original for initial informaiton. 

    From what I see - this process adds values in the Purchase Invoice lines for the field: Receipt No. (Field ID 63), and Receipt Line No. (Field ID 64).

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Linking Purchase Invoices against Purchase Receipts

    If what you really want to do is to create your own "Get receipt lines" function then you should look at codeunit 74 "Purch.-Get Receipt"

    and see how the standard system handles that process and incorporate that into your AL code.

    Or maybe just use the function as it is because you anyway have to reconcile the lines that are on your invoice.

  • Greg Kujawa Profile Picture
    Greg Kujawa 627 on at
    RE: Linking Purchase Invoices against Purchase Receipts

    I am aware of that workflow, and that's fine for onesy-twosy items being handled this way. But it's a poorly scaled workflow when it comes to what we are looking at for production. Looking at many hundreds of line items against many dozens of purchase receipts being invoiced on a single invoice document. Going into each purchase receipt and clicking through those specific lines to change the quantity to invoice one at a time isn't practical.

    We have working AL extension code that can pull all vendor sales between a specified date range, and push those line items into a new invoice. That all works fine, but we need to link those lines to their purchase receipts. In order to not generate a duplicate posted purchase receipt for all the items that have already been received. Since there is a Get Receipt Lines function out of the box right in the Purchase Invoice lines I assume there is a way. Not to mention the Purchase Invoice lines out of the box have two fields that can refer to the Purchase Receipt No. and Purchase Receipt Line No. 

  • Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Linking Purchase Invoices against Purchase Receipts

    Then i guess you have a purchase order where you have receipt qty that is not invoiced yet?

    When you have a purchase order you should post both receipt and invoice from that purchase order. You do not create a new purchase invoice.

    Use the qty to invoice on the purchase order.

  • Greg Kujawa Profile Picture
    Greg Kujawa 627 on at
    RE: Linking Purchase Invoices against Purchase Receipts

    Thanks for the quick reply! When I posted the Purchase Invoice, this Posted Purchase Receipt was automatically generated. Assuming since the Posted Purchase Invoice didn't link to the original Purchase Receipt?

    PPI.png

    6232.ILE.png

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Linking Purchase Invoices against Purchase Receipts

    If you look at the item ledger entries for the item you purchased and sold it might get a bit clearer for you.

    There you will find one record representing the physical inventory movement created by the purchase receipt and one entry representing the cost of the received item as result of your purchase invoice.

    And you will see that different field on the item ledger entries are used for those two record types in the item ledger entry table.

    If you want a more detailed explanation you can paste your item ledger entries here so we can look at them in detail.

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