Friday, 10 August 2012

Dynamics AX 2012 Financial Dimensions

Hi Friends,

Today we will be exploring the new changes related to Financial dimensions in AX 2012.

Earlier versions AX 2009, 4.0 :
  • In older version System use to limit the creation of dimensions up to 10. 
  • By default 3 dimensions were available in the system namely Department, CostCenter and Purpose.
    Technically these dimensions were controlled by Enum SysDimension and an array EDT Dimension.
  • So If we have 3 enum elements in SysDimension, then its corresponding array elements are stored in    dimension EDT and can be referred as Dimension[0], Dimension[1].....
  • If you would like to store these dimension values against customized table, then simply we were adding the EDT Dimension to that Table. At Form level simply drag and drop field on Group then system use to  show all the array elements as string control.
New version AX 2012 (6.0) : 

  • In AX 60, their is no limit to dimension creations. One can create n number of dimensions as per    organization requirements.
  • Technically their is huge change in framework, the way these dimensions used to be created and stored.
  • Firstly EDT Dimension (array) is deprecated and replaced with DimensionDefault (Int64 RecId).    
  • Financial Dimensions master table Dimension is replaced with DimensionAttribute and DimensionValueDetails.
  • Now if one wish to store these dimension on your customized table then instead of EDT Dimension one should add DimensionDefault EDT.       
  • At Form level make use of DimensionDefaultingController class to show the available dimensions.
How to access Financial Dimensions values in AX 2012: 
 In earlier version, accessing dimension values was very simple like
                 CustTable.Dimension[0]      ==  Department  value    
                 CustTable.Dimension[1]      ==  CostCenter  value
                 CustTable.Dimension[2]      ==  Purpose       value

 In AX 60, since they have replaced Dimension EDT with RecId DimensionDefault we have to make use of Dimension helper classes to access values.So in CustTable you will find defaultDimension field which stores reference recId for DimensionAttributeSet.       

 I am referring Customer 1101 in CEU Company, Contoso Demo Data for illustration purpose. Note the dimension values for this customer as shown in below snap.

Refer the code to access the values.

static void DEV_Dimension(Args _args)
    CustTable                         custTable = CustTable::find("1101");
    DimensionAttributeValueSetStorage dimStorage;
    Counter i;
    dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
    for (i=1 ; i<= dimStorage.elements() ; i++)
        info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,        
When you run the job, will see as below

I know that now you might have understood the importance of theses helper classes, they are making our lives easy :)

1 comment: