[Event Request] codeunit 7321 "Create Inventory Put-away" - OnAfterRepeat
Hi, would it be possible to get many events OnAfterRepeat in codeunit 7321 "Create Inventory Put-away", like this :
local procedure CreatePutAwayLinesFromTransfer(TransferHeader: Record "Transfer Header")
var
TransferLine: Record "Transfer Line";
NewWhseActivLine: Record "Warehouse Activity Line";
WhseItemTrackingSetup: Record "Item Tracking Setup";
ItemTrackingMgt: Codeunit "Item Tracking Management";
IsHandled: Boolean;
NewWhseActivLine."Source Document" := NewWhseActivLine."Source Document"::"Purchase Return Order";
OnBeforeNewWhseActivLineInsertFromPurchase(NewWhseActivLine, PurchLine);
if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then
repeat
IsHandled: false;
OnAfterRepeat(IsHandled,ReservationFound);
if not IsHandled then begin
NewWhseActivLine."Line No." := NextLineNo;
InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup);
end;
until RemQtyToPutAway <= 0
NewWhseActivLine."Source Document" := NewWhseActivLine."Source Document"::"Sales Return Order";
OnBeforeNewWhseActivLineInsertFromSales(NewWhseActivLine, SalesLine);
if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then
repeat
OnAfterRepeat(ReservationFound,SNRequired);
NewWhseActivLine."Line No." := NextLineNo;
InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup);
until RemQtyToPutAway <= 0
NewWhseActivLine."Due Date" := "Receipt Date";
OnBeforeNewWhseActivLineInsertFromTransfer(NewWhseActivLine, TransferLine);
if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then
repeat
IsHandled: false;
OnAfterRepeat(IsHandled,ReservationFound);
if not IsHandled then begin
NewWhseActivLine."Line No." := NextLineNo;
InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup);
end;
until RemQtyToPutAway <= 0
```
NewWhseActivLine."Due Date" := "Due Date"; NewWhseActivLine."Source Document" := NewWhseActivLine."Source Document"::"Prod. Output"; OnBeforeNewWhseActivLineInsertFromProd(NewWhseActivLine, ProdOrderLine); if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then repeat IsHandled: false; OnAfterRepeat(IsHandled,ReservationFound); if not IsHandled then begin NewWhseActivLine."Line No." := NextLineNo; InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup); end; until RemQtyToPutAway <= 0
[IntegrationEvent(false, false)]
local procedure OnAfterRepeat(var ReservationFound: Boolean; var IsHandled: Boolean)
begin
end;
Thanks!
Could you give more details explaining how will you handle these events and change the code execution? Are you going to change ReservationFound to skip the loops going below? How SNRequired will work? Also in the third case you put: OnAfterRepeat(IsHandled,ReservationFound,SNRequired); but IsHandled is not declared in the event and not used in code. Wouldn't is be better to have an event on before InsertWhseActivLine? maybe with additional params?
I need to change the code in the loops. I don't need to add SNRequired and Reservation Found. Yes I need IsHandled I just forgot it. Excuse me for my mistake. Thanks
Please update the original request. There are still two calls of OnAfterRepeat with different parameters and there is no usage of IsHandled.
I edited my code
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. We will update this issue with information about availability. 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.