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.
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;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156