web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

WHS-on hand entries cleans up inventsum records with inventory

(0) ShareShare
ReportReport
Posted on by 204

Dear community,

We're running AX 2012 R3 CU10 and the "Inventory Management --> Periodic --> Clean up --> Warehouse management on hand entries clean up" cleans up inventsum records with posted values.

When the batch jobs cleans up inventsum records with inventory and inventory value we're receiving errors that the standard costs do not comply. This occurs because records in inventsum are deleted and the total inventory value doesn't match up with the quantity.

When we're running the consistency check it luckily restores the missing inventsum records.

 From what I can analyse the batch checks the Inventsum and WHS inventreserve

WHSInventReserve:

private boolean validateWHSInventReserveRecsDeleted(InventTable _inventTable, InventDim _inventDim)

{

   WHSInventReserve                   whsInventReserve;

   InventDim                           inventDimCriteria;

   WHSReservationHierarchyElement     resHierarchyElement;

   InventDim                           inventDim;

   InventDimParm                       inventDimParm;

 

   inventDimCriteria.data(_inventDim);

   inventDimCriteria.clearFieldsFromHierarchyList(WHSReservationHierarchyProvider::construct().

                                                   getDimListBelowLocation(_inventTable, WHSReservationHierarchySortOrder::BottomUp));

 

   inventDimParm.initFromInventDim(inventDimCriteria);

 

   select firstOnly RecId from whsInventReserve

       where whsInventReserve.ItemId == _inventTable.ItemId

           && (whsInventReserve.AvailOrdered == 0

           && whsInventReserve.AvailPhysical == 0

           && whsInventReserve.ReservOrdered == 0

          && whsInventReserve.ReservPhysical == 0)

           #InventDimExistsJoin(whsInventReserve.InventDimId, InventDim, inventDimCriteria, inventDimParm)

       exists join resHierarchyElement

           where resHierarchyElement.ReservationHierarchyLevel == WHSInventReserve.HierarchyLevel

               && resHierarchyElement.ReservationHierarchy     == reservationHierarchy

               && resHierarchyElement.ReservationHierarchyLevel >= highestReservationLevel;

 

   return whsInventReserve.RecId == 0;

}

InventSum

protected boolean validateInventSumDelete(InventSum _inventSum)

{

   boolean                     ret;

   WHSReservationHierarchyLevel level;

 

   ret = super(_inventSum);

 

   if (ret)

   {

       level = WHSReservationHierarchyInventDimUtil::getLevelOfFirstBlankDim(_inventSum.ItemId,

                                                                             _inventSum.inventDim(),

                                                                              WHSReservationHierarchySortOrder::TopDown);

       // Do not delete <c>InventSum</c> record if the dimension set is above the highest reservation level to delete.

       if (level < highestReservationLevel

           && level != 0) // if there are no blank dimension fields then level will be zero.

       {

           ret = false;

       }

   }

 

   return ret;

}

 

 Is this because the WHSInventReserve and InventSum tables are out of sync? Because the WHSInventReserve validation checks if all records are 0? What I also find strange is that this batch doesn't check if inventsum records are 0 as the regular On Hand entries clean up.

 

Looking at the code isn't it more efficient to clean-up all WHSInventReserve and InventSum records on SQL, where all records are 0?

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans