Archiving SAP data and how to access it after the delete run
For a customer I needed to archive different types of data from the SAP system. This is not really difficult via the standard SAP transaction SARA and with the standard archiving objects. My question upfront was: how to access the data after the archiving delete run. So how do we get the SAP users to still see the data that was deleted from the database after the archiving. I learned that this is different per archiving object.
I will use two examples with different outcome:
- the archiving object FI_DOCUMNT
- the archiving object MM_ACCTIT
I’m a technical consultant and the steps below are from a technical point of view.
In this example we will use the file system to store our archiving files.Before we start with archiving we need to specify the archiving filename and archiving directory.
Destination folder and filename
Check tables in archiving object
Before we start archiving of course we need to decide together with the business what data to archive and what the retention times will be. In this example we will focus on the technical part of archiving.Check which tables are touched with a certain archiving object.SAP transaction DB15
For archiving we use SAP transaction SARA.
From a high level point of view the procedure is basically the same for FI_DOCUMNT and MM_ACCTIT:
- Write (the data to the archive files)
- Delete (the data from the database)
- Management (to see the status of the archiving)
The SAP transaction SARA for the archiving object FI_DOCUMNT looks like:So the first step is Write.Simply click on the Write button and the next steps are self explainatory. You have to create a variant in which you specify which data you want to archive. You have to specify a printer and a startdate.After this, background jobs are created and started.After this you can check the joblogs, spool files, files generated at operating system.Also check the SARA Management button to see the status.(status will be yellow because the delete run has not been done)The step after this is the Delete.Simply click on the Delete button and the next steps are self explainatory. You have to select the archive files from the previous step and this data will be deleted from the database.After this you can check the logs and check the SARA Management button to see the status.(status will be green)Specifically for the FI_DOCUMNT there is the step “PostProc” in SARA. So this one is not available for MM_ACCTIT.
View data from archive file after the delete run
So how can SAP users still see SAP data from within the SAP system?This differs per archiving object.Therefore in this example we have two archiving objects.FI_DOCUMNTSo the data is archived via SARA and is deleted from the database.The normal transaction that users perform does not show data unless we perform some actions.Create a secondary index via SAPF048S:SE38 > SAPF048SUse the Archive selection button to select the archived data.Uncheck Creation only Acc to RuntimeCheck Production ModeSAP transaction SARI (indexing and archive files)Click on “Customizing”Search for *FI_DOC* and choose SAP_FI_DOC_002And choose ActivateThis on itself is not yet enough, we need to perform a build using menu > Goto > buildAfter this the status in SARI looks good:Now we are done.And besides the fact that we can display the archived and deleted data via SAP transaction SARI we can also display it directly via FB03 or ALO1So after the SARA delete run, to make the data still available for SAP users via the original transactions, we have to:
- Create index via SAPF048S
- via SARI activate Archive Infostructure SAP_FI_DOC_002
- via SARI build Archive Infostructure
So for the data archived via FI_DOCUMNT we were able to have the data accessible via the original transactions. Unfortunately this is an exception. Normally data is only accessible via transaction SARI. We will see this with the data that is archived via MM_ACCTIT.
So the data is archived via SARA and is deleted from the database.
SAP transaction SARI (indexing the archive files)
Click on “Customizing”
Search for *ACCTIT* and choose SAP_MM_ACCTIT02
And choose Activate
This on itself is not yet enough, we need to perform a build using menu > Goto > build according to date
After this the status in SARI looks good:
Now we are done.
We can display the archived and deleted data via SAP transaction SARI > Archive Explorer.