Friday, November 20, 2015

Updating Inventory Dimensions Group in Ax 2012

Hi!

If you need to change the Inventory Dimension Groups In Ax (StorageDimensionGroup and TrackingDimensionGroup), you could use this.

1  InventTable                     inventTable;
2  EcoResStorageDimensionGroup     ecoResStorageDimensionGroup;
3  EcoResTrackingDimensionGroup    ecoResTrackingDimensionGroup;

4 ;
5   inventTable                                      =   InventTable::find("anArticle");
6   ecoResStorageDimensionGroup     =   ecoResStorageDimensionGroup::findByDimensionGroupName("anotherGroup");

7   ecoResTrackingDimensionGroup   =   ecoResTrackingDimensionGroup::findByDimensionGroupName("anotherGroup");
8

9   InventTableInventoryDimensionGroups::updateDimensionGroupsForItem(
10            curext()

11           , inventTable.ItemId
12            , ecoResStorageDimensionGroup.RecId
13            , ecoResTrackingDimensionGroup.RecId
14            , inventTable.Product);
15 }

  

Line 1 to 4 declarations, line 5 to  7 finding the ItemId named "AnArticle" and the Storage Dimension Group and the Tracking Dimension Group, they both named "anotherGroup".

Line 9 performs the updateDimensionGroupsForItem of the class InventTableInventoryDimensionGroups.

Important!. There must not be physical movementsor financial movements pending for this item.


No comments:

Post a Comment