SAP Archiving Step by Step Guide for Beginners
Topics to be covered
- System Prerequisites
- Archiving Process Flow
- Accessing Archived data
- Recall/Retention of archived data
- Step by step scenario using Workflow work item
Data Archiving is the process where in, huge volume of data is deleted from the system which has not been used for a long time. SAP recommends this process of data archiving to clean up the SAP standard tables, to improve the system performance and usability which yield to shorter response time. Most of the symptoms of system performance which will be encountered by administrators will be constant system dumps related to standard SAP transactions/programs resulting in time out/ TSV_TNEW_PAGE_ALLOC_FAILED memory allocation failed asking primarily to increase the system buffer memory.
Some of standard commonly used SAP standard objects for archival process:-
Another important transaction before we actually proceed further with archiving activity is table analysis transaction TAANA which helps the consultant to get the overall picture of table size in the system. This will assist consultant in taking decision to process archiving for which particular SAP standard objects.
- Cost reduction in terms of memory, hardware/disk and administration.
- Ensures cost efficient system upgrades and migration.
- Improved System performance due to shorter response time.
Reduction in the cost of maintenance and run of growing application infrastructure.
These are Prerequisites steps(system settings) for systems where archiving is to be executed for first time or where for some reason archiving was discontinued.
Archiving Process Flow
Step 1 – Pre processing : Deletion indicators will be set in this step,Applicable for some objects
Step 2 – Write:Records chosen for Archiving will be written in Archiving file system in Unix server (Path: /Volumes/Archiving/<Object name>/…),Applicable for all objects
Step 3 – Delete:- Written records will be deleted.Applicable for all objects. ensure that the Archiving file system back up is taken for written records, at least 2 days gap to be maintained before performing Delete step.
Step 4 – Post processing:-For deleting secondary indexes in FI_DOCUMNT and movement data in QM_CONTROL.
Access of Archived Data
This stage comes into the picture when the data is already deleted. But why we need this stage when we know that this is redundant data. The answer is no data is redundant as most of the time historical transaction data needs to be seen for Audit purposes or in some cases where we need to track down historical data to find out root cause analysis under circumstantial scenarios. In order to achieve this we need to go for creation and activation of Info structures. Infrastructures are nothing but data dictionary custom table which will be created and will be populated automatically after the deletion step of archival process is completed. Steps to do so are covered in next step and we will be covering the same as well in the step by step scenario as well. Step by step approach is covered in the blog https://blogs.sap.com/2014/10/16/infostructures-in-sap-sd-configuration-and-working/
Recall/retention of archived object
Yes archived SAP objects could be recalled/retained. Why we need it again this could be auditing requirement/some urgent circumstances wherein historical data needs to be recovered for some exigency in business process. One of the example is for CHANGEDOCU where the reload button is activated in order to retrieve the same:-
Please note that reload/recall/retention of archived data should be done only in emergency as it could cause inconsistency too in current system. The important step/check to enable reload functionality is to check whether there are read programs associated with it or no and archive selection is active or no. In order to check we need to go to AOBJ transaction and enter the archiving object and then double click:-
Step by step scenario using Workflow work item
We will be considering here work items for our hands on scenario.
First step we will activating the info structure so that data which will be archived will be saved in info structure. There are many standard info structures for work items like SAP_BO_2_WI_001, SAP_O_2_WI_001 and SAP_WORKITEM001. For our demo purpose we will be using SAP_O_2_WI_001 for our Demo purpose. Use transaction SARJ to activate the same:-
After activating the same goto display button and click on technical detail wherein you’ll find the activated Z info structure table and a report program(which reads the archived and deleted work item data from the info structure table) as well:-
Now in order to read already archived data either we can execute the report program or there are already standard read programs use transaction AOBJ and click on position button and in the pop up add the archiving object WORKITEM select the same and double click on read programs which shows two read programs which we will use after we finish our archiving activity:-
Now lets proceed with the archive process. Please note specifically for WORKITEM, You can only archive those work items that have one of the following statuses: • Completed • Logically deleted (CANCELLED) So work items in the date range of your archiving job that are still running will not be touched. If the parent work item is in status “In Process” all child work items will remain in the system and will not be archived even if they are completed. The whole workflow must be in status Completed or Logically Deleted for it to be archived. Now lets search for work items using transaction SWI1. We will try to pick only those who have status as completed or logically deleted and data range of 1 month ago:-
After we executed the transaction swi1 we will find some entries( 151 entries which are logically deleted completed). So now the thinking is that after we execute archive process all 151 will be deleted. Answer is no if you might have heard during our previous slide presentation not all of them will be deleted reason being these are just the workitems belonging to the workflow. If the workflow is in error or still under progress they won’t be considered for deletion/archiving.
Now lets begin our quest of archiving workitems. Enter transaction SARA and in that enter WORKITEM as archiving object so you have four options. As far as preprocessing step is concerned we have already identified in our previous slide the items so now the first step is Write which will be actually write the workitems(completed/logically deleted) into archive file. Lets execute that. Create the variant as Z_test and then click on start date and add as immediate and add the printer in spool parameters.
After setting the spool parameter we need to set the variant Z_TEST to pick up workitems for the past 30 days. Click on edit button next to variant Z_TEST which will raise a pop up to have the individual selection screen or for all selection screen. Select for all selection screen and then the screen will appear wherein it will ask for workitem creation date enter the date ranges for one month and save the variant and execute to trigger the write job which will show the spool of list of (39)items marked for deletion/archiving.
Now write activity is done. If you check the job log and job spool you’ll find that total of 39 Witems were selected. Complete details are there in the job spool. Next step is delete which will actually delete all these workitems from the system and move it into infostructures. Now click on delete option in SARA you will notice that both the start and spool parameters are set please save them and click on archive selection to select the workitems written in previous step to proceed further with deletion and execute to trigger the deletion job.
once you click on archive selection button it will take you to the screen which will display the file containing the archive items which were written in our write step
After executing the delete activity the deletion job is triggered which will actually delete all the workitems which we have written in archive file from the system at database level. After this please goto SM37 and check for job status for delete jobs.
Finally we have removed the redundant workitems in the system. But how do we check that, if you remember we did preprocessing step of SWi1 to fetch the workitems. Now if you recheck it you will see that the items have reduced from 151 to 28. And also the first step of activating the infostructures which in turn generated the table. Please check that table using SE16 you will see lots of entries in that. Hence we have successfully executed the archiving. Now this activity can be periodic as well where in we need to change the date as periodic job.
Now if you remember we have activated the infostructure which we have Z table created which contains the entries of work items which are deleted.
Now as far as third step read is concerned this is nothing but the call of read program which will pick the already deleted workitems from the infostructures. In our previous slides I have already showed you how to check whether there are any read programs associated with the SAP archiving object using transaction AOBJ. Now the read step will take you there and will ask you to execute the read program. Please note that the selection parameters you need to pick it up from the info structure Z table.
Now this is final step management part. Basically this will show the summary of the archiving activity which we executed.
Purpose of this blog post was to provide an insight to the Archiving process within SAP framework. This was also to provide step by step guide to the consultants who have been assigned the archiving activity in their project and are new to SAP archiving. Please let me know in case anybody needs more assistance by commenting on the blog, I’ll be very happy to help.