Issue: Error when trying to apply sales transaction in the Apply Sales Documents.
Unable to choose the document because it is part of a recovered batch or is still in the process of posting

Scenario 1:
After running the SQL script

[select * from SY00500 where BACHNUMB – {‘XXX’}], BCHSTTUS and MKDTOPST do not equal zero

Solution 1:

Run the following SQL scripts:

SELECT * FROM DYNAMICS..ACTIVITY
SELECT * FROM DYNAMICS..SY00800
SELECT * FROM DYNAMICS..SY00801
SELECT * FROM TEMPDB..DEX_LOCK
SELECT * FROM TEMPDB..DEX_SESSION

If there are results on any of the above scripts, make sure everyone is logged out of GP and then run the following scripts to clear the tables:

DELETE DYNAMICS..ACTIVITY
DELETE DYNAMICS..SY00800
DELETE DYNAMICS..SY00801
DELETE TEMPDB..DEX_LOCK
DELETE TEMPDB..DEX_SESSION

UPDATE SY00500 SET MKDTOPST=0, BCHSTTUS=0 where BACHNUMB= {‘XXX’}

Scenario 2:
1) After running the SQL script [select * from SY00500 where BACHNUMB – {‘XXX’}], BCHSTTUS and MKDTOPST does equal zero
2) Original posting went through
3) A duplicate Batch ID has been created sicne posting

Solution 2:

Assign transactions in duplicate batch to a new Batch ID
Delete the empty batch