Wednesday, January 30, 2013

Recalculate InventSum

InventSum is needed to recalculate sometimes.We should use InventSumRecalcItem class in Dynamics AX.

Sample Code :

// CODE BEGIN ****************************

InventSumRecalcItem InventSumRecalcItem;
;
InventSumRecalcItem = new InventSumRecalcItem("ITEM001", true, checkfix::fix);
InventSumRecalcItem.updatenow();

// CODE END ******************************

First parameter : ItemId
Second parameter : Show errors
Third parameter : Fix or only check


If you want to calculate for all items :

// CODE BEGIN ****************************

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();
}

// CODE END ******************************

10 comments:

Unknown said...

Hi,
I have encountered inventsum issue, about item without QTY but have financial value. (use weight avg date) Do I have to use Recalculate InventSum for this particular item? What will be impact, if yes? Thank you for your advise?

AX Dummy

Unknown said...

Hi Anil. Thanks. We had same problem in AX 2012 RTM, and this fixed the problem.

Unknown said...

Hi Anil. I had same problem in AX 2012 RTM, and this fixed the problem. Thanks :-)

Raffael Pinheiro said...

Hi Anil!

I was looking a solution for this problem in InventSum table. Your code worked and saved me!

Thank you so much!

absolute584 said...

Thanks a lot Anil for the fix! The InventSum table can easily get out of sync. In addition, it's weird how it updates itself. I don't understand how it fully works but am glad I found your awesome article.

sayeed said...

Please can anybody explain.. why there will be difference between inventtrans and inventsum. This is a major issue in Axapta and how users will know the difference. Reports are completely wrong and system is incorrect.

Microsoft corporation said...

Tesekurler Anil isme yaradi

Selamlar

Unknown said...

Thanks my friend!!! you are amazing!!!

Cris Du said...

Thanks your support!

raynnowui21 said...

I’d have to check with you here. Which is not something I often do! I get pleasure from reading a publish that may make people think. Additionally, thanks for permitting me to remark! real money casino