AX / D365FO – How to do an Inventory recalculation for on-hand Qty

Sometimes you may see some discrepancy in InventSum table for any item then you may need to recalculate inventsum for particular item.

You can try in 2 different ways :

  • With D365FO User Interface
  • With X++ code

With D365FO User Interface

Go to System administration > Consistency check

Choose :

  • “Inventory management” Module
  • Just do a “check” o definetively “fix error”
  • On-hand qty

The job will process all the InventSum Items so it could take several hours. Remember to run in BATCH MODE

With X++ Code

You can create your own class to do an inventory recalculation

Here is a sample code that will recalculate InventSum for a specific item.

 static void InventSum_Recalculate(Args _args)  
 {  
   InventSumRecalcItem           InventSumRecalcItem;  
   InventTable               _InventTable;  
   while select * from _InventTable where _InventTable.ItemId == '61142A'  
   {  
     ttsBegin;  
     InventSumRecalcItem = new InventSumRecalcItem(_InventTable.ItemId, true, checkfix::fix);  
     InventSumRecalcItem.updatenow();  
     ttsCommit;  
   }  
   info("Done");  
 }  

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 )

Facebook photo

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

Connecting to %s