Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
Showing results for 
Search instead for 
Did you mean: 
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.

Following is the entire code snippet.


REPORT zunlock_cif_q.TABLES: trfcqstate.

DATA: params TYPE TABLE OF rsparams,
wa_par TYPE rsparams.

DATA: lt_errorq TYPE STANDARD TABLE OF trfcqin.
DATA: lr_day TYPE rsis_t_range.

qtable = lt_errorq.

LOOP AT lt_errorq INTO DATA(lw_errorq).

REFRESH params[].
CLEAR wa_par.
wa_par-selname = 'QNAME'.
wa_par-kind    = 'P'.
wa_par-low     = lw_errorq-qname.
APPEND wa_par TO params.

CLEAR wa_par.
wa_par-selname = 'FNAME'.
wa_par-kind    = 'P'.
wa_par-low     = '*'.
APPEND wa_par TO params.

CLEAR wa_par.
wa_par-selname = 'DAY'.
wa_par-kind    = 'S'.
wa_par-sign    = 'I'.
wa_par-option  = 'BT'.
wa_par-low     = '20200501' . "day-low.
wa_par-high    = '20991231' . "day-high.
APPEND wa_par TO params.

CLEAR wa_par.
wa_par-selname = 'PAKET'.
wa_par-kind    = 'P'.
wa_par-low     = 1000.
APPEND wa_par TO params.

CLEAR wa_par.
wa_par-selname = 'DISPLAY'.
wa_par-kind    = 'P'.
wa_par-low     = ' '.
APPEND wa_par TO params.






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.