Why do you need this change?
We need to read the complete item register state after an item journal line is posted, including the physical inventory entry number and capacity ledger entry number. These two variables are updated during posting by InsertPhysInventoryEntry and InsertCapLedgEntry, and their final values must be captured to continue sequential entry numbering in a subsequent posting context.
The standard Code procedure updates PhysInvtEntryNo when a physical inventory ledger entry is inserted and CapLedgEntryNo when a capacity ledger entry is inserted. Both values are final at the end of the procedure.
The existing OnAfterPostItemJnlLine event passes ItemReg, ItemLedgEntryNo, ValueEntryNo, and ItemApplnEntryNo as var parameters but does not include PhysInvtEntryNo or CapLedgEntryNo. A subscriber cannot capture the complete register state without these two fields.
Describe the request
Add var PhysInvtEntryNo: Integer and var CapLedgEntryNo: Integer to the existing integration event OnAfterPostItemJnlLine in the Code procedure in Codeunit 22 "Item Jnl.-Post Line". The new parameters follow the existing parameters at the end.
// Entry no. is returned to shipment/receipt
if Subcontracting then
"Item Shpt. Entry No." := CapLedgEntryNo
else
"Item Shpt. Entry No." := GlobalItemLedgEntry."Entry No.";
end;
OnAfterPostItemJnlLine(ItemJnlLine, GlobalItemLedgEntry, ValueEntryNo, InventoryPostingToGL, CalledFromAdjustment, CalledFromInvtPutawayPick, ItemReg, ItemLedgEntryNo, ItemApplnEntryNo, PhysInvtEntryNo, CapLedgEntryNo); // <---- New parameters at end
end;
Event Signature:
[IntegrationEvent(true, false)]
local procedure OnAfterPostItemJnlLine(var ItemJournalLine: Record "Item Journal Line"; ItemLedgerEntry: Record "Item Ledger Entry"; var ValueEntryNo: Integer; var InventoryPostingToGL: Codeunit "Inventory Posting To G/L"; CalledFromAdjustment: Boolean; CalledFromInvtPutawayPick: Boolean; var ItemRegister: Record "Item Register"; var ItemLedgEntryNo: Integer; var ItemApplnEntryNo: Integer; var PhysInvtEntryNo: Integer; var CapLedgEntryNo: Integer)
begin
end;
Alternatives evaluated: OnAfterPostItem fires inside PostItem after value posting but before physical inventory entries are inserted in some paths. OnAfterInsertPhysInventoryEntry fires when a physical inventory entry is inserted but does not expose the capacity ledger entry number. OnAfterInsertCapLedgEntry fires when a capacity ledger entry is inserted but does not expose the physical inventory entry number. No single event currently captures both PhysInvtEntryNo and CapLedgEntryNo together with the other register fields at the end of the posting cycle.
Why do you need this change?
We need to read the complete item register state after an item journal line is posted, including the physical inventory entry number and capacity ledger entry number. These two variables are updated during posting by
InsertPhysInventoryEntryandInsertCapLedgEntry, and their final values must be captured to continue sequential entry numbering in a subsequent posting context.The standard
Codeprocedure updatesPhysInvtEntryNowhen a physical inventory ledger entry is inserted andCapLedgEntryNowhen a capacity ledger entry is inserted. Both values are final at the end of the procedure.The existing
OnAfterPostItemJnlLineevent passesItemReg,ItemLedgEntryNo,ValueEntryNo, andItemApplnEntryNoasvarparameters but does not includePhysInvtEntryNoorCapLedgEntryNo. A subscriber cannot capture the complete register state without these two fields.Describe the request
Add
var PhysInvtEntryNo: Integerandvar CapLedgEntryNo: Integerto the existing integration eventOnAfterPostItemJnlLinein theCodeprocedure in Codeunit 22 "Item Jnl.-Post Line". The new parameters follow the existing parameters at the end.Event Signature:
Alternatives evaluated:
OnAfterPostItemfires insidePostItemafter value posting but before physical inventory entries are inserted in some paths.OnAfterInsertPhysInventoryEntryfires when a physical inventory entry is inserted but does not expose the capacity ledger entry number.OnAfterInsertCapLedgEntryfires when a capacity ledger entry is inserted but does not expose the physical inventory entry number. No single event currently captures bothPhysInvtEntryNoandCapLedgEntryNotogether with the other register fields at the end of the posting cycle.