Skip to content

[Event Request] table 7326 "Whse. Worksheet Line" procedure CalcAvailableQtyBase() #30339

Description

@kmistrytnp

Why do you need this change?

I need to be able to adjust the qty that is calculated as being available (we have some stock ring fencing customisations). I.e. I want to be able to perform the usual availability calculation and the reduce by the qty that has been ring fenced.

There is an OnBeforeCalcAvailableQtyBase() event with an IsHandled property, and I have considered using that by replicating the Microsoft availability calculation code and then adding my own - not ideal but I did consider using this. However, I'm actually unable to use this because I would need to replicate the Microsoft code below...

        GetItem("Item No.");
        GetLocation("Location Code");

        if Location."Directed Put-away and Pick" then begin
            QtyAssgndOnWkshBase := WhseAvailMgt.CalcQtyAssgndOnWksh(Rec, not Location."Allow Breakbulk", true);

            // Adjust the available quantity to pick with the QtyAssgndOnWkshBase and AssignedQtyOnReservedLines from the other active worksheet lines.
            AvailableQty := CreatePick.CalcTotalAvailQtyToPickForDirectedPutAwayPick("Location Code", "Item No.", "Variant Code", DummyWhseItemTrackingLine, "Source Type", "Source Subtype", "Source No.", "Source Line No.", "Source Subline No.", "Qty. to Handle (Base)", QtyAssgndOnWkshBase, AssignedQtyOnReservedLines());

        end else begin
            QtyAssgndOnWkshBase := WhseAvailMgt.CalcQtyAssgndOnWksh(Rec, true, true);

            AvailQtyBase := WhseAvailMgt.CalcQtyAvailToTakeOnWhseWorksheetLine(Rec);

            AvailableQty := AvailQtyBase - QtyAssgndOnWkshBase + AssignedQtyOnReservedLines();
        end;

The main problem is that I can't call the following line as the procedure has been marked Internal...

AvailableQty := CreatePick.CalcTotalAvailQtyToPickForDirectedPutAwayPick("Location Code", "Item No.", "Variant Code",

A much better option would be to have an OnAfterCalcAvailableQtyBase() event at the end where I could adjust the calculated available qty.

Describe the request

A new OnAfterCalcAvailableQtyBase() event called at the end of the CalcAvailableQtyBase() procedure

The event would have the following signature

    [IntegrationEvent(false, false)]
    local procedure OnAfterCalcAvailableQtyBase(var WhseWorksheetLine: Record "Whse. Worksheet Line"; var AvailableQty: Decimal)
    begin
    end;

Internal work item: AB#641774

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions