Skip to Content
Technical Articles
Author's profile photo Rajwin Singh Sood

SAP Archiving Step by Step Guide for Beginners

Topics to be covered

  • Introduction
  • Benefits
  • System Prerequisites
  • Archiving Process Flow
  • Accessing Archived data
  • Recall/Retention of archived data
  • Step by step scenario using Workflow work item

 

Introduction

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:-

SAP%20Archiving%20Objects

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.

Benefits

  • 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.

Archiving Prerequisites

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.

 

Assigned Tags

      23 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ratna Rajesh .P
      Ratna Rajesh .P

      Very nice blog

      Author's profile photo Vinayak Gatle
      Vinayak Gatle

      Step by step explanation, very good.

      Author's profile photo Venugopal Pallerla
      Venugopal Pallerla

      Good one, Rajwin!

      Author's profile photo Akshay Darmwal
      Akshay Darmwal

      Good one

      Author's profile photo Purva Solapurkar
      Purva Solapurkar

      Good one

      Author's profile photo Robert Ayvazzadeh
      Robert Ayvazzadeh

      How do you view archived Workflow items? We've archived a couple of items in our dev system. Using tcode SWW_ARCHIV I'm unable to display the archived items. I used SARI to view the archived Workflow items but it doesn't provide insight into what the workflow was attributed to, for example, a purchase order. I'd like to be able to view the referenced object, like the PO and see the archived workflow.

      Author's profile photo Rajwin Singh Sood
      Rajwin Singh Sood
      Blog Post Author

      Hi Robert,

      If my understanding is correct you are trying to say that on basis of PO number you want to see which workitems/workflow associated with it have been archived. I am afraid that's not provided in standard SAP report. for that you need to create your own report. In order to check for archived workitems you need to goto AOBJ transactions and select archiving object as WORKITEM and after selecting the same goto read programs you will find two program names RSWWARCP and RSWWARCR. these are two programs which will give you details about all those workitems which are archived. you need to copy these reports into Z reports and then do the tweaking of logic to check only those workitems which are related to corresponding work items.

      Author's profile photo Robert Ayvazzadeh
      Robert Ayvazzadeh

      If I understand your response, the only way to view archived workflow is via the Archive Explorer (Archive Information System) (RSWWARCP/RSWWARCR), unless we write our own display program.

      Looking at the table entries in the Archive Explorer, are you aware how to determine which table entry indicates the document number the workflow was tied to? I looked through the table entries and know that it's for a purchase order. However, I can't locate a valid purchase order number in any of the table entries.

      Author's profile photo Rajwin Singh Sood
      Rajwin Singh Sood
      Blog Post Author

      yes your understanding is correct. In order to determine wchih table entry indicates the document number the workflow is tied to you need to explore the program logics as I did this almost 5 years ago developed a custom report and don't remember the logic.

      Author's profile photo Roland Kramer
      Roland Kramer

      Hello Rajwin Singh Sood,

      See also the usage of the SAP IQ database together with the SAP Archiving Process.

      Blog - https://blogs.sap.com/2021/02/17/sap-ilm-store-based-on-sap-iq-database

      Best Regards Roland

      Author's profile photo Tikeer Guo
      Tikeer Guo

      Great blog about archiving.

      Author's profile photo Aruna Vijayakumaran
      Aruna Vijayakumaran

      Hello Rajwin Singh Sood,

      When I run the write job I encounter this error stating

      Jobs of type SUB cannot be released

      what does this possibly mean?

      Author's profile photo Sachinkumar Yadav
      Sachinkumar Yadav

      Very nice blog, but can you please help me to understand how to automate schedule of Read, write and delete steps ? Can we schedule them to run every month or we have to run each month manually ?

      Author's profile photo Crespo Gregorio
      Crespo Gregorio

      Hi, thanks for the explanation. We are making an Archiving for FI_DOCUMT and one of the WRITE jobs dumped because there was a general error in the system. What can We do? It's possible to restart the job or do we need to cancel all?

      Best Regards

       

      Author's profile photo Rajwin Singh Sood
      Rajwin Singh Sood
      Blog Post Author

      Yes you can restart the job again with the same variant.

      Author's profile photo Abhilash Pradhan
      Abhilash Pradhan

      Nice blog to understand archiving.

       

      I have a question, We want to archive deliveries and all associated documents along with it . We have checked individual objects and all are working. Is there a process where we can run all the archiving objects at once ?

      Similar for Sales order , we want to run a single program or tcode and archiving everything for the sales order, deliveries, shipment, GI , Invoices  . Is there something in standard for the same .

       

      Regards,

       

      Abhilash

      Author's profile photo Rajwin Singh Sood
      Rajwin Singh Sood
      Blog Post Author

      Yes Abhilash you can schedule the write and archive program for each together in a background job.

      Author's profile photo Nadir Baseggio
      Nadir Baseggio

      Great blog about archiving.

       

      Best Regards

      Author's profile photo Chris C
      Chris C

      Thanks Rajwin, very interesting blog.

      Author's profile photo Scott Kelson
      Scott Kelson

      Hello Rajwin,

      Thank you for your blog.  Excellent.

      Have you ever performed any Cost Estimates on the SAP Archiving process?  I am interested in helping a customer know how much it is going to cost them to do this.

      Thank you again.

       

      Author's profile photo Ngonidzashe Moyana
      Ngonidzashe Moyana

      Great blog about SAP Archiving, thank you.

      Author's profile photo Karsten Jeppesen
      Karsten Jeppesen

      Hi,

      Could you please elaborate on the consequence for a sap bw need to reload data, how to approach this?

       

      BR
      Karsten

      Author's profile photo Rajwin Singh Sood
      Rajwin Singh Sood
      Blog Post Author

      SAP BW has different database strategy as they have infocubes and data sources are getting updating periodically from SAP. Don't think so archived data needs to be recalled/reloaded.

      As mentioned the data is never to be recalled or reloaded. However due to some auditing purposes this needs to be done. This can be incorporated in transaction AOBJ and in that reload program needs to be incoprorated in some cases SAP provides it especially in case of change document archiving object CHANGEDOCU its already there(screenshot below).but in case you don't find it please ask the ABAPER to develop the customer program for reloading.