...
PurchaseLineArchive.DELETEALL;
// Delete the following line.
DocDimensionArchive.SETRANGE("Table ID",DATABASE::"Purchase Header");
DocDimensionArchive.SETRANGE("Document Type","Document Type");
DocDimensionArchive.SETRANGE("Document No.","No.");
DocDimensionArchive.SETRANGE("Doc. No. Occurrence","Doc. No. Occurrence");
DocDimensionArchive.SETRANGE("Version No.","Version No.");
DocDimensionArchive.DELETEALL;
// Delete the following line.
DocDimensionArchive.SETRANGE("Table ID",DATABASE::"Purchase Line");
DocDimensionArchive.DELETEALL;
...
...
PurchaseLineArchive.DELETEALL;
// Add the followingl line.
DocDimensionArchive.SETRANGE("Table ID",DATABASE::"Purchase Header Archive");
DocDimensionArchive.SETRANGE("Document Type","Document Type");
DocDimensionArchive.SETRANGE("Document No.","No.");
DocDimensionArchive.SETRANGE("Doc. No. Occurrence","Doc. No. Occurrence");
DocDimensionArchive.SETRANGE("Version No.","Version No.");
DocDimensionArchive.DELETEALL;
// Add the following line.
DocDimensionArchive.SETRANGE("Table ID",DATABASE::"Purchase Line Archive");
DocDimensionArchive.DELETEALL;