Dimensions in NAV 2016.. – design overview

Standard

As stated here, beyond the setup and usage of dimensions, developing with NAV requires a better grasp of dimension’s internal design.

I’ll be diving shortly into the dimension related concepts: dimension set entries (Table 480 Dimension Set Entry), search trees (Table 481 Dimension Set Tree Node), dimension management (Codeunit 408 DimensionManagement).

The following use case will create a sales invoice, and add dimensions. We will inspect the main tables and the code in codeunit 408 DimensionManagement to understand what happens. But first, let’s setup some dimensions and their values:

  1. Open Page 536 “Dimension” and create a new dimension (DEPARTMENT), this will create a record in Table 348 “Dimension”
  2. On the same Page, in the Navigate FastTasb, launch “Dimension Values”. This will open Page 537 “Dimension Values” where you can create a few dimension values for this new dimension: these new values will be stored in Table 349 “Dimension Value”
  3. Repeat steps 1 and 2 for two more dimensions AREA and SALESPERSON.
  4. Assign Global Dimensions in General Ledger Setup (Open General Ledger Setup Page and launch “Change Global Dimensions …” action) to Department and Area. This will fill up General Ledger Setup fields: “Global Dimension 1 Code” and “Global Dimension 2 Code”. NAV will assign “Shortcut Dimension 1 Code” and “Shortcut Dimension 2 Code” with these two global dimensions.

GLS

Note: If you’ve updated the Global Dimensions you’ll be warned that the system will run an update on all posted entries to update the dimensions. After the update restart RTC, otherwise .

At the end of the 4 steps this is how the affected tables look like:

Table 348 “Dimension”:

T348

Table 349 “Dimension Value”:

DimVal

 

Let’s create now a Sales Invoice and note how the dimensions are handled.

On the Lines Fast Tab on the Sales Invoice add the columns for the newly picked dimensions: DEPARTMENT Code and AREA Code.

Assign AREA Code field the value “EAST”:

 

SL_1

Validating the “Department Code” involves updating the “Dimension Set ID” for the sales line. The core of this operation happens in Codeunit 408 DimensionManagement:

CU480_1

Looking into table 480 and 481 this is the current situation in our exercise:

480_481_1

NAV has created an entry in the table 480 Dimension Set Entry for the Dimension/Dimension Value pair AREA=EAST and assigned it an ID = 3254.

Additionally, NAV created a search tree in which at this point we only have a node(the root) for the just started dimension combination with one dimension (AREA=EAST).

Lets assign now a new dimension, the Department code to SALES:

SalesLine_Department

Let’s check what happened in Table 480 and 481:

480_481_2

 

In Table 480 “Dimension Set Entry” NAV inserted two more lines (2nd and 3rd) and assigned to both Dimension Set ID = 3255. This is to identify the 2-tuple AREA=EAST and DEPARTMENT =SALES uniquely with ID = 3255. I do expect that, if I add a new dimension that would be assigned an ID=3256 and we will have 3 new records with that ID.

In the left side we have the trees.

The middle one (0,5039;3254) was generated in the previous step when we assigned the first dimension (AREA=EAST); As part of assigning a second dimension (DEPARTMENT=SALES) the system generated two more trees:

  • first one is a tree with a single node for DEPATMENT=SALES
  • second tree has two nodes: as root we have the node with Dimension Set ID=1 (DEPARTMENT=SALES) and as branch from this root we have a node with Dimension Value= 5839 and Dimension Set ID = 3255 which we can see in Table 480 is the node for AREA=EAST.

Tree_2_Dims

Let’s fill up a third dimension and check if our expectations were right:

SL_3

By inspecting the two tables (480 and 481) we notice:

480_481_3

  • 3 new records in 480 to identify the 3-tuple (AREA=EAST,DEPARTMENT=SALES,SALESPERSON=SAM). All three records have been assigned Dimension Set ID = 3256.
  • In table 481, NAV created a 4th search tree, beside the 3 existing ones

4th_TREE

In code, if we want to update the “Dimension Set ID” we would do something similar to the code in ValidateShortcutDimValues function in Codeunit 408 “DimensionManagement”

UpdateDimSetID

If you need to get a combined Dimension Set ID based on two existing Dimension Set IDs you can use the function GetCombinedDimensionSetID to do it in one shot:

MultipleDimSets

To understand the benefit between old way of managing dimensions (Pre-2013) and the new way, check archerpoint article.

Thanks for reading, sharing commenting … Much appreciated!

Original article 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.