Dynamics AX 2012: Make manual changes to InventTrans? Recalculate the InventSum table automatically

If you were forced to make manual updates to the InventTrans table, your on-hand inventory counts may look off. Fortunately, there’s a built-in class to recalculate the InventSum table:

InventSumRecalcItem InventSumRecalcItem;
InventSumRecalcItem = new InventSumRecalcItem(“ItemID”, TRUE, checkfix::fix);
InventSumRecalcItem.updatenow();

Replace “ItemID” with the ItemID of the item you wish to correct.
The second parameter (TRUE or FALSE) indicates whether to show errors.
The third parameter indicates whether to recalculate (checkfix::fix), or just check for discrepancies (checkfix::check).

 

You can also run this on the entire InventSum table:

InventTable InventTable;
InventSumRecalcItem InventSumRecalcItem;

WHILE SELECT InventTable
WHERE (InventTable.ItemType == ItemType::Item) || (InventTable.ItemType == ItemType::BOM)
{    
     InventSumRecalcItem = new InventSumRecalcItem(InventTable.ItemId, TRUE, checkfix::fix);
     InventSumRecalcItem.updatenow();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s