Wednesday, September 5, 2018

Archiving transactions in SAP CRM

So you’ve filled your SAP CRM system with data and now GDPR requires you to start archiving that data. However, you have no idea how to archive data from your system. This blog gives you a little more insight into this subject.
First of all, you need to identify the data you want to archive. In case of GDPR you for example want to archive business partners. In order to do so, these business partners can no longer be a partner in any business transaction or iBase in your system. Archiving your business partners therefore requires you to archive these objects as well. In this blog the archiving process for business transactions is discussed. For ibases and business partners a similar procedure needs to be followed.


Archiving basics:

The SAP archiving process consists of 3 steps. First the data that needs archiving is (pre) selected, then the data is written to an archive file and finally the data is deleted from the database.

All these archiving steps are controlled from transaction SARA. Once opening this transaction, an archiving object is the first thing that needs to be chosen. The archiving object corresponds with the business transaction type you want to archive. If it’s not clear which archiving object can be used, check table ARCH_OBJ or use report CRM_ORDER_CHECK_STATUS.
Using the correct archiving objects ensures that all data belonging to a transaction is correctly archived. For example activities are archived using archiving object CRM_ACT_ON, while transactions with leading transaction type sales order are archived using object CRM_SALDOC. The tables and structures associated with the different archiving objects are maintained in transaction AOBJ. In case custom tables are added to business transactions, adding them to the archiving object ensures their inclusion into standard archiving, making sure no data is left after archiving a business transaction.

Customizing options

Once the correct archiving object is selected, it’s time to select it. The actions block will adjust to the steps applicable to the selected archiving objects. There are objects where preprocess does not apply, e.g. for archiving business partners. Press the button Customizing in the top bar to enter the customizing options for this archiving object.



For this blog archiving object CRM_ACT_ON (for Activities) is used. Other archiving objects have similar set-up options. Taking a look at the archiving object specific customizing, the following settings are made in the "Technical Settings" and "Check and Delete". Also the "Residence Times Transaction Types" needs to be specified.

Technical settings
In technical settings, make sure the default variants for test and live mode are available. First of all, select the logical file name (if it's not yet defined, look at Cross-Client File Names/Paths and discuss this with a SAP Basis consultant). Default variants are not available, so these need to be created before they can be used in the archiving job. Leave the other settings as they are.

Check and Delete
Now for the settings in Check and Delete. Notice there is a checkbox "Check Active" which indicates inclusion of the archiving object in the cross-archiving object archiving runs. Further on the use of this checkbox will be made clear. Then there are numbers to be filled for "Number of Calls Preselection Module", "Package Size Preselection Module", "Package Size Check Module"and "Resubmission Interval in Days". The first 2 fields indicate how many objects are selected in total during 1 cross archiving object archiving run. E.g. in case of 5 calls to the preselection module with a package size of the preselection module of 100.000, results in an archiving run covering 500.000 objects. Playing around with these package size allows determination of the optimal package size. The fourth field, the resubmission interval ensures the same objects are not checked every day. The preselection run checks whether a document can be archived. This means it has no follow up documents, it is in a final status (so completed or canceled) and it's been in the system longer than the specified residence time. The variant for the check job also needs to be created at this point.

Residence Times Transaction Types
For each transaction type, a residence type can be specified. Entering a residence time for a transaction type, ensures a transaction resides the system at least a certain amount of time.

Let's start archiving

Now the settings are made, it's time to start archiving. For this go back to the main interface of transaction SARA and click the button "Check/Delete".

Now click the "Check" button and follow the steps to plan a job. This archiving job processes all objects where "Check Active" is selected. Planning a job this way, ensures all necessary objects are processed. Also plan a  "Delete" job, to delete all archived transactions from the system.

Alternative job planning

It is possible to schedule preprocessing, write and delete jobs per object. The preprocess and write jobs are archiving object specific and can be checked in table ARCH_OBJ. Just create the necessary variant in je reports and schedule them. Be aware that this way the setting for "Number of Calls Preselection Module" is not taken into account and the preselection module is only called once.

The deletion of all objects can be performed using report RSARCHD. The archiving object for which documents can be deleted entered into a variant and also the number of parallel deletion processes can be defined.. The delete job will only delete documents from the database if they are included in an archive file (so the write step completed successfully). This ensures you can still retrieve your data from the archive files in case it's necessary. The archive files can be deleted from the file system once the data is no longer needed. Be aware that archiving data from your SAP CRM system doesn't remove the information from your reporting environment. To comply with GDPR you may need to scramble or delete some of the data from that system as well.