While applying a payment to a posted invoice in the payable module, an error pops up indicating that " You can't choose this document because it is part of a recovered batch or is still in the process of posting" as illustrated in the screen shot below.


Nothing exists in the batch recover, don't waste time looking for any corrupted records there 
This issue occurs due to having the same record ( mostly an invoice ) in both work and open tables (Unposted and Posted table) . As the apply function checks for any open transaction, duplicated records are found across PM10000 and PM20000, which results with this issue. 

In order to resolve the issue, you basically need to delete the record from the PM10000 which already exists in the PM20000. Then, try again and the apply payable document will work perfectly as designed. 


Run the script as you replace the XXXXXXX with the specific voucher number which already exists in PM20000. 

Best Regards, 
Mahmoud M. AlSaadi