In AX 2012 there are a couple of different ways you can programmatically create combinations of dimensions. These combinations are saved as records in the DimensionAttributeValueCombination table. The RecId from the DimensionAttributeValueCombination table is what is saved in the LedgerDimension field on the LedgerJournalTrans table.
The first and best way to create dimension combinations is to use the class and method DimensionServiceProvider\buildDimensionStorageForLedgerAccount. The buildDimensionStorageForLedgerAccount method takes aLedgerAccountContract class. In the LedgerAccountContract class there are two parm methods, parmMainAccount and parmValues. The parmMainAccount method takes the MainAccount like ‘10060’ and the parmValues method takes a list of the other dimension values you want to set. More specifically the parmValues method takes a list of classes. The classes are of type DimensionAttributeValueContract. On the DimensionAttributeValueContract class you set twomethods, parmName and parmValue. For example, ‘Department’ for the name and ‘10’ for the value. Build up a list of DimensionAttributeValueContract classes for each dimension you want to specify and then pass the list to the parmValues method on the LedgerAccountContract class. Once you have the LedgerAccountContract built up send it to the DimensionServiceProvider\buildDimensionStorageForLedgerAccount.
Optionally you can use a utility method in AX in AxdDimensionUtil\getLedgerAccountId. This one is not as nice as buildDimensionStorageForLedgerAccount because it takes a container instead of a class (with known types). Here’s an example of the method in AX:
container myContainer = ["110180-USAA", “110180”, 1, "Country", "USAA"]; //The third argument, 1, indicates the number of dimensions you are going to include, this does not include the main account.
Here is another example constructing the contents of thecontainer with the dimensions included in the demo data
// Construct input
// Display value strFmt('%1-%2-%3-%4', ‘10060’, '10’, ‘2020’, ‘M010’),
// Main account
// Segment count
// 2nd segment of 1st hierarchy
// 3rd segment of 1st hierarchy
// 4th segment of 1st hierarchy
Hi.Hope ur doing good.Am Chamantha.
I have a requirement.
In AX 2012, I am asked to add a financial Dimension Value...For Example to add a Business Unit in a ProjectsListPage.
Please help in adding a financial Dimension field value to a listpage.
mail me @ chamantha.K@servion.com
call me @ +91-9894885682
Chamanta - you should be able to find the information you need in the whitepaper we have published around implementing the new financial dimension framework, which can be found here: download.microsoft.com/.../Implementing_the_Account_and_Financial_Dimensions_Framework_AX2012.pdf
You will want to look at the section around adding a default dimension field to a form.