Transaction No. error when UnApplying

When unapplying a customer or a vendor ledger entry you sometimes get the error “The latest Transaction No. must be an application in Vendor Ledger Entry No. ######”.  I have found that this can be triggered if “Adjust Exchage Rates” batch has been executed after the prior application posting.

This can be avoided by changing the function FindLastTransactioNo in Codeunit 227.

[code]FindLastTransactionNo(VendLedgEntryNo : Integer) : Integer
"Vendor Ledger Entry No.","Entry Type");
"Vendor Ledger Entry No.",VendLedgEntryNo);
LastTransactionNo := 0;
IF DtldVendLedgEntry.FIND(‘-‘) THEN
//# Changes Start
IF SourceCodeSetup."Exchange Rate Adjmt." = ” THEN
IF DtldVendLedgEntry."Source Code" <>
SourceCodeSetup."Exchange Rate Adjmt."
//# Changes End
IF (DtldVendLedgEntry."Transaction No." > LastTransactionNo) AND
NOT DtldVendLedgEntry.Unapplied
LastTransactionNo := DtldVendLedgEntry."Transaction No.";
UNTIL DtldVendLedgEntry.NEXT = 0;

Data Upgrade Method and Code

I am in the process of upgrading a 5.0 SP1 database to 2009 R2.  That includes updated addon solutions from Skýrr.  To help me with this process I created a table, form and a codeunit to handle the upgrade and provide the user a visual process information.

This code will store information on processed tables in the log table and make sure that if you execute the upgrade process only the remaining processes will be executed.  You can simply add another processing codeunit and execute the process again and again.