Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Unable to show the PO No.

(0) ShareShare
ReportReport
Posted on by 1,893

Vendor Ledger Entry - OnAfterGetRecord()

I want to print the Purchase Order No. which is saved in purchase receipt header.

My code is below.

PurchInvLine.RESET;
PurchInvLine.SETRANGE("Document No.",PurchInvHeader."No.");
PurchInvLine.SETRANGE("Receipt Document No.",PurchRcptHeader."No.");
IF PurchInvLine.FIND('-') THEN BEGIN
PurchRcptHeader.RESET;
PurchRcptHeader.SETRANGE("Order No.", PurchInvHeader."Order No.");
IF PurchRcptHeader.FIND('-') THEN BEGIN
PONo:= PurchRcptHeader."Order No.";
END;
END;

My code is not working to get the PO No. information.

Here have three table,
Purch. Inv. Header
Purch. Rcpt. Header
Purch. Inv. Line

Receipt Document No. is a MRN no from "Purch. Rcpt. Header". ORDER No. is field in "Purch. Rcpt. Header" table, which have PO No.

*This post is locked for comments

  • manish.yadav Profile Picture
    1,893 on at
    RE: Unable to show the PO No.

    My data item is "Vendor Ledger Entry" that's a reason i am facing the problem to find the PO no from PurchRcptHeader .

    Through my code:

    Vendor Ledger Entry - OnAfterGetRecord()

    I have find the many values, but unable to find the PO no. from PurchRcptHeader.

    recVend.RESET;

    recVend.SETRANGE("No.","Vendor Ledger Entry"."Vendor No.");

    IF recVend.FIND('-') THEN BEGIN

      txtvendname := recVend.Name;  

    END;

    PurchInvHeader.RESET;

    PurchInvHeader.SETRANGE("No.","Vendor Ledger Entry"."Document No.");

    IF PurchInvHeader.FIND('-') THEN BEGIN

       txtPONo := PurchInvHeader."Order No.";

       txtPayTerms:=PurchInvHeader."Payment Terms Code";

    END;

  • Suggested answer
    Mohana Yadav Profile Picture
    60,232 Super User 2025 Season 1 on at
    RE: Unable to show the PO No.

    PurchInvLine.SETRANGE("Receipt Document No.",PurchRcptHeader."No.");

    you are getting PurchRcptHeader below and does this field has values here?

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans