Share via


AX 2012 - Get Active Dimensions from Accounting structure

    DimensionAttribute              dimAttr;
    DimensionAttributeSetItem       dimAttrSetItem;
    DimensionAttributeSetItem       dimAttrSetItemEditable;
    DimensionEnumeration            dimensionSetId;
    recId   editableDimensionAttributeSetId;

    ;
   
    dimensionSetId = DimensionCache::getDimensionAttributeSetForLedger();
    // Get all the active dimensions from Accounting Structure.
     while select RecId from dimAttr
        order by Name
        join RecId from dimAttrSetItem
            where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&
                dimAttrSetItem.DimensionAttributeSet == dimensionSetId
        outer join RecId from dimAttrSetItemEditable
            where dimAttrSetItemEditable.DimensionAttributeSet == editableDimensionAttributeSetId &&
                dimAttrSetItemEditable.DimensionAttribute == dimAttr.RecId &&
                dimAttrSetItemEditable.EnumerationValue == NoYes::Yes
    {
       
        Info(dimAttr.name);
    }

}