To implement this hotfix, you must have a developer license.
You do not have to have rights to the data stores unless you have to perform data repair.
...
FromReservEntry.COPY(ToReservEntry);
FromReservEntry.SETRANGE("Source Subtype",0);
// Delete the following lines.
IF ToReservEntry.FINDSET(TRUE) THEN
REPEAT
FromReservEntry.SETRANGE("Lot No.",ToReservEntry."Lot No.");
FromReservEntry.SETRANGE("Serial No.",ToReservEntry."Serial No.");
IF FromReservEntry.FIND('-') THEN
REPEAT
QtyToHandleBase += FromReservEntry."Qty. to Handle (Base)";
QtyToInvoiceBase += FromReservEntry."Qty. to Invoice (Base)";
UNTIL FromReservEntry.NEXT = 0;
IF ABS(QtyToHandleBase) <> ABS(ToReservEntry."Qty. to Handle (Base)") THEN BEGIN
ToReservEntry."Qty. to Handle (Base)" := -QtyToHandleBase;
ToReservEntry."Qty. to Invoice (Base)" := -QtyToInvoiceBase;
ToReservEntry.MODIFY;
END;
UNTIL ToReservEntry.NEXT = 0;
// End of the deleted lines.
...
...
FromReservEntry.COPY(ToReservEntry);
FromReservEntry.SETRANGE("Source Subtype",0);
// Add the following lines.
IF ToReservEntry.FINDSET THEN
REPEAT
TempReservEntry := ToReservEntry;
TempReservEntry.INSERT;
UNTIL ToReservEntry.NEXT = 0;
TempReservEntry.SETCURRENTKEY(
"Item No.","Variant Code","Location Code","Item Tracking","Reservation Status","Lot No.","Serial No.");
IF TempReservEntry.FIND('-') THEN
REPEAT
FromReservEntry.SETRANGE("Lot No.",TempReservEntry."Lot No.");
FromReservEntry.SETRANGE("Serial No.",TempReservEntry."Serial No.");
QtyToHandleBase := 0;
QtyToInvoiceBase := 0;
IF FromReservEntry.FIND('-') THEN
REPEAT
QtyToHandleBase += FromReservEntry."Qty. to Handle (Base)";
QtyToInvoiceBase += FromReservEntry."Qty. to Invoice (Base)";
UNTIL FromReservEntry.NEXT = 0;
TempReservEntry.SETRANGE("Lot No.",TempReservEntry."Lot No.");
TempReservEntry.SETRANGE("Serial No.",TempReservEntry."Serial No.");
REPEAT
// remove already synchronized qty (can be more)
QtyToHandleBase += TempReservEntry."Qty. to Handle (Base)";
QtyToInvoiceBase += TempReservEntry."Qty. to Invoice (Base)";
TempReservEntry.DELETE;
UNTIL TempReservEntry.NEXT = 0;
TempReservEntry.SETRANGE("Lot No.");
TempReservEntry.SETRANGE("Serial No.");
IF QtyToHandleBase <> 0 THEN BEGIN
// remaining qty will be added to the last record
ToReservEntry := TempReservEntry;
ToReservEntry."Qty. to Handle (Base)" := -QtyToHandleBase;
ToReservEntry."Qty. to Invoice (Base)" := -QtyToInvoiceBase;
ToReservEntry.MODIFY;
END;
UNTIL TempReservEntry.NEXT = 0;
// End of the added lines.
...
Additionally, you must have hotfix 2495989 installed to apply this hotfix.