Why do you need this change?
Dear support, for a customer we need to change a runtime the Lot Size field value of the ParentBOMBuffer record in TraverseCostTree procedure of the BOM Tree calculation. For this purpose, we need a new event at the start of the BOM Buffer iteration.
For the same reason we need another event, in the same procedure, almost at the end of the procedure, where it is called the last "UpdateNodeCosts", outside the BOM Buffer iteration .
Describe the request
- Add a new integration event OnTraverseCostTreeOnBeforeAddCosts in Codeunit 5870 "Calculate BOM Tree", so extensions can react before the costs are calculated and added.
- Add a new integration event OnTraverseCostTreeOnBeforeLastUpdateNodeCosts in Codeunit 5870 "Calculate BOM Tree", so extensions can react before the node costs are updated at the end.
Location in TraverseCostTree(var BOMBuffer: Record "BOM Buffer"): Decimal procedure (at line 481):
local procedure TraverseCostTree(var BOMBuffer: Record "BOM Buffer"): Decimal
var
ParentBOMBuffer: Record "BOM Buffer";
begin
ParentBOMBuffer := BOMBuffer;
while (BOMBuffer.Next() <> 0) and (ParentBOMBuffer.Indentation < BOMBuffer.Indentation) do
if (ParentBOMBuffer.Indentation + 1 = BOMBuffer.Indentation) and
((BOMBuffer."Qty. per Top Item" <> 0) or (BOMBuffer.Type in [BOMBuffer.Type::"Machine Center", BOMBuffer.Type::"Work Center"]))
then begin
-->OnTraverseCostTreeOnBeforeAddCosts(BOMBuffer, ParentBOMBuffer);
if not BOMBuffer."Is Leaf" then
TraverseCostTree(BOMBuffer)
else
if (BOMBuffer.Type = BOMBuffer.Type::Resource) and (BOMBuffer."Resource Usage Type" = BOMBuffer."Resource Usage Type"::Fixed) then
UpdateNodeCosts(BOMBuffer, ParentBOMBuffer."Lot Size" / ParentBOMBuffer."Qty. per Top Item")
else
UpdateNodeCosts(BOMBuffer, 1);
if BOMBuffer."Is Leaf" then begin
ParentBOMBuffer.AddMaterialCost(BOMBuffer."Single-Level Material Cost", BOMBuffer."Rolled-up Material Cost");
ParentBOMBuffer.AddNonInvMaterialCost(BOMBuffer."Single-Lvl Mat. Non-Invt. Cost", BOMBuffer."Rolled-up Mat. Non-Invt. Cost");
ParentBOMBuffer.AddCapacityCost(BOMBuffer."Single-Level Capacity Cost", BOMBuffer."Rolled-up Capacity Cost");
ParentBOMBuffer.AddSubcontrdCost(BOMBuffer."Single-Level Subcontrd. Cost", BOMBuffer."Rolled-up Subcontracted Cost");
ParentBOMBuffer.AddCapOvhdCost(BOMBuffer."Single-Level Cap. Ovhd Cost", BOMBuffer."Rolled-up Capacity Ovhd. Cost");
ParentBOMBuffer.AddMfgOvhdCost(BOMBuffer."Single-Level Mfg. Ovhd Cost", BOMBuffer."Rolled-up Mfg. Ovhd Cost");
ParentBOMBuffer.AddScrapCost(BOMBuffer."Single-Level Scrap Cost", BOMBuffer."Rolled-up Scrap Cost");
end else begin
ParentBOMBuffer.AddMaterialCost(
BOMBuffer."Single-Level Material Cost" +
BOMBuffer."Single-Lvl Mat. Non-Invt. Cost" +
BOMBuffer."Single-Level Capacity Cost" +
BOMBuffer."Single-Level Subcontrd. Cost" +
BOMBuffer."Single-Level Cap. Ovhd Cost" +
BOMBuffer."Single-Level Mfg. Ovhd Cost",
BOMBuffer."Rolled-up Material Cost");
ParentBOMBuffer.AddNonInvMaterialCost(0, BOMBuffer."Rolled-up Mat. Non-Invt. Cost");
ParentBOMBuffer.AddCapacityCost(0, BOMBuffer."Rolled-up Capacity Cost");
ParentBOMBuffer.AddSubcontrdCost(0, BOMBuffer."Rolled-up Subcontracted Cost");
ParentBOMBuffer.AddCapOvhdCost(0, BOMBuffer."Rolled-up Capacity Ovhd. Cost");
ParentBOMBuffer.AddMfgOvhdCost(0, BOMBuffer."Rolled-up Mfg. Ovhd Cost");
ParentBOMBuffer.AddScrapCost(0, BOMBuffer."Rolled-up Scrap Cost");
end;
OnTraverseCostTreeOnAfterAddCosts(ParentBOMBuffer, BOMBuffer);
end;
BOMBuffer := ParentBOMBuffer;
-->OnTraverseCostTreeOnBeforeLastUpdateNodeCosts(BOMBuffer, ParentBOMBuffer);
UpdateNodeCosts(BOMBuffer, ParentBOMBuffer."Lot Size");
exit(BOMBuffer."Able to Make Top Item");
end;
1) Event Publisher
[IntegrationEvent(false, false)]
local procedure OnTraverseCostTreeOnBeforeAddCosts(var BOMBuffer: Record "BOM Buffer"; var ParentBOMBuffer: Record "BOM Buffer")
begin
end;
2) Event Publisher
[IntegrationEvent(false, false)]
local procedure OnTraverseCostTreeOnBeforeLastUpdateNodeCosts(var BOMBuffer: Record "BOM Buffer"; var ParentBOMBuffer: Record "BOM Buffer")
begin
end;
Internal work item: AB#636086
Why do you need this change?
Dear support, for a customer we need to change a runtime the Lot Size field value of the ParentBOMBuffer record in TraverseCostTree procedure of the BOM Tree calculation. For this purpose, we need a new event at the start of the BOM Buffer iteration.
For the same reason we need another event, in the same procedure, almost at the end of the procedure, where it is called the last "UpdateNodeCosts", outside the BOM Buffer iteration .
Describe the request
Location in TraverseCostTree(var BOMBuffer: Record "BOM Buffer"): Decimal procedure (at line 481):
1) Event Publisher
2) Event Publisher
Internal work item: AB#636086