ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[EventRequest] Codeunit 22 - ApplyItemLedgEntry

Open AndyF2k25 opened this issue 5 years ago • 3 comments

Hello,

we have a logic where we would like to apply an item ledger entry independent the following condition in function ApplyItemLedgEntry(...). Right now you can only add conditions to skip applying, but cannot add conditions to do the applying.

if (ItemLedgEntry."Remaining Quantity" = 0) or
           (ItemLedgEntry."Drop Shipment" and (ItemLedgEntry."Applies-to Entry" = 0)) or
           ((Item."Costing Method" = Item."Costing Method"::Specific) and ItemLedgEntry.Positive) or
           (ItemJnlLine."Direct Transfer" and (ItemLedgEntry."Location Code" = '') and ItemLedgEntry.Positive)
then
  exit;

Is it possible to get a handled-pattern here, so that we can decide wether we want to do the default check or not? The existing publisher "OnBeforeApplyItemLedgEntry(...)" does not help here, because we cant skip the check.

AndyF2k25 avatar Jun 08 '21 07:06 AndyF2k25

Hi Andreas,

Please provide the your vision of this event signature with needed set of parameters.

Rgds, Oleg.

Oleg-Romashkov avatar Jun 10 '21 04:06 Oleg-Romashkov

Something like OnBeforeCheckApplyItemLedgEntry(var Handled: Boolean; var ItemLedgEntry: Record "Item Ledger Entry")

OnBeforeCheckApplyItemLedgEntry(Handled, ItemLedgerEntry, ItemJnlLine, CausedByTransfer);
if not Handled then
   if (ItemLedgEntry."Remaining Quantity" = 0) or
           (ItemLedgEntry."Drop Shipment" and (ItemLedgEntry."Applies-to Entry" = 0)) or
           ((Item."Costing Method" = Item."Costing Method"::Specific) and ItemLedgEntry.Positive) or
           (ItemJnlLine."Direct Transfer" and (ItemLedgEntry."Location Code" = '') and ItemLedgEntry.Positive)
        then
            exit;

AndyF2k25 avatar Jun 10 '21 08:06 AndyF2k25

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.

JesperSchulz avatar Jun 24 '21 06:06 JesperSchulz