...
FromProdDocDim.SetFilters(DATABASE::"Prod. Order Line",FromProdOrderLine.Status,
FromProdOrderLine."Prod. Order No.",FromProdOrderLine."Line No.",0);
DimMgt.MoveProdDocDimToProdDocDim(
FromProdDocDim,DATABASE::"Prod. Order Line", // Delete this line.
ToProdOrderLine.Status,
ToProdOrderLine."Prod. Order No.");
LineNo := LineNo + 10000;
UNTIL FromProdOrderLine.NEXT = 0
...
...
FromProdDocDim.SetFilters(DATABASE::"Prod. Order Line",FromProdOrderLine.Status,
FromProdOrderLine."Prod. Order No.",FromProdOrderLine."Line No.",0);
// Add the following lines:
TempFromProdDocDim.RESET;
TempFromProdDocDim.DELETEALL;
IF FromProdDocDim.FINDSET THEN BEGIN
REPEAT
TempFromProdDocDim.INIT;
TempFromProdDocDim := FromProdDocDim;
TempFromProdDocDim."Document Line No." := LineNo;
TempFromProdDocDim.INSERT;
UNTIL FromProdDocDim.NEXT = 0;
END;
// The end of the new lines.
DimMgt.MoveProdDocDimToProdDocDim(
TempFromProdDocDim,DATABASE::"Prod. Order Line", // Add this line.
ToProdOrderLine.Status,
ToProdOrderLine."Prod. Order No.");
LineNo := LineNo + 10000;
UNTIL FromProdOrderLine.NEXT = 0
...