ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 99000809 - Function TransferBOM

Open IngoStender opened this issue 7 years ago • 1 comments

In codeunit 99000809 Planning Line Management, function TransferBOM, please add the following event

ProdBOMLine[Level].SETFILTER("Starting Date",'%1|..%2',0D,ReqLine."Starting Date");
ProdBOMLine[Level].SETFILTER("Ending Date",'%1|%2..',0D,ReqLine."Starting Date");
OnTransferBOMOnAfterProdBOMLineSetFilters(ProdBOMLine[Level],ReqLine);
IF ProdBOMLine[Level].FIND('-') THEN
  REPEAT

    // >> NEW
    IsHandled := FALSE;
    OnBeforeTransferPlanningComponent(RqLine,ProdBOMLine[Level],Blocked,IsHandled);
    IF NOT IsHandled THEN BEGIN
    // << New

      IF ProdBOMLine[Level]."Routing Link Code" <> '' THEN BEGIN
        PlanningRtngLine2.SETRANGE("Worksheet Template Name",ReqLine."Worksheet Template Name");
        PlanningRtngLine2.SETRANGE("Worksheet Batch Name",ReqLine."Journal Batch Name");
        PlanningRtngLine2.SETRANGE("Worksheet Line No.",ReqLine."Line No.");
        PlanningRtngLine2.SETRANGE("Routing Link Code",ProdBOMLine[Level]."Routing Link Code");
        PlanningRtngLine2.FINDFIRST;


      [...]


              TempPlanningComponent.MODIFY;
          END;
        ProdBOMLine[Level].Type::"Production BOM":
          BEGIN
            TransferBOM(ProdBOMLine[Level]."No.",Level + 1,ReqQty,1);
            ProdBOMLine[Level].SETRANGE("Production BOM No.",ProdBOMNo);
            ProdBOMLine[Level].SETRANGE(
              "Version Code",VersionMgt.GetBOMVersion(ProdBOMNo,ReqLine."Starting Date",TRUE));
            ProdBOMLine[Level].SETFILTER("Starting Date",'%1|..%2',0D,ReqLine."Starting Date");
            ProdBOMLine[Level].SETFILTER("Ending Date",'%1|%2..',0D,ReqLine."Starting Date");
          END;
      END;

    // >> NEW
    END;
    // << NEW

  UNTIL ProdBOMLine[Level].NEXT = 0;

LOCAL [IntegrationEvent] OnBeforeTransferPlanningComponent(ReqLine : Record "Requisition Line";VAR ProdBOMLine : Record "Production BOM Line";Blocked : Boolean;VAR IsHandled : Boolean)

The same event already exists in the similar function TransferBOM in codeunit 99000773 Calculate Prod. Order. It would be helpful if publisher that are create in functions which exists in both codeunits are always provided in both codeunits. Production order components and routing line which are created from planning components and planning routing lines are only transferred, not recalculated.

IngoStender avatar Mar 27 '19 13:03 IngoStender

Note: implemented as OnTransferBOMOnBeforeTransferPlanningComponent LOCAL [IntegrationEvent] OnTransferBOMOnBeforeTransferPlanningComponent(VAR RequisitionLine : Record "Requisition Line";VAR ProductionBOMLine : Record "Production BOM Line";Blocked : Boolean;VAR IsHandled : Boolean)

NKarolak avatar Jul 31 '19 13:07 NKarolak