Why do you need this change?
We need an event before evaluating "Safety Lead Time", in order to be able to give it a value, according to custom logics.
The actual event OnAtSKUOnBeforeSetSafetyLeadTime is not suffient because the aim is to assign a value to the field "Safety Lead Time". So if I exploit the event OnAtSKUOnBeforeSetSafetyLeadTime, the value I assign to the field can be overwritten by the standard procedure. That's why I need to manage the IsHandled variable.
Describe the request
In procedure AtSKU of codeunit 99000855 "Planning-Get Parameters" we need an event:
[IntegrationEvent(false, false)]
local procedure OnAtSKUOnBeforeSetSafetyLeadTime2(var Ishandled: Boolean; var GlobalSKU: Record "Stockkeeping Unit"; ManualScheduling: Boolean)
begin
end;
Changes between **:
procedure AtSKU(var SKU: Record "Stockkeeping Unit"; ItemNo: Code[20]; VariantCode: Code[10]; LocationCode: Code[10])
var
**IsHandled: Boolean;**
begin
GetInventorySetUp();
if (ItemNo <> GlobalSKU."Item No.") or
(VariantCode <> GlobalSKU."Variant Code") or
(LocationCode <> GlobalSKU."Location Code")
then begin
Clear(GlobalSKU);
GlobalSKU.SetRange("Item No.", ItemNo);
GlobalSKU.SetRange("Variant Code", VariantCode);
GlobalSKU.SetRange("Location Code", LocationCode);
if not GlobalSKU.FindFirst() then begin
GetItem(ItemNo);
GlobalSKU."Item No." := ItemNo;
GlobalSKU."Variant Code" := VariantCode;
GlobalSKU."Location Code" := LocationCode;
GlobalSKU.CopyFromItem(Item);
OnAtSKUOnAfterCopyFromItem(GlobalSKU, Item, ItemNo, VariantCode, LocationCode);
if LotForLot then begin
GlobalSKU."Reorder Point" := 0;
GlobalSKU."Maximum Inventory" := 0;
GlobalSKU."Reorder Quantity" := 0;
case Item."Reordering Policy" of
GlobalSKU."Reordering Policy"::" ":
GlobalSKU."Reordering Policy" := GlobalSKU."Reordering Policy"::" ";
GlobalSKU."Reordering Policy"::Order:
GlobalSKU."Reordering Policy" := GlobalSKU."Reordering Policy"::Order;
GlobalSKU."Reordering Policy"::"Lot-for-Lot":
GlobalSKU."Reordering Policy" := GlobalSKU."Reordering Policy"::"Lot-for-Lot";
else begin
GlobalSKU."Reordering Policy" := GlobalSKU."Reordering Policy"::"Lot-for-Lot";
GlobalSKU."Plan Minimal Supply" := true;
end;
end;
if GlobalSKU."Reordering Policy" = GlobalSKU."Reordering Policy"::"Lot-for-Lot" then
GlobalSKU."Include Inventory" := true
else
GlobalSKU."Include Inventory" := Item."Include Inventory";
GlobalSKU."Maximum Order Quantity" := 0;
GlobalSKU."Safety Stock Quantity" := 0;
GlobalSKU."Order Multiple" := 0;
GlobalSKU."Overflow Level" := 0;
end;
end;
SetComponentsAtLocation(LocationCode);
end;
OnAtSKUOnBeforeSetSafetyLeadTime(GlobalSKU, ManualScheduling);
**IsHandled := false;
OnAtSKUOnBeforeSetSafetyLeadTime2(GlobalSKU, ManualScheduling);
if not IsHandled then**
if not ManualScheduling then
if Format(GlobalSKU."Safety Lead Time") = '' then
if Format(InventorySetup."Default Safety Lead Time") <> '' then
GlobalSKU."Safety Lead Time" := InventorySetup."Default Safety Lead Time"
else
Evaluate(GlobalSKU."Safety Lead Time", '<0D>');
AdjustInvalidSettings(GlobalSKU);
SKU := GlobalSKU;
OnAfterAtSKU(SKU, GlobalSKU);
end;
Why do you need this change?
We need an event before evaluating "Safety Lead Time", in order to be able to give it a value, according to custom logics.
The actual event OnAtSKUOnBeforeSetSafetyLeadTime is not suffient because the aim is to assign a value to the field "Safety Lead Time". So if I exploit the event OnAtSKUOnBeforeSetSafetyLeadTime, the value I assign to the field can be overwritten by the standard procedure. That's why I need to manage the IsHandled variable.
Describe the request
In procedure AtSKU of codeunit 99000855 "Planning-Get Parameters" we need an event:
Changes between **: