Control over Document Line Number in Undo*Line Codeunits
In order to adapt the Document Line No. assigned to the newly generated Posted Lines in the "Undo Purchase Receipt Line" / "Undo Sales Shipment Line" / "Undo Return Receipt Line" & "Undo Return Shipment Line" codeunits I would like to request some code adjustments.
The code in the PostItemJnlLine procedure of the "Undo Purchase Receipt Line" is closest to what we need. But it needs one small improvement. Let me explain that first. The PostItemJnlLine procedure starts with this code:
IsHandled := false;
OnBeforePostItemJnlLine(PurchRcptLine, DocLineNo, ItemLedgEntryNo, IsHandled, NewDocLineNo);
if NewDocLineNo > DocLineNo then
DocLineNo := NewDocLineNo;
if IsHandled then
exit(ItemLedgEntryNo);
with PurchRcptLine do begin
DocLineNo := GetCorrectionLineNo(PurchRcptLine);
The OnBeforePostItemJnlLine publisher has a var NewDocLineNo parameter, so we can calculate a new Document Line No. for the newly inserted Purchase Receipt Line. As long as the newly calculated NewDocLineNo is bigger then the previous DocLineNo then DocLineNo will be overwritten by NewDocLineNo and DocLineNo is assigned later to the newly inserted Purchase Receipt Line (so far no issues). But unfortunately, that same DocLineNo that we could influence with the NewDocLineNo is overwritten by the last statement above. (the GetCorrectionLineNo procedure). If you could make a small change there:
with PurchRcptLine do begin
if NewDocLineNo = 0 then //proposed improvement
DocLineNo := GetCorrectionLineNo(PurchRcptLine);
then we have the ability to influence the Document Line No. of the newly inserted Return Receipt Line (for items).
The other Undo codeunits should have a similar code structure as implemented in the "Undo Purchase Receipt Line" codeunit. They all lack the NewDocLineNo variable, which is a great step in the right direction.
Can I get an update on this request? It's 2 months ago that I made this request and I have not heard anything back since...
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.