3 Easy Methods to move company data between NAV databases

Standard

If there is something that changes in NAV every few releases, is how we backup and restore data (be that full backup, application data, companies data) between NAV databases.

Recently I was asked how is this done in NAV 2016.

The answer is simple and is applicable to both NAV 2015 and NAV 2016:

  • with 2 powershell cmdlets
  • via Pages 9901 (for Export) and Page 9900 (for Import)
  • using C/AL functions EXPORTDATA/IMPORTDATA.

Let’s assume the following case. A bug was reported by a customer. You want to have access to his production environment, but many times that’s not possible. One way is to do a SQL backup of customer’s database. That assumes you will have at least backup rights on their database server. Many times that’s not possible. But you probably have access to NAV.

Let’s try to export company data with powershell cmdlets:

  • Launch Dynamics 2016 Administration Shell
  • Run the following cmdlet:NAV-ExportData
    • DatabaseName : look in the NAV Administration console for the database name associated with your instance
    • FilePath: it is expected a file with extension “navdata”
  • Copy navdata file onto your local machine and run the following cmdlet to restore the company data in your other environment (be that development, or QA …)NAV-ImportData
    • Similarly to the previous step, DatabaseName can be extracted from the NAV Administration console and FilePath is a local file with a “navdata” extension
    • The cmdlet is confirming that we want to overwrite the company “…” on the local server “.\ServerName”
    • After confirmation of the overwrite, the importing starts, but we get an error. The cmdlet reports that there is a difference in a table definition. In the example above, on the destination database, one of the tables had a few new fields, just because the destination environment was a development copy of customer’s database.
    • To get around this error you need to have similar objects on the destination and the source. So I saved the latest changes on the target database (exported to a fob) calling it LatestChanges.fob. Then I sync’d objects from customer production with target database. I re-run again Import-NAVData and this time it run without issues.
    • ImportSuccesful
    • After a succesful import of company data you can restore your code from LatestChanges.fob
  • The easiest way though, to restore a company data, is to use Page 9901 (for Export)on the Source and Page 9900 (for Import) on the Target.

To export/import data via C/AL code check EXPORTDATA and IMPORTDATA functions:

Msdn EXPORTDATA and Msdn IMPORTDATA

For a sample of how to use these 2 functions, check the code in pages 9900, 9901 in W1.

Original post here.

 

Advertisements

Setup and How-Tos re: Dimensions in NAV2016..

Standard

Recently I’ve been asked to explain the concept of dimension in NAV and while I managed to come up quickly with an answer I wanted to spend some time researching the topic so that next time I need to offer a similar explanation my answer will sound more academic, plus I’ll have a link to refer to ūüôā

According to msdn, “A dimension is data that you can add to an entry as a kind of marker so that the program can group entries with similar characteristics and easily retrieve these groups for analysis purposes.”.

A few characteristics of dimensions:

  • can be applied to documents and journals
  • dimensions have dimension values, for example we can set a dimension AREA with 3 dimension values: Europe, America, Africa.
  • used to create extracts of financial statements for statistics and analysis. In creating these statistics we can use more than one dimension, for example we can look at sales by the following dimensions AREA and DEPARTMENT.

There are two types of dimensions I want to cover here: global dimensions and shortcut dimensions. Additionally, there are budget dimensions that can be defined at the moment when you generate a new budget.

Both, global dimensions as well as shortcut dimensions can be set up for the company in the General Ledger Setup. There are maximum 2 global dimensions and maximum 8 shortcut dimensions. NAV defines the first two shortcut dimensions the same with the global dimensions.

Global dimensions are available for input across¬† the system in tables like 15 “G/L Account”, 18 Customer, 23 Vendor or in ledger entries tables like: 17 “G/L Entries”, 21 “Cust. Ledger Entries” and 25 “Vend. Ledger Entries” (Fields 23,24). Because Global Dimensions are being part of the core system they can be used in filtering ledger entries, filtering in the reports, account schedules or batch jobs.

Shortcut dimensions(set up initially in the General Ledger Setup) will be available at the document level, or at the journal lines level. On each line of the document(sale or purchase) or journal line add the column with a name(code) that was designated in general ledger setup as shortcut dimension and assign to it one of the available dimension values. E.g. if I have defined Global Dimension 1 as DEPARTMENT, I’m expecting to have in the General Ledger Setup the “Shortcut Dimension 1 Code” as DEPARTMENT and when I create a Purchase Invoice, on the lines, to have available a field “Department Code”.

To create dimensions, use Page Dimensions and enter or modify dimensions.

To create values for each dimensions, on the same page go to Navigate Tab, and launch action “Dimension Values”. To assign default values for dimensions, on the same Page (Dimensions) use action “Account Type Default Dim.”. If you dont’ want to specify a default dimension value code, but you want to have it on each ledger entry, set the value of “Value Posting” field to “Code Mandatory”. This way you ensure that no General Journal Line or document will be posted without a value for the specific dimension.

In a future blog I will dive into the technical design of dimensions covering notions such as dimension sets, dimension set entries, search trees and a few notes on performance improvements compared to older dimension design.

Thank you for reading, sharing, commenting … Much appreciated!

Original blog here.