Skip to main content

get Financial dimension from Purchase Order AX 2012 X++

Problem:How to get Financial Dimension from Purchase order AX 2012 X++?


Solution :


public str getDimensionCombinationValues(PurchTable _purch,str _val)
{
PurchID _purchId = "";
DimensionAttributeValueSet    dimAttrValueSet;
DimensionAttributeValueSetItem  dimAttrValueSetItem;

DimensionAttributeValue dimAttrValue;
DimensionAttribute dimAttr;
Common                  dimensionValueEntity;
DimensionValue          dimensionValue;
DimensionAliasName      dimensionName;
;

dimAttrValueSet = DimensionAttributeValueSet::find(_purch.defaultdimension);

while select dimAttrValueSetItem where dimAttrValueSetItem.DimensionAttributeValueSet == dimAttrValueSet.RecId
{
dimAttrValue =  DimensionattributeValue::find(dimAttrValueSetItem.DimensionAttributeValue);
dimAttr      = DimensionAttribute::find(dimAttrValue.DimensionAttribute);
dimensionValueEntity =DimensionDefaultingControllerBase::findbackingEntityInstance(curext(),dimAttr,dimAttrValue.EntityInstance);
dimensionValue = dimAttrValue.getValue(); 
     if(dimAttr.Name == _val)  
    {  
    dimensionValue = dimAttrValue.getValue();
    dimensionName = dimAttr.Name;   
    break;  
    }

 return dimensionValue;
}

Comments

Post a Comment