Step 3: Running Delete Programs

After closing the first archive file, Archive Administration creates a new archive file and continues with the write process. If the settings were made accordingly in archiving-object-specific Customizing (see Settings for the Delete Program), a delete program is started automatically in parallel for the previously created archive file, to read the data in the archive file and then delete it from the database. This procedure guarantees that only data that has been correctly saved in the archive file is deleted from the database.

You can also schedule the delete program manually, for example, so that you can save the archive files before deletion, or because the next available time window is not sufficiently long to also include deletion. The following scenario may also be a reason to manually schedule the delete program:

You create an archive file by starting a write program. The data records are written to an archive file, but the system terminates processing before the delete program starts to run. In this case you must delete the archived data manually in a separate step. See Deleting Archived Data from the Database.

If you do not carry out deletion until after the data has been stored, you can make a setting in Archiving Object-Specific Customizing so that the system will read archive files the from the storage system during deletion. In this way, you can detect errors in good time which might arise when transferring or saving the archive files in the storage system.

When the last archive file is closed, a delete program starts to run for this file. The graphic shows that several delete programs are running simultaneously for previously created archive files. Because, unlike the delete program, the write program does not generally carry out any transactions that change data in the transactions, the write program creates new archive files faster than they can be processed by the delete program. This decreases the total archiving runtime because the database is used more efficiently.

Delete jobs can usually also be scheduled outside Archive Administration (transaction SARA). This occurs directly in an external job scheduler or using program RSARCHD. For more information, see Scheduling Delete Jobs Outside Archive Administration.

Delete Run Followed by Event

After all archive files have been completely created for an archiving session, the Archive Development Kit (ADK) triggers the system event SAP_ARCHIVING_DELETE_FINISHED. By reacting to this system event, you have the option of scheduling archiving jobs automatically. This includes the rebuilding of indexes or input help, archive file backup before deletion, and so on. The event parameter is the number of the archive session.

To further automate the archiving process, you can transfer the archiving session number to function module ARCHIVE_GET_FILES_OF_SESSION. This determines, on a platform-independent basis, the names and paths of the archive files that were written in an archiving session.

You can define new jobs in transaction SM36. You maintain events in transaction SM62.

You can also have event-controlled delete runs started automatically. You can define the event that triggers the delete program in the group box Settings for the Delete Program in Archiving Object Specific Customizing.

See also:

Deleting Archived Data from the Database