While deleting Inbound Queues without resolving the errors are a risk, there might be cases where queues need to be cleared on regular intervals. Best practice is to check the Stuck Queues and then act accordingly.
We can delete Queues and specific LUWs from SMQ2 TCode manually. However, when the count goes up to 1000s and the same task must be done every day manually, it becomes cumbersome.
The SAP Standard Program RSTRFCIDS deletes individual Inbound Queues Using Selection Criteria.
Now we want this program to be executed in background for each error queue. For that, we need to get the list of error/stuck queues.
We get the queues in error state using FM TRFC_QIN_GET_ERROR_QUEUES. Then we loop through the list of queues and submit the program RSTRFCIDS for each stuck queue.
SUBMIT rstrfcids WITH SELECTION-TABLE params AND RETURN.
In this blog post, we have deleted inbound queues in SAP TM system using Report RSTRFCIDS. Please note that this is a worst case scenario where we need to blindly delete stuck queues without checking. If not critical, it is advised to check the errors of stuck queues before deleting. Kindly go through the post and let me know your thoughts. Also, do suggest if there are better approaches to this.