Skip to main content

Notifications

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

how to flow fields from reservation entry on posting purchase document.

Posted on by 127

Anyone know the event which help me to flow data from reservation entries to item ledger entry on posting purchase document.

I am not able to find it.
Thanks in advance.

Categories:
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: how to flow fields from reservation entry on posting purchase document.

    Hi,

    Can you try take idea from codeunit 90 with below event? This is an Idea just.

    procedure OnBeforePostItemJnlLine(PurchHeader: Record "Purchase Header"; var PurchLine: Record "Purchase Line"; var QtyToBeReceived: Decimal; var QtyToBeReceivedBase: Decimal; var QtyToBeInvoiced: Decimal; var QtyToBeInvoicedBase: Decimal; var ItemLedgShptEntryNo: Integer; var ItemChargeNo: Code[20]; var TrackingSpecification: Record "Tracking Specification"; CommitIsSupressed: Boolean; var IsHandled: Boolean; var ItemJnlPostLine: Codeunit "Item Jnl.-Post Line"; var Result: Integer)

    var

       ReservationEntry: Record "Reservation Entry";

       ItemLedgerEntry: Record "Item Ledger Entry";

    begin

       // Retrieve the reservation entries related to the purchase

       ReservationEntry.SetRange("Document Type", ReservationEntry."Document Type"::"Purchase Invoice");

       ReservationEntry.SetRange("Document No.", PurchaseInvoiceHeader."No.");

       if ReservationEntry.FindSet then

       begin

           // Flow data from reservation entries to item ledger entries

           while ReservationEntry.Next = true do

           begin

               ItemLedgerEntry."Entry Type" := ItemLedgerEntry."Entry Type"::Reservation;

               ItemLedgerEntry."Item No." := ReservationEntry."Item No.";

               ItemLedgerEntry."Variant Code" := ReservationEntry."Variant Code";

               ItemLedgerEntry.Quantity := ReservationEntry.Quantity;

               ItemLedgerEntry.Insert;

           end;

       end;

    end;

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans