Why do you need this change?
We need to supply externally determined physical inventory entry numbers and capacity ledger entry numbers before an item journal line is posted. When item posting is interleaved with another posting context that also creates physical inventory or capacity entries, the entry numbering must continue from the prior context rather than starting from freshly queried database values.
The standard Code procedure initializes PhysInvtEntryNo from PhysInvtLedgEntry.GetLastEntryNo() in InsertPhysInventoryEntry and CapLedgEntryNo from CapLedgEntry.GetLastEntryNo() in InsertCapLedgEntry. There is no way for a subscriber to supply these entry numbers before the initialization occurs.
The existing OnBeforePostItemJnlLine event passes ItemReg, ItemLedgEntryNo, ValueEntryNo, and ItemApplnEntryNo as var parameters, but does not include PhysInvtEntryNo or CapLedgEntryNo. These two variables are part of the same register state that governs entry numbering and must be transferable together with the other register fields.
Describe the request
Add var PhysInvtEntryNo: Integer and var CapLedgEntryNo: Integer to the existing integration event OnBeforePostItemJnlLine in the Code procedure in Codeunit 22 "Item Jnl.-Post Line". The new parameters follow the existing parameters at the end.
begin
OnBeforePostItemJnlLine(ItemJnlLine, CalledFromAdjustment, CalledFromInvtPutawayPick, ItemReg, ItemLedgEntryNo, ValueEntryNo, ItemApplnEntryNo, PhysInvtEntryNo, CapLedgEntryNo); // <---- New parameters at end
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnBeforePostItemJnlLine(var ItemJournalLine: Record "Item Journal Line"; CalledFromAdjustment: Boolean; CalledFromInvtPutawayPick: Boolean; var ItemRegister: Record "Item Register"; var ItemLedgEntryNo: Integer; var ValueEntryNo: Integer; var ItemApplnEntryNo: Integer; var PhysInvtEntryNo: Integer; var CapLedgEntryNo: Integer)
begin
end;
Alternatives evaluated: OnBeforeRunWithCheck fires in RunWithCheck before the Code procedure is called, so the item journal line has not yet been prepared. OnBeforePostLineByEntryType fires inside Code after entry number initialization, too late for injection. No event currently allows overriding PhysInvtEntryNo and CapLedgEntryNo before the entry number initialization blocks.
Internal work item: AB#639005
Why do you need this change?
We need to supply externally determined physical inventory entry numbers and capacity ledger entry numbers before an item journal line is posted. When item posting is interleaved with another posting context that also creates physical inventory or capacity entries, the entry numbering must continue from the prior context rather than starting from freshly queried database values.
The standard
Codeprocedure initializesPhysInvtEntryNofromPhysInvtLedgEntry.GetLastEntryNo()inInsertPhysInventoryEntryandCapLedgEntryNofromCapLedgEntry.GetLastEntryNo()inInsertCapLedgEntry. There is no way for a subscriber to supply these entry numbers before the initialization occurs.The existing
OnBeforePostItemJnlLineevent passesItemReg,ItemLedgEntryNo,ValueEntryNo, andItemApplnEntryNoasvarparameters, but does not includePhysInvtEntryNoorCapLedgEntryNo. These two variables are part of the same register state that governs entry numbering and must be transferable together with the other register fields.Describe the request
Add
var PhysInvtEntryNo: Integerandvar CapLedgEntryNo: Integerto the existing integration eventOnBeforePostItemJnlLinein theCodeprocedure in Codeunit 22 "Item Jnl.-Post Line". The new parameters follow the existing parameters at the end.Event Signature:
Alternatives evaluated:
OnBeforeRunWithCheckfires inRunWithCheckbefore theCodeprocedure is called, so the item journal line has not yet been prepared.OnBeforePostLineByEntryTypefires insideCodeafter entry number initialization, too late for injection. No event currently allows overridingPhysInvtEntryNoandCapLedgEntryNobefore the entry number initialization blocks.Internal work item: AB#639005