This blog will explain about technical cleanup to reduce the SAP database growth and to regain control of it.
Questions that will be answered are:
- How to run the standard SAP clean up jobs?
- Where can I find full list of items that could be cleaned up?
- How to run the cleanup of some common objects?
- Database reorganization after cleanup?
This blog assumes you have followed the step in the blog to get insight into your fast growing SAP tables.
If you run ECC on HANA or S4SHANA check out this blog on data aging.
List of technical clean up items
A full list of all possible technical clean up items can be found in OSS note 2388483 – How-To: Data Management for Technical Tables. The chapters below describe the most common ones.
SAP standard clean up jobs
Using SM36 you can plan all SAP standard jobs (which include a lot of clean up jobs for spools, dumps, etc) via the button Standard Jobs.
By hitting the button Default scheduling in an initial system, or after any upgrade or support package, the system will plan its default clean up schedule.
S4HANA has different set up of standard jobs. See blog.
Clean up of old idocs
Idoc data is stored in EDI* tables. Largest tables are usually EDI40, EDIDS and EDIDC.
Old idocs can be deleted using transaction WE11.
In batch mode you can schedule it as program RSETESTD.
In the bottom of the selection screen are the technical options:
The idoc deletion job can fail if there is too many data to process. If they happens remove the 4 tickboxes here and use the separate deletion programs: RSWWWIDE, RSARFCER, SBAL_DELETE and RSRLDREL2. These 5 combined programs will delete the same, but run more efficiently. This procedure is also explained in OSS note 1574016 – Deleting idocs with WE11/ RSETESTD.
Also check these OSS notes:
Clean up of table logging
Table logging is stored in table DBTABLOG. Deletion can be done using transaction SCU3 and then choosing the option Edit/Logs/Delete, or by using program RSTBPDEL.
After you apply OSS note 2535552 - SCU3: New authorization design for table logging: new transaction code SCU3_DEL will be available.
More background information: OSS note 2335014 – DBTABLOG | Reduce size. Bug fix OSS notes:
- 2639096 – Incorrect number of deleted logs displayed upon executing the report RSTBPDEL
- 2755908 – RSTBPDEL – Performance improvement
Clean up of application logging
Application logging is stored in tables BALDAT and BALHDR. Deletion can be done using transaction SLG2 or by using program SBAL_DELETE.
The last options to fine tune the number of logs per job and the commit counter setting do not appear by default. Select menu option Program/Expert mode first.
Tuned setting for commit counter is described in OSS note 2507213 – SBAL_DELETE runs too long.
Delete old RFC data
Old RFC data can be deleted using transaction SM58, selecting some data, then in the overview screen select the menu option Log File/ Reorganize. Or by starting program RSARFCER.
More background information in OSS note 2899366 – Huge entries in table ARFCSDATA.
Delete old change pointers
Old change pointers occupy space in tables BDCP2 and BDCPS. You can use transaction BD22 or report RBDCPCLR/RBDCPCLR2 to delete them.
MDG change pointers
If you are using MDG: it has its own set of change pointer tables. Clean up transaction code is MDGCPDEL. Program for batch job clean up is RMDGCPCLR.
Workflows are stored in many tables starting with SW*.
You can delete workitem history with transaction SWWH or program RSWWHIDE.
This clean up will only do the workitem technical history and not the workflow itself. If workflow itself can be deleted or is to be archived is a functionality decision that the depend on the business and audit needs.
The workflow deleting program can create large amount of spools. If this is not wanted use the NULL printer.
If your business is using the GOS (generic object services) to see workflows linked to a business document, and they cannot retrieve the archived workitem, please follow carefully the instructions in OSS note 2356250 – Not able to view archived workflows.
If you want to delete the actual workflow you have to run program RSWWWIDE.
Take care that before deleting workflows you have checked that these are not needed for audit or financial proof. Some workflows will contain approval steps with a recording of who approved what at which time.
Large amount of documents in SAP inbox
If you have a large amount of items in your SAP inbox, you can delete them via program RSSODLIN. Background is in OSS note 63912 – SAPoffice: Delete user sessions.
Deleting SAP office documents
SAP office documents can be deleted with program RSBCS_REORG. See note 966854 – Reorganization – new report. Note 988057 – Reorganization – information contains a very useful PDF document that explains what to do in cases that RSBCS_REORG is not directly can delete an SAP office document. In most cases you have to run a special program that breaks the link between the document and the data. After that is done you can delete the content.
Test this first and check with the data owner that the documents are no longer needed.
If you are running Oracle database it is wise to include in technical clean up job as last step the online reorganization of tables or indexes using program RSANAORA. See blog.