Why do you need this change?
We need to intercept the smaller-UOM bin content search in FindSmallerUOMBin in Codeunit 7312 "Create Pick" at the point inside the ItemUnitOfMeasure repeat loop where each smaller unit of measure is about to be used to call GetBinContent. The goal is to replace the standard bin content search and the inner activity line creation loop entirely for a given ItemUnitOfMeasure entry.
The standard code, for each ItemUnitOfMeasure record, calls GetBinContent using ItemUnitOfMeasure.Code as the unit of measure filter, then iterates the returned FromBinContent records to calculate available quantities and create Take and Place activity lines. There is no hook before this search that allows a subscriber to supply an alternate bin content source or to skip the standard inner loop for a specific UOM entry.
The existing event OnBeforeGetBinContent fires inside the GetBinContent local procedure itself and only controls whether FromBinContent.GetBinContent is called; it cannot skip the outer if GetBinContent(...) then repeat...until block in FindSmallerUOMBin for a given UOM iteration, nor does it expose ItemUnitOfMeasure to identify which UOM entry is being processed. No event currently exists at the ItemUnitOfMeasure loop level in FindSmallerUOMBin.
Describe the request
Add an integration event OnFindSmallerUOMBinOnBeforeGetBinContent in FindSmallerUOMBin in Codeunit 7312 "Create Pick" inside the ItemUnitOfMeasure repeat loop, before the GetBinContent call that searches for bin content for the current smaller unit of measure.
if ItemUnitOfMeasure.Find('-') then
repeat
IsHandled := false;
OnFindSmallerUOMBinOnBeforeGetBinContent( // <---- New Event
LocationCode, ItemNo, VariantCode, ItemUnitOfMeasure, ToBinCode, IsCrossDock,
QtyPerUnitOfMeasure, TotalQtytoPick, TotalQtytoPickBase, TotalAvailQtyToPickBase,
TempWhseItemTrackingLine2, WhseItemTrackingSetup, IsHandled);
if not IsHandled then
if GetBinContent(
FromBinContent, ItemNo, VariantCode, ItemUnitOfMeasure.Code, LocationCode, ToBinCode, IsCrossDock,
IsMovementWorksheet, WhseItemTrkgExists, false, true, WhseItemTrackingSetup, TotalQtytoPick, TotalQtytoPickBase)
then
repeat
...
until (FromBinContent.Next() = 0) or (TotalQtytoPickBase = 0);
until (ItemUnitOfMeasure.Next() = 0) or (TotalQtytoPickBase = 0);
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnFindSmallerUOMBinOnBeforeGetBinContent(LocationCode: Code[10]; ItemNo: Code[20]; VariantCode: Code[10]; var ItemUnitOfMeasure: Record "Item Unit of Measure"; ToBinCode: Code[20]; IsCrossDock: Boolean; QtyPerUnitOfMeasure: Decimal; var TotalQtytoPick: Decimal; var TotalQtytoPickBase: Decimal; var TotalAvailQtyToPickBase: Decimal; var TempWhseItemTrackingLine2: Record "Whse. Item Tracking Line" temporary; WhseItemTrackingSetup: Record "Item Tracking Setup"; var IsHandled: Boolean)
begin
end;
Alternatives evaluated: OnBeforeGetBinContent fires inside the GetBinContent local procedure and provides IsHandled only to replace the FromBinContent.GetBinContent call, but it does not expose ItemUnitOfMeasure and cannot skip the if GetBinContent(...) then repeat...until block in FindSmallerUOMBin for a specific UOM iteration. No event currently exists inside the ItemUnitOfMeasure loop in FindSmallerUOMBin before the bin content search.
Internal work item: AB#636047
Why do you need this change?
We need to intercept the smaller-UOM bin content search in FindSmallerUOMBin in Codeunit 7312 "Create Pick" at the point inside the ItemUnitOfMeasure repeat loop where each smaller unit of measure is about to be used to call GetBinContent. The goal is to replace the standard bin content search and the inner activity line creation loop entirely for a given ItemUnitOfMeasure entry.
The standard code, for each ItemUnitOfMeasure record, calls GetBinContent using ItemUnitOfMeasure.Code as the unit of measure filter, then iterates the returned FromBinContent records to calculate available quantities and create Take and Place activity lines. There is no hook before this search that allows a subscriber to supply an alternate bin content source or to skip the standard inner loop for a specific UOM entry.
The existing event OnBeforeGetBinContent fires inside the GetBinContent local procedure itself and only controls whether FromBinContent.GetBinContent is called; it cannot skip the outer if GetBinContent(...) then repeat...until block in FindSmallerUOMBin for a given UOM iteration, nor does it expose ItemUnitOfMeasure to identify which UOM entry is being processed. No event currently exists at the ItemUnitOfMeasure loop level in FindSmallerUOMBin.
Describe the request
Add an integration event OnFindSmallerUOMBinOnBeforeGetBinContent in FindSmallerUOMBin in Codeunit 7312 "Create Pick" inside the ItemUnitOfMeasure repeat loop, before the GetBinContent call that searches for bin content for the current smaller unit of measure.
Event Signature:
Alternatives evaluated: OnBeforeGetBinContent fires inside the GetBinContent local procedure and provides IsHandled only to replace the FromBinContent.GetBinContent call, but it does not expose ItemUnitOfMeasure and cannot skip the if GetBinContent(...) then repeat...until block in FindSmallerUOMBin for a specific UOM iteration. No event currently exists inside the ItemUnitOfMeasure loop in FindSmallerUOMBin before the bin content search.
Internal work item: AB#636047