Skip to content

[Event Change Request] Codeunit 99000781 "Mfg. Calculate BOM Tree" - GenerateProdCompSubTree procedure - OnGenerateProdCompSubTreeOnBeforeRoutingLineLoop() event #30104

@MaricaPiazzalungaActionNet

Description

Why do you need this change?

Dear support, for a customer we need to change at runtime some fields' values of the read Routing Line record in GenerateProdCompSubTree procedure, before the bom buffer is populated and routing line costs are calculated. For this purpose, we need the access to Item Filter record in order to recover some information stored in Item Filter.
Unfortunately the existing event OnGenerateProdCompSubTreeOnBeforeRoutingLineLoop(RoutingLine, BOMBuffer, RunIteration) does not have ItemFilter as parameter and we ask you to add it.

Describe the request

Modify the Integration Event OnGenerateProdCompSubTreeOnBeforeRoutingLineLoop() adding the parameter ItemFilter, so that extensions can reach the fields of Item Filter record before the population of BOM Buffer and the calculation of routing line costs.

Location in GenerateProdCompSubTree() procedure, event OnGenerateProdCompSubTreeOnBeforeRoutingLineLoop(RoutingLine, BOMBuffer, RunIteration) (at line 181):

    if RoutingLine.ReadPermission then
        if (TreeType in ["BOM Tree Type"::" ", "BOM Tree Type"::Cost]) and
               RoutingLine.CertifiedRoutingVersionExists(ParentItem."Routing No.", WorkDate())
        then begin
            repeat
                RunIteration := RoutingLine."No." <> '';
                -->OnGenerateProdCompSubTreeOnBeforeRoutingLineLoop(RoutingLine, BOMBuffer, RunIteration);

                if RunIteration then begin
                    BOMBuffer.SetLocationVariantFiltersFrom(ItemFilter);
                    BOMBuffer.TransferFromProdRouting(
                      EntryNo, RoutingLine, ParentBOMBuffer.Indentation + 1,
                      ParentBOMBuffer."Qty. per Top Item" *
                      UOMMgt.GetQtyPerUnitOfMeasure(ParentItem, ParentBOMBuffer."Unit of Measure Code"),
                      ParentBOMBuffer."Needed by Date",
                      ParentBOMBuffer."Location Code");
                    OnAfterTransferFromProdRouting(BOMBuffer, RoutingLine);

                    if TreeType = "BOM Tree Type"::Cost then begin
                        LotSize := ParentBOMBuffer."Lot Size";
                        if LotSize = 0 then
                            if ParentBOMBuffer."Qty. per Top Item" <> 0 then
                                LotSize := ParentBOMBuffer."Qty. per Top Item"
                            else
                                LotSize := 1;
                        CalcRoutingLineCosts(RoutingLine, LotSize, ParentBOMBuffer."Scrap %", BOMBuffer, ParentItem, sender);

Current Event Publisher:

    [IntegrationEvent(false, false)]
    local procedure OnGenerateProdCompSubTreeOnBeforeRoutingLineLoop(var RoutingLine: Record Microsoft.Manufacturing.Routing."Routing Line"; var BOMBuffer: Record "BOM Buffer"; var RunIteration: Boolean)
    begin
    end;

Change request Event Publisher (added ItemFilter parameter):

    [IntegrationEvent(false, false)]
    local procedure OnGenerateProdCompSubTreeOnBeforeRoutingLineLoop(var RoutingLine: Record Microsoft.Manufacturing.Routing."Routing Line"; var BOMBuffer: Record "BOM Buffer"; var RunIteration: Boolean; ItemFilter: Record Item)
    begin
    end;

Internal work item: AB#636085

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions