You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we need a new integration event OnTransferItemLedgToTempRecOnAfterSetLoadFieldsOnItemLedgerEntry() behind the ItemLedgEntry.SetLoadFields() in procedure TransferItemLedgToTempRec() in codeunit 6501 "Item Tracking Data Collection"
procedure TransferItemLedgToTempRec(var ItemLedgEntry: Record "Item Ledger Entry"; var TrackingSpecification: Record "Tracking Specification" temporary)
var
IsHandled: Boolean;
begin
ItemLedgEntry.SetLoadFields(
"Entry No.", "Item No.", "Variant Code", Positive, "Location Code", "Serial No.", "Lot No.", "Package No.",
"Remaining Quantity", "Warranty Date", "Expiration Date");
// >> New
OnTransferItemLedgToTempRecOnAfterSetLoadFieldsOnItemLedgerEntry(ItemLedgEntry);
// << New
if ItemLedgEntry.FindSet() then
repeat
if ItemLedgEntry.TrackingExists() and
not TempGlobalReservEntry.Get(-ItemLedgEntry."Entry No.", ItemLedgEntry.Positive)
then begin
TempGlobalReservEntry.Init();
TempGlobalReservEntry."Entry No." := -ItemLedgEntry."Entry No.";
TempGlobalReservEntry."Reservation Status" := TempGlobalReservEntry."Reservation Status"::Surplus;
TempGlobalReservEntry.Positive := ItemLedgEntry.Positive;
TempGlobalReservEntry."Item No." := ItemLedgEntry."Item No.";
TempGlobalReservEntry."Variant Code" := ItemLedgEntry."Variant Code";
TempGlobalReservEntry."Location Code" := ItemLedgEntry."Location Code";
TempGlobalReservEntry."Quantity (Base)" := ItemLedgEntry."Remaining Quantity";
TempGlobalReservEntry."Source Type" := Database::"Item Ledger Entry";
TempGlobalReservEntry."Source Ref. No." := ItemLedgEntry."Entry No.";
TempGlobalReservEntry.CopyTrackingFromItemLedgEntry(ItemLedgEntry);
if TempGlobalReservEntry.Positive then begin
// >> New
[IntegrationEvent(false, false)]
local procedure OnTransferItemLedgToTempRecOnAfterSetLoadFieldsOnItemLedgerEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
end;
// << New
Additional context
Within the loop on item ledger entries, the procedure CopyTrackingFromItemLedgEntry() of table 337 "Reservation Entry" is called. This procedure transfers the Serial No. and Lot No. from the item ledger entry to the reservation entry and contains the integration event call OnAfterCopyTrackingFromItemLedgEntry() which provides the possibility for third party apps to transfer their additional item tracking fields. Because of the SetLoadFields on item ledger entries in procedure TransferItemLedgToTempRec(), additional item tracking fields are never loaded initially and needs to be retrieved by an additional database read.
In worst case, if an item ledger entry is changed (e.g. by a partial negative adjustment) between the ItemLedgEntry.FindSet() in procedure TransferItemLedgToTempRec() of codeunit "Item Tracking Data Collection" and the call of OnAfterCopyTrackingFromItemLedgEntry() in the reservation entry table, an error "The field 'Remaining Quantity' on table 'Item Ledger Entry' has changed in the database between initial and JIT load." occurs.
By providing the requested integration event it is possible to use the AddLoadFields() method to specifies additional fields to be initially loaded and to avoid unnecessary database reads.
The text was updated successfully, but these errors were encountered:
Hello,
we need a new integration event OnTransferItemLedgToTempRecOnAfterSetLoadFieldsOnItemLedgerEntry() behind the ItemLedgEntry.SetLoadFields() in procedure TransferItemLedgToTempRec() in codeunit 6501 "Item Tracking Data Collection"
Additional context
Within the loop on item ledger entries, the procedure CopyTrackingFromItemLedgEntry() of table 337 "Reservation Entry" is called. This procedure transfers the Serial No. and Lot No. from the item ledger entry to the reservation entry and contains the integration event call OnAfterCopyTrackingFromItemLedgEntry() which provides the possibility for third party apps to transfer their additional item tracking fields. Because of the SetLoadFields on item ledger entries in procedure TransferItemLedgToTempRec(), additional item tracking fields are never loaded initially and needs to be retrieved by an additional database read.
In worst case, if an item ledger entry is changed (e.g. by a partial negative adjustment) between the ItemLedgEntry.FindSet() in procedure TransferItemLedgToTempRec() of codeunit "Item Tracking Data Collection" and the call of OnAfterCopyTrackingFromItemLedgEntry() in the reservation entry table, an error "The field 'Remaining Quantity' on table 'Item Ledger Entry' has changed in the database between initial and JIT load." occurs.
By providing the requested integration event it is possible to use the AddLoadFields() method to specifies additional fields to be initially loaded and to avoid unnecessary database reads.
The text was updated successfully, but these errors were encountered: