Why do you need this change?
The standard code in SumQty of Report 5801 "Invt. Valuation - Cost Spec." evaluates ItemLedgEntry.Quantity * AppliedQty < 0 unconditionally as part of the exit condition. Items with alternate units of measure require ItemLedgEntry.GetCostingQty() instead of ItemLedgEntry.Quantity to correctly reflect the costing quantity. The entire condition block including ItemLedgEntry."Posting Date" > ValuationDate must be re-evaluated against the costing quantity rather than the base quantity.
There is no way to override the exit condition after the fact as the exit has already been skipped or executed. No event currently exists before the condition check in SumQty of Report 5801 that allows subscribers to take full control of the exit logic.
Describe the request
Add an integration event OnBeforeCheckSumQty in SumQty of Report 5801 "Invt. Valuation - Cost Spec." before the if(ItemLedgEntry.Quantity * AppliedQty < 0)condition check, with IsHandled support to allow subscribers to override the entire exit condition and skip standard execution.
local procedure SumQty(var RemainingQty: Decimal; var PosQty: Decimal; EntryNo: Integer; AppliedQty: Decimal)
var
ItemLedgEntry: Record "Item Ledger Entry";
IsHandled: Boolean;
begin
ItemLedgEntry.Get(EntryNo);
IsHandled := false;
OnBeforeCheckSumQty(ItemLedgEntry, AppliedQty, ValuationDate, IsHandled);
if IsHandled then
exit;
if (ItemLedgEntry.Quantity * AppliedQty < 0) or
(ItemLedgEntry."Posting Date" > ValuationDate)
then
exit;
RemainingQty := RemainingQty + AppliedQty;
if IsPositive then
PosQty := PosQty + AppliedQty;
end;
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckSumQty(
ItemLedgEntry: Record "Item Ledger Entry";
AppliedQty: Decimal;
ValuationDate: Date;
var IsHandled: Boolean)
begin
end;
Alternatives evaluated:
A targeted OnAfterGetItemLedgEntryQty event replacing only the quantity source preserves the PostingDate check but does not allow full override of the exit condition. OnBeforeCheckSumQty with IsHandled is required when the subscriber needs to re-evaluate the entire condition including PostingDate against a custom quantity source.
Why do you need this change?
The standard code in
SumQtyof Report 5801 "Invt. Valuation - Cost Spec." evaluatesItemLedgEntry.Quantity * AppliedQty < 0unconditionally as part of the exit condition. Items with alternate units of measure requireItemLedgEntry.GetCostingQty()instead ofItemLedgEntry.Quantityto correctly reflect the costing quantity. The entire condition block includingItemLedgEntry."Posting Date" > ValuationDatemust be re-evaluated against the costing quantity rather than the base quantity.There is no way to override the exit condition after the fact as the exit has already been skipped or executed. No event currently exists before the condition check in
SumQtyof Report 5801 that allows subscribers to take full control of the exit logic.Describe the request
Add an integration event
OnBeforeCheckSumQtyinSumQtyof Report 5801 "Invt. Valuation - Cost Spec." before the if(ItemLedgEntry.Quantity * AppliedQty < 0)condition check, withIsHandledsupport to allow subscribers to override the entire exit condition and skip standard execution.Event Signature:
Alternatives evaluated:
A targeted
OnAfterGetItemLedgEntryQtyevent replacing only the quantity source preserves thePostingDatecheck but does not allow full override of the exit condition.OnBeforeCheckSumQtywith IsHandled is required when the subscriber needs to re-evaluate the entire condition includingPostingDateagainst a custom quantity source.