Translate

Monday, September 28, 2015

AX2012- Update/Change FinancialDimension value in X++ code

static void PSV_UpdateOpDivDimension_Items(Args _args)
{
InventTable inventTable;
DimensionAttributeValueSetStorage dimStorage;
DimensionAttribute dimAttrOpDiv;
DimensionAttributeValue dimAttributeValue;
changeCompany('DAT')
{
while select forUpdate inventTable
{
ttsBegin;
dimStorage = DimensionAttributeValueSetStorage::find(inventTable.DefaultDimension);
dimAttrOpDiv = DimensionAttribute::findByName("Operating_Division");

dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttrOpDiv, 'NewValue', true, true);

dimStorage.addItem(dimAttributeValue);
inventTable.DefaultDimension = dimStorage.save();
inventTable.doUpdate();
ttsCommit;
}
}
}


This code updates the items financial dimensions to new values.


hope this helps,
Thanks
Prasan

3 comments:

  1. Wonderful post and very helpful...
    One request, please write a job by which we can import or update financial dimensions of any item available in excel. Because during master upload we will have approx 4K+ records.

    ReplyDelete