February 02, 2017

How to delete old batch sessions

Users have created tons of batch input sessions and processed them with SM35. The users did not care about deleting unwanted sessions and there are a lot of old sessions, with almost any status (in processing/in background/processed/errors). All of them are junk (in your terms), and have to be removed from the system.


Batch input session with status "incorrect / error" , we can delete directly from SM35. Follow on below steps :

1) Tcode SM35


2) Choose "incorrect" tab and displayed batch input sessions with status error



3) we can delete manually by selection sessions or individually




The batch-input sessions are located in the tables APQI and APQD. If that is so, please delete the corresponding entry from table APQL and after that you will be able to delete the “In Process” sessions from SM35 Tcode. Please use the session name to search the entry in table APQL.

For example : We try delete batch input session with "in process" and queue group name "REVAL CUST"

1) Choose "in process" tab on SM35


2) Highlight session name "REVAL CUST". Please noted the date and time of this batch session.


3) Delete the corresponding entry from table APQL with SE16 


4) Input the group name with "REVAL CUST"

5) Now we can see all "REVAL CUST" batch session entry. Matching the date and time from data batch session on SM35. If result was match, we can delete the batch session entry on SE16 (makesure client setting to be open repository SCC4)





6) Back to tcode SM35 and delete batch session "REVAL CUST"






You can delete unwanted sessions with abap program RSBDCTL6 at once and then setup a background job that deletes the sessions for a specific session, user who created the session, date range, older than x days etc. that runs on a regular basis.



Alternatively way : 

a) you can run program RSBDC_REORG.  However, tests showed that this program may not be suitable for sessions that have a status other than processed. 

b) you can run program RSBDCREO *only* deletes sessions which are in status “processed”. The reason for this is that this report is written for an automatic cleanup and therefore should never remove sessions that are not completely processed. The report also only deletes the logs for sessions which are already deleted (or scheduled for deletion in the same run).
This means that when you check both options on the initial screen of RSBDCREO, the following sessions and logs will be deleted:
     1. Processed sessions and their logs
     2. Logs for which no sessions exist anymore