Insights · SAP Basis
Cleaning up technical tables: SAP housekeeping for production and copies
Application logs, IDocs, work items and other logs grow for years in many SAP systems without anyone needing them. In SAP HANA, this dead weight occupies main memory, in production and often in every copy too. This article explains which technical tables are typical, which standard reports and housekeeping jobs you can use to clean them up and where deleting is not enough.
Why technical SAP tables grow
Technical tables store what the system writes for communication, logging, administration and analysis: interface messages, logs, job logs, spool requests. After a short time, hardly anyone needs them for day-to-day business. However, they only disappear from the database if a job regularly deletes or archives them.
SAP has long described the problem in SAP Note 706478: Basis administration tables grow considerably if entries that are no longer needed are not regularly deleted or archived, or if the configuration is not correct. The note mentions application logs, IDocs, work items, change pointers and table logs, among others. SAP Note 2388483 provides a continuously maintained overview of tables, responsible areas, SAP Notes and clean-up methods.
In SAP HANA, this weighs more heavily than before. Less data there means less main memory, CPU and disk space. And because QA, test and sandbox systems are usually copies of production, each of them pays for the dead weight again. More on this on the page Reducing HANA memory in QA, test and sandbox.
Finding the largest tables
Measure before you clean up. Transaction DB02 shows the largest tables. For SAP HANA, the sizing report /SDF/HDB_SIZING also provides an overview (SAP Note 1872170). Compare the list with SAP Note 2388483: for each technical table, it lists the relevant SAP Notes and the clean-up method. SAP itself recommends this approach as a quick win, long before a full archiving project takes effect.
Look not only at the size but also at the age of the entries. An IDoc table with the messages of the last few weeks is normal. One with ten years of history shows that a job is missing or the retention period is wrong.
Typical candidates and how to clean them up
The following selection is based on SAP Notes 706478 and 2388483. Which tables stand out in your system depends on interfaces, workflows and custom developments.
| Area | Tables (selection) | Tool | Approach |
|---|---|---|---|
| Application log | BALHDR, BALDAT | SLG2 or report SBAL_DELETE, archiving via BC_SBAL | Delete after expiry date |
| IDocs | EDIDC, EDID4, EDIDS | Archiving object IDOC (SARA), WE11 (RSETESTD) deletes without archiving | Archive or delete after consultation |
| Workflow | SWWWIHEAD, SWWLOGHIST, SWWCNTP0 | Archiving object WORKITEM, RSWWWIDE not in production | Archive |
| Change pointers (ALE) | BDCP2, BDCP, BDCPS | Transaction BD22 | Delete processed and obsolete ones |
| Table logs | DBTABLOG | SCU3, report RSTBPDEL | Agree with internal audit |
| Change documents | CDHDR, CDPOS | Archiving objects of the application or CHANGEDOCU | Business-relevant, only after consultation |
| Spool | TSP01 | RSPO0041 or RSPO1041 | Delete after retention period |
| Background jobs | TBTCO, TBTCP | RSBTCDEL2 | Delete after retention period |
Setting up SAP Basis housekeeping jobs
Standard jobs take care of the basic clean-up. According to SAP Help, they should run regularly in every production system. The most important reorganisation jobs:
| Job | Report | Task |
|---|---|---|
SAP_REORG_JOBS | RSBTCDEL2 | deletes obsolete background jobs |
SAP_REORG_SPOOL | RSPO0041 | deletes obsolete spool data |
SAP_REORG_ABAPDUMPS | RSSNAPDL | deletes obsolete ABAP short dumps |
SAP_REORG_BATCHINPUT | RSBDCREO | deletes obsolete batch input sessions |
SAP_REORG_UPDATERECORDS | RSM13002 | deletes obsolete update requests |
SAP_REORG_JOBSTATISTIC | RSBPSTDE | deletes obsolete job runtime statistics data |
For spool requests, report RSPO1041 offers more selection options than RSPO0041 and is intended as its replacement (SAP Note 130978).
In SAP S/4HANA, the ‘Standard Jobs’ function in SM36 has been replaced for technical jobs. The technical job repository schedules them automatically. In transaction SJOBREPO, you can see which job definitions SAP delivers and schedules, and change or deactivate them within limits (SAP Note 2190119). Which jobs are included depends on the release.
So check three things in every system: do the jobs actually run, which retention periods do their variants use, and what is missing? The reorganisation jobs above concern Basis administration. For application logs, IDocs, work items and change pointers, check whether a job exists and, if not, schedule one with your own variant. Application logs, for example, are deleted by report SBAL_DELETE, which you can schedule in the background via SLG2. Only expired logs are deleted, unless a log has been released for deletion before expiry.
Delete, archive or coordinate
Not every technical table can simply be emptied. Three cases can be distinguished.
- Delete only: Spool requests, job logs, short dumps, old batch input sessions, processed change pointers and expired application logs lose their value after a retention period. The deletion reports are sufficient here. Define the retention period once, together with those who analyse errors.
- Archive: In production systems, you delete work items via archive administration with the archiving object
WORKITEM. ReportRSWWWIDEdeletes without archiving and, according to SAP, should not be used there. IDocs can serve as evidence of business transactions. You archive them via the objectIDOCafter defining inWE47which statuses can be archived. Application logs that have to be retained are archived viaBC_SBAL. - Coordinate with the business: Change documents (
CDHDR,CDPOS) record who changed which field and when. Applications write them for legal or technical reasons, and some have to be retained for a long time. They belong in the archiving concept, not in a housekeeping job. The same applies to table logs (DBTABLOG), which record changes to logged tables, especially in Customizing. Here, the business department and internal audit decide.
Clarify retention periods. How long data has to be retained is determined by law, contracts and internal requirements. Clarify this with the business department, internal audit and data protection before the first deletion run. This article is not a substitute for a legal review.
What housekeeping means for every copy
Whatever has been cleaned up in production no longer ends up in any copy. A system copy transfers the entire database, so every clean-up has an effect here. A client copy transfers the client-specific tables, including IDocs, work items, change pointers and change documents. Fewer entries there mean a shorter copy and a smaller target system.
How strongly data volume determines the runtime is shown in the article Speeding up an SAP client copy. The basics, from the transactions to the follow-up tasks, are covered in the article SAP client copy.
Housekeeping is not a substitute for archiving. It concerns technical data. Documents, postings and master data remain untouched. How to reduce the volume of application data for good is described in the article SAP archiving in S/4HANA.
Not copying dead weight in the first place
Housekeeping reduces the source. For the copy, there is a second lever: not transferring tables that nobody needs in the test system at all. The Data Refresh Operator excludes them using exception lists down to table level. DRO copies application data as a time slice, for example the last 90 days, plus all dependent objects from earlier years. The system measurement in the control system shows the database sizes of all connected systems and thus where cleaning up and excluding pays off. DRO runs on SAP S/4HANA from release 2023.
- –75%
- HANA RAM in non-production
- –60%
- Storage & backup
Guideline values from reference scenarios. The actual effects depend on system size, history and refresh cycles.
Would you like to hand over housekeeping as a clearly defined task, from setting up the jobs to monitoring the retention periods? We take care of this as part of our SAP Basis operations.
Sources
- SAP Note 706478: Preventing Basis tables from increasing considerably (SAP Support Portal, login required)
- SAP Note 2388483: How-To: Data Management for Technical Tables (SAP Support Portal, login required)
- SAP Community: Data Management for Technical Tables for SAP S/4HANA (SAP blog)
- SAP Help: Standard Jobs
- SAP Help: Deleting Logs (application log)
- SAP Help: Deleting Work Items (report RSWWWIDE)