Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

link Purch_ Inv_ Line and Purch_ Rcpt_line navision

Posted on by

How to link link Purch_ Inv_ Line and Purch_ Rcpt_line  navision ?

*This post is locked for comments

  • Suggested answer
    Alex A Profile Picture
    Alex A 2,348 on at
    RE: link Purch_ Inv_ Line and Purch_ Rcpt_line navision

    Jaweher89,

    Here's how you do it in T-SQL at the FROM statement:

    Note: I pulled out my company name, which prefixes the table names, and replaced it with 'xxx', so you'll need to insert your company name as prefix to the table names.

      FROM
        [xxx$Purch_ Inv_ Header] AS [PIH]
        INNER JOIN [xxx$Purch_ Inv_ Line] AS [PIL]
          ON [PIL].[Document No_] = [PIH].[No_]
        LEFT JOIN [xxx$Purch_ Rcpt_ Line] AS [PRL]
          ON [PIH].[Order No_] = [PRL].[Order No_]
            AND [PIL].[Line No_] = [PRL].[Order Line No_]
            AND [PIL].[No_] = [PRL].[No_]
            AND ISNULL([PIL].[Revision No_], '') = ISNULL([PRL].[Revision No_], '')


    In your WHERE statement you'll also need some appropriate filters:

      WHERE [PIL].[Type] = 2 -- Line TYPE: ITEM
        AND [PIL].[Quantity] > 0 -- Filter out blank quantity items on Purch Invoices
        AND ([PRL0].[Quantity] > 0 OR [PRL0].[Quantity] IS NULL)


    This approach will handle multiple deliveries that came in for the same Purchase Order line item, however remember that if you're basing your query only on the Purchase Invoice tables then only Purchase Order lines that have been received AND invoiced will show on your report.

    To make a query like this that includes the live outstanding Purchase Order lines along with the completed and fully received Purchase Order lines requires a bit more complicated SQL.  Queries related to Purchase Orders, Purchase Order Archives, Purchase Receipts, and Purchase Invoices can get tricky with NAV depending on what you're trying to do because NAV deletes the original Purchase Order once it has been fully received (with a copy in the Archive that doesn't have all the same fields as the original PO).

    Regards,

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: link Purch_ Inv_ Line and Purch_ Rcpt_line navision

    You can derive the relation from Item Ledger Entry & Value Entry Table.

    Filter the Value Entry Table by Purchase Invoice No. > Fetch the Item Ledger Entry No. > Get the ILE > Get the Purchase Receipt No.

    Can you suggest your exact requirement ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: link Purch_ Inv_ Line and Purch_ Rcpt_line navision

    .

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: link Purch_ Inv_ Line and Purch_ Rcpt_line navision

    There is no direct one-to-one relationships between those, as you mighht have several partial receipts which might have one total invoice posted. As mentioned by members earlier, you can try to trace them through initial Order No., but not in all cases. Also, if you operate with items, you can try to trace it through Item Ledger Entry and Value Entry tables, by item entry nos.

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 17,965 Super User 2024 Season 2 on at
    RE: link Purch_ Inv_ Line and Purch_ Rcpt_line navision

    Hi,

    Just to add on that -

    1. The approach provided above will work on following cases -

    > If you receipt and Invoice from Purchase Order.

    > If you receipt via warehouse and Invoice from Purchase Order.

    2. It will not work if -

    >  You receive from Warehouse and Invoice using Purchase Invoice and Get Receipt Lines

    If your customer does not use warehouse or Invoice and Order Creation is done by same person in your customer organization then Order No will work.

    But if there are different roles like below-

    1. Create Purchase Order By One Person.

    2. Receipt Product By Another Person in Warehouse.

    3. Create Purchase Invoice By Another person.

    Then Order No. concept does not work.

  • RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: link Purch_ Inv_ Line and Purch_ Rcpt_line navision

    From Purchase Invoice line you can go to Purchase Invoice Header - There's a field on Purchase Invoice Header named Order No from this you can filter to Purchase Receipt Header.Order No  and then from Purchase Recipt header No to Purchase Receipt Line

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans