glpBatchCleanup Error

Dynamics GP tracks activity, such as having a Transaction window open or posting a transaction, in two System Database (i.e. DYNAMICS) tables:

SQL Name Dexterity Description
SY00800 SY_Batch_Activity_MSTR Batch Activity
SY00801 SY_ResourceActivity Resource Activity

Just opening the GL Transaction Entry window results in records being added to both tables.

glpbatchcleanup

glpbatchcleanup

If the transaction is assigned to a Batch, an additional record is added to the Batch Activity table.

glpbatchcleanup

glpbatchcleanup

When a transaction is posted, records are added to these tables, and then removed when posting completes.

If anything happens that causes these records to not be removed, the “stranded” records remain in the tables.  Stranded records are a common reason for this type of error:

glpbatchcleanup

The error reads:

The stored procedure glpBatchCleanup returned the following results. DBMS 0, Microsoft Dynamics GP 20486

The error codes reported by this error message are shown below. The glpBatchCleanup stored procedure calls several other stored procedures, each of which can report error codes.  An error code from any of the related stored procedures can cause glpBatchCleanup to abort and report a message like the one shown above.

Code Source Description
20062 smGetMsgString Selecting from MESSAGES either returned no records, or more than one record.
20063 smGetConstantInt Either no result found, or multiple values found
20064 smGetConstantString Either no result found, or multiple values found
20170 smGetConstantMSItem Either no result found, or multiple values found
20270 smGetConstantMSItem Empty input parameter
20267 smGetMsgString Empty input parameter
20269 smGetConstantString Empty input parameter
20271 smGetConstantInt Empty input parameter
20284 glpUpdateBatchStatus Empty input parameter
20285 glpUpdateBatchStatus Updating Batch Status in SY00500 either updated no records, or more than one record
20486 glpBatchCleanup Updating Batch Status in SY00500 (joined to SY00801) either updated no records, or more than one record
20487 glpBatchCleanup Empty input parameters
20488 glpBatchCleanup BatchCleanupCursor found no records when retrieving from SY00500 joined to SY00801
20489 glpDeleteBatch Empty input parameters
20491 glpUpdateBatch Empty input parameters
20492 glpUpdateRecurringBatch Updating GL10000 affected either zero rows, or more than 1 row
20493 glpUpdateBatch Updating SY00500 either updated no records, or more than one record.
20501 glpUpdateQuickBatch Empty input parameters
20502 glpUpdateQuickBatch Either the Batch could not be found in SY00500, or multiple records exist
20505 smAddPostingSecurityRecord Empty input parameters
20506 smAddPostingSecurityRecord Invalid Series
20507 smAddPostingSecurityRecord Attempting to retrieve Company record from SY01500 either returned no records, or more than one record
20508 smAddPostingSecurityRecord Attempting to retrieve record from SY60100 by Company ID either returned no records, or more than one record
20509 smAddPostingSecurityRecord Attempting to retrieve records from SY01000 either returned no records, or more than 32
20511 smAddPostingSecurityRecord Failed finding message string
20512 smAddPostingSecurityRecord Adding record to SY05000 either added no records, or more than one record
20517 smDetermineMSItemValue Empty input parameter
20518 smDetermineMSItemValue Position < 1 or > 32
20535 smAddPostingSecurityRecord Retrieving record from SY04300 returned more than one result
20543 glpBatchCleanup Previous glpBatchCleanup call is still in process
20542 glpUpdateRecurringBatch Empty input parameter
20544 glpBatchCleanup Deleting Batch from SY00800 either affected no records, or more than one record
20545 glpUpdateBatchStatus Deleting Batch from SY00800 either affected no records, or more than one record
20547 glpUpdateRecurringBatch RecurringBatchCursor failed fetching a row (the row was missing).
20549 glpDeleteBatch Deleting Batch from SY00500 either deleted no records, or more than one record
20552 smAddPostingSecurityRecord Invalid Start/End values
20576 glpUpdateRecurringDate One or more input parameters are empty.
20717 glpUpdateQuickBatch Deleting Batch from SY00500 either affected no records, or more than one record
20717 glpUpdateBudgetBatch Deleting Batch from SY00500 either affected no records, or more than one record
20759 glpUpdateRecurringBatch RecurringBatchCursor found no records in GL10000 for the Batch ID
20811 glpUpdateBatchStatus Adding record to SY00800 either affected no records, or more than one record
20812 glpUpdateBatchStatus Updating Batch Status in SY00500 either updated no records, or more than one record
20819 glpBatchCleanup There was an error retrieving records from the Batch Cleanup Cursor
20820 glpBatchCleanup Updating Batch Status in SY00500 (joined to SY00801) either updated no records, or more than one record
20957 glpBatchCleanup Updating GL10000 by Batch ID affected no records
20980 dtaGetFinancialRef Empty input parameter
20981 dtaGetKeyGLFields Empty input parameter
20989 dtaUpdateForDateChange Empty input parameter
20990 dtaUpdateForDateChange TrxLine cursor failed retrieving row (row missing)
21114 glpUpdateBudgetBatch Empty input parameter
21115 glpUpdateBudgetBatch Updating Batch in SY00500 either updated no records, or more than one record
21117 glpBatchCleanup Updating GL12000 by Batch ID affected no records

Note that 20717 is correctly shown above as a duplicate.

The resolution to this issue is provided by Microsoft here:

//support.microsoft.com/en-us/kb/850289

In the event the link above is no longer valid, a PDF version is available here:

pdf

glpBatchCleanup.pdf

 

Completely preventing this from occurring is probably impossible due to the wide variety of events that could cause it.  It does seem that some posting routines are more likely to result in stranded records, such as posting Manufacturing Receipts.  Regardless, a “preventative” approach could be taken by using Microsoft’s instructions to create a SQL Job that regularly clears the tables.  This would have to run during a time when nobody is on the system, such as nightly, or once per week on a weekend.