Why do you need this change?
We need to supply an externally determined warehouse register record before a warehouse journal line is posted. When warehouse posting follows an item posting cycle within the same document posting operation, the warehouse register must continue from the item register state rather than creating a new register record with freshly determined entry ranges.
The standard Code procedure initializes WhseEntryNo from GlobalWhseEntry.GetLastEntryNo() when it is zero. The WhseReg record is created later in InsertWhseReg with a new register number and entry range. There is no way for a subscriber to provide a pre-existing warehouse register record that should be used instead.
The existing OnBeforeCode event passes WhseJnlLine and WhseEntryNo as var parameters but does not include WhseReg. The OnAfterCode event already passes WhseReg as a var parameter for capture after posting, but there is no corresponding injection point before posting begins.
Describe the request
Add var WhseReg: Record "Warehouse Register" to the existing integration event OnBeforeCode in the Code procedure in Codeunit 7301 "Whse. Jnl.-Register Line". The new parameter follows the existing parameters at the end.
begin
Clear(CombineLotsEntryNo);
OnBeforeCode(WhseJnlLine, WhseEntryNo, WhseReg); // <---- New parameter at end
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnBeforeCode(var WarehouseJournalLine: Record "Warehouse Journal Line"; var WhseEntryNo: Integer; var WarehouseRegister: Record "Warehouse Register")
begin
end;
Alternatives evaluated: OnCodeOnAfterGetLastEntryNo fires after WhseEntryNo is resolved from the database but does not expose WhseReg. OnAfterCode fires at the end of the procedure after all warehouse entries are created and the register is finalized, too late for state injection. OnInitWhseEntryOnBeforeInitWhseEntry fires inside InitWhseEntry after the entry number is assigned but before the warehouse entry record is initialized, which is too narrow in scope for full register state injection. No event currently allows supplying a warehouse register record before the Code procedure begins processing.
Internal work item: AB#639007
Why do you need this change?
We need to supply an externally determined warehouse register record before a warehouse journal line is posted. When warehouse posting follows an item posting cycle within the same document posting operation, the warehouse register must continue from the item register state rather than creating a new register record with freshly determined entry ranges.
The standard
Codeprocedure initializesWhseEntryNofromGlobalWhseEntry.GetLastEntryNo()when it is zero. TheWhseRegrecord is created later inInsertWhseRegwith a new register number and entry range. There is no way for a subscriber to provide a pre-existing warehouse register record that should be used instead.The existing
OnBeforeCodeevent passesWhseJnlLineandWhseEntryNoasvarparameters but does not includeWhseReg. TheOnAfterCodeevent already passesWhseRegas avarparameter for capture after posting, but there is no corresponding injection point before posting begins.Describe the request
Add
var WhseReg: Record "Warehouse Register"to the existing integration eventOnBeforeCodein theCodeprocedure in Codeunit 7301 "Whse. Jnl.-Register Line". The new parameter follows the existing parameters at the end.Event Signature:
Alternatives evaluated:
OnCodeOnAfterGetLastEntryNofires afterWhseEntryNois resolved from the database but does not exposeWhseReg.OnAfterCodefires at the end of the procedure after all warehouse entries are created and the register is finalized, too late for state injection.OnInitWhseEntryOnBeforeInitWhseEntryfires insideInitWhseEntryafter the entry number is assigned but before the warehouse entry record is initialized, which is too narrow in scope for full register state injection. No event currently allows supplying a warehouse register record before theCodeprocedure begins processing.Internal work item: AB#639007