ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Table 99000772 - "Production BOM Line" - OnBeforeGetBOMHeaderQtyPerUOM

Open UIBKH opened this issue 3 years ago • 1 comments

Dear Support,

We would like to add a new event OnBeforeGetBOMHeaderQtyPerUOM in the following Procedure below, using the IsHandled pattern. This would allow us to further customize the code and migrate existing customizations.

procedure GetBOMHeaderQtyPerUOM(Item: Record Item): Decimal
var
    ProdBOMHeader: Record "Production BOM Header";
    ProdBOMVersion: Record "Production BOM Version";
    ItemUnitOfMeasure: Record "Item Unit of Measure";
    UOMMgt: Codeunit "Unit of Measure Management";
    IsHandled: Boolean;  //New  Code --++
begin
    //New  Code --
    IsHandled := false;
    OnBeforeGetBOMHeaderQtyPerUOM(Rec, Item, IsHandled);
    if IsHandled then
    exit;
    //New  Code ++
    if "Production BOM No." = '' then
        exit(1);

    if "Version Code" <> '' then begin
        ProdBOMVersion.Get("Production BOM No.", "Version Code");
        if not ItemUnitOfMeasure.Get(Item."No.", ProdBOMVersion."Unit of Measure Code") then
            Error(BOMVersionUOMErr, ProdBOMVersion."Unit of Measure Code", Item."No.", "Production BOM No.", "Version Code");
        exit(UOMMgt.GetQtyPerUnitOfMeasure(Item, ProdBOMVersion."Unit of Measure Code"));
    end;

    ProdBOMHeader.Get("Production BOM No.");
    if not ItemUnitOfMeasure.Get(Item."No.", ProdBOMHeader."Unit of Measure Code") then
        Error(BOMHeaderUOMErr, ProdBOMHeader."Unit of Measure Code", Item."No.", "Production BOM No.");
    exit(UOMMgt.GetQtyPerUnitOfMeasure(Item, ProdBOMHeader."Unit of Measure Code"));
end;

Event signature:

[IntegrationEvent(false, false)]
local procedure OnBeforeGetBOMHeaderQtyPerUOM(var ProductionBOMLine: Record "Production BOM Line"; Item: Record Item; var IsHandled: Boolean)
begin
end;

UIBKH avatar Feb 03 '23 08:02 UIBKH

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 53020.

JesperSchulz avatar Feb 09 '23 06:02 JesperSchulz