Thursday, May 15, 2014

Get Default Dimensions value For Vend Customer Item in ax 2012 through X++

// Get Default Dimensions value For Vend Cust Item

static void San_GetDefaultDimensionsForVendCustItem(Args _args)
{
    VendTable                       vendTable;
    InventTable                     inventTable;
    CustTable                       custTable;
    DimensionAttributeValueSet      dimAttrValueSet;
    DimensionAttributeValueSetItem  dimAttrValueSetItem;
    DimensionAttributeValue         dimAttrValue;
    DimensionAttribute              dimAttr;
    Common                          dimensionValueEntity;
    ;
    //vendTable = VendTable::find('3008');
    //inventTable = InventTable::find('1001');
    custTable = CustTable::find('1102');
    //dimAttrValueSet = DimensionAttributeValueSet::find(vendTable.DefaultDimension);
    //dimAttrValueSet = DimensionAttributeValueSet::find(inventTable.DefaultDimension);
    dimAttrValueSet = DimensionAttributeValueSet::find(custTable.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);
        info(dimAttr.Name + ' ' + dimAttrValue.getValue());
    }
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...