Everybody aware of how NAV structured the dimension and how it works during transaction posting. Its basically creates Dimension SET based on the unique combination of dimension values and assigns one unique Dimension SET ID. This change was done to preserve the Database space and improve the performance.
Now during one of the recent implementation customer swap the ledgers in chart of accounts which result in change the posted transactions and that was so easy as we have to just change the chart of accounts ledger account no but real problem started when we have to change the Dimension data also for these transactions. This was not just straightforward to go in table and update the dimensions or swap the dimensions according to ledger account as it stored the Dimension SET ID in each posted table and based on that one can view the dimension.
Update Dimension SET ID is one of the challenging task as based on the combination as I already update the dimension field using dimension values associated with the ledger accounts but now it is not displaying or showing me weird result but WHY ???
It is because we have updated the dimension values but not the unique Dimension SET ID in the table which determines the combination of dimension values.
So now to update these dimension SET ID we have to first find the unique set id based on the combination.
AM I need to write big program to find the actual combination ???? and I was thinking HOW NAV IS Doing this and I found my Answer
HOW TO FIND Dimension SET ID ????
Application already have one code unit ‘DimensionManagement’
In this codeunit One Global function written to find dimension set id i.e. GetDimensionSetID.
This function contain only one line of code and one parameter which is record variable i.e. Dimension Set Entry table
We have do following to find the combination of dimension using this function
- Define One record variable for Dimension SET Entry Table and set property Temporary to Yes
- Insert the required combination of dimension values into this table
- While inserting record SET dimension SET ID to some other values such as negative value . I user -1 value for safer side.
- Once the record inserted in table pass the table in function to get Dimension SET ID.
This gives you correct dimension set id based on the combination available and advantage is that it will assign the Dimension SET ID if any combination changes or not available in dimension table.
Don’t forget to make the table property temporary to Yes or else it will insert real time data in table and this may create mess in dimensions.