Slow Performance when adding items on Sales Orders - related to really poor coding of spimIMSQtyAvailable

SOLVED

Hi,

We have been having issues in SAGE2016 (we recently installed the May updates to see if it would help) when entering items on Sales Orders.

The last suggestion we got from support seems to help alleviate the problem. 

The suggestion was to run 'recompile spimIMSQtyAvailable' on the SQL Server when we have the issue.

This gives us temporary relief until the plan in the procedure cache is bad again. 

In looking at the stored procedure, it does a tremendous amount of looping with cursors that seems redundant. The stored procedure was written in 1998 and has had no updates for 20 years. 

What is the right way to get this fixed so that it isn't a performance bottle neck?

This site (https://www.rklesolutions.com/blog/sage-500-process-replenishment-orders ) has a great suggestion to change the overflow checks but we need this as base code from SAGE.

This SP was written in 1998 and needs to be rewritten with modern methods that are much more efficient.