Share via


Upgrading the Application Code

Typically, customers want all the customizations that have been implemented in their existing databases to be migrated to their new Microsoft Dynamics NAV 2013 R2 databases. Microsoft Dynamics NAV 2013 R2 is a new version of Microsoft Dynamics NAV 2013 and the amount of code changes between the two versions is limited. If you upgrade from Microsoft Dynamics NAV 2009 R2 or Microsoft Dynamics NAV 2009 SP1, you can choose to implement the existing customizations directly in Microsoft Dynamics NAV 2013 R2. Alternatively, you can upgrade the application by using the same compare-and-merge process that you use if you upgrade from Microsoft Dynamics NAV 2013. This compare-and-merge process is known as a code upgrade. You perform the code upgrade before you perform the data upgrade.

If you upgrade from Microsoft Dynamics NAV 2009 R2 or Microsoft Dynamics NAV 2009 SP1, you must first upgrade the application code to Microsoft Dynamics NAV 2013 R2. Then, you upgrade the data to Microsoft Dynamics NAV 2013 R2. During the code upgrade, you include the steps for upgrading code to the Microsoft Dynamics NAV 2013 application, such as running the objects through the TextFormatUpgrade2013.exe tool. For more information about upgrading application code to Microsoft Dynamics NAV 2013, see Upgrading the Application Code.

Application Upgrade Overview

You must analyze and process code changes by comparing and evaluating three separate versions of the Microsoft Dynamics NAV database:

Version Description

Old Base Version

This is a standard version of the Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2009 R2, or Microsoft Dynamics NAV 2009 SP1 database.

Old Custom Version

This is the old base database plus the customer's changes and add-on solutions.

New Base Version

This is a standard version of the Microsoft Dynamics NAV 2013 R2 database.

After merging customizations into the New Base Version you will have a New Custom Version, which is the objective of the code upgrade. The product of the code upgrade is a .fob file that contains all Microsoft Dynamics NAV 2013 R2 objects (including customizations), which you will use during the data upgrade. Customers can continue to work with the Microsoft Dynamics NAV 2013 database (the old custom version) although you upgrade the code by using a copy of their database. However, we recommend that you avoid making any additional customizations to the old custom version while you work on the code upgrade.

Important

In Microsoft Dynamics NAV 2009, report objects could have either a classic layout or a client report definition (RDLC) layout, and they could have a classic request form. In Microsoft Dynamics NAV 2013, classic reports were removed, and in Microsoft Dynamics NAV 2013 R2 the RDLC format has changed. As a result, all report objects in Microsoft Dynamics NAV 2009 must be upgraded by using the Microsoft Dynamics NAV 2013 development environment before they can be used in a merge with Microsoft Dynamics NAV 2013 R2 reports. Similarly, all report objects in Microsoft Dynamics NAV 2013 must also be upgraded by using the Microsoft Dynamics NAV 2013 R2 development environment before they can be used in a merge with Microsoft Dynamics NAV 2013 R2 reports. Also, before you start the merge, you must apply the changes to your Microsoft Dynamics NAV 2013 reports that are described in KB article 2804640 “Code corrections for some Microsoft Dynamics NAV 2013 reports to prevent compilation errors with Report Viewer 2012 when upgrading to later versions of Microsoft Dynamics NAV”.

The following list describes the main steps of upgrading the application code:

  1. Identifying customer-specific changes

  2. Preparing the new base objects

  3. Compare versions

  4. Merging versions

  5. Exporting the merged objects

To begin, create three folders on the computer and name them as follows:

  • OldBaseVersion

  • OldCustomVersion

  • NewBaseVersion

Identifying Customer-Specific Changes

To identify customer-specific changes, you must compare the objects in the customer's old custom version with the old base version.

Complete the following series of actions for the old base version of the Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2009 R2, or Microsoft Dynamics NAV 2009 SP1 database.

  1. Open the database using the Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2009 R2, or Microsoft Dynamics NAV 2009 SP1 development environment.

  2. Export all objects in .txt format into the OldBaseVersion folder. Do not include system tables. Name the file OldBaseVersion.txt.

  3. Repeat steps 1 and 2 for the old custom version of the Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2009 R2, or nav2009sp1 database. Export the objects to the OldCustomVersion folder and name the file OldCustomVersion.txt.

Preparing New Base Version Objects

  1. Open the new base version database using the Microsoft Dynamics NAV 2013 R2 development environment.

  2. Export all objects in .txt format into the NewBaseVersion folder. Do not include system tables. Name the file NewBaseVersion.txt.

For each version, split the converted .txt files into single objects and review them using a file comparison tool. Delete the objects that are identical and not customized.

You can now start comparing the converted objects.

Comparing Versions

Use a file comparison tool to compare the files that you created in the previous procedure and find and view details about the objects changed during the upgrade to Microsoft Dynamics NAV 2013 R2. This process is easier if you split each of your three exported .txt files into collections of .txt files, with one object for each file.

As you compare the files, make a log of the differences and evaluate the changes that have been made.

Decide which changes from the old custom version you want to duplicate in Microsoft Dynamics NAV 2013 R2. Some of the customizations may correspond to new functionality in Microsoft Dynamics NAV 2013 R2. In such cases, you do not have to move the changes from the old custom version.

To make the evaluation easier, determine if there is any document that describes the changes that have been made in the old custom version. Object names or field names that would be duplicated because of the merge must be renamed. Function numbers and control numbers must be renumbered.

Merging Customizations with Microsoft Dynamics NAV 2013 R2

You must now merge the customized objects into the new standard database to create the new custom database.

For this step, you should use a merge tool which lets you see all three existing versions at the same time and merge the changes into the fourth, new custom version. The following table illustrates the databases that you must compare and merge.

Old base version Old custom version New base version New custom version

Standard Microsoft Dynamics NAV 2013 objects

Customized Microsoft Dynamics NAV 2013 objects

Standard Microsoft Dynamics NAV 2013 R2 objects

Result of merging

Typically, you merge changes in the old custom version into the new base version. However in some cases, when the number of changes in the new base version is insignificant, it can be easier and faster to merge those changes directly into the old custom version and then copy merged objects into the new custom version.

The following table highlights the key code merging principles. We recommend that you use these principles for the merging process, depending on how a certain line or block of code that is located in the old base version is changed throughout the versions.

Old base version Old custom version New base version New custom version Comments

Exist

Not modified

Deleted

Delete

Exist

Not modified

Modified

Copy from new base version

Exist

Not modified

Not modified

Copy from new base version

Exist

Modified

Deleted

Conflict

Exist

Modified

Modified

Conflict or copy from new base version

There is no conflict if the old custom version is modified just as the new base version.

Exist

Modified

Not modified

Copy from old custom version

Exist

Deleted

Deleted

Delete

Exist

Deleted

Not modified

Delete

Exist

Deleted

Modified

Conflict

Inserted

Copy from old custom version

Inserted

Copy from new base version

Inserted

Inserted

Conflict or copy from new base version

There is a conflict if the inserted code is different in the old custom and in the new base versions.

After you have completed the merge, export the new custom version to a text file, import it into the new Microsoft Dynamics NAV 2013 R2 database, and then compile all objects. You can expect compilation errors. You must resolve the errors before you can continue.

You now have a new customized database. This database contains all the objects that have been customized to include the changes that were made in the old database.

Exporting All Objects

Now, you must export all objects to an objects.fob file so that you can import them when performing the data upgrade. The export must include customized objects, upgraded reports, and all other Microsoft Dynamics NAV 2013 R2 objects.

To export all objects

  1. In Object Designer, choose the All button to display all objects.

  2. On the Edit menu, choose Select All.

  3. On the File menu, choose Export.

  4. In the Export Objects window, in the File name text box, enter objects, and in the Save as type drop-down list, select Dynamics NAV object format (*.fob).

  5. Choose the Save button.

This completes the upgrade of the application code. Next, you must upgrade the data in the database. For more information, see Upgrading the Data

See Also

Concepts

Upgrading the Data

Other Resources

Upgrading to Microsoft Dynamics NAV 2013 R2