SAP CRM Data Archiving and Reloading - …dbmanagement.info/Books/MIX/SAP_CRM_Data_Archiving... · SAP CRM Data Archiving and Reloading Applies to: SAP CRM 2007 and above. For more
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
SAP CRM 2007 and above. For more information, visit the Customer Relationship Management homepage.
Summary
This article is based on a customer specific requirement which I have undertaken on a project. It describes a scenario where CRM data archiving and reloading can be achieved step-by-step.
Author: Nitin Gupta
Company: Tata Consultancy Services Ltd.
Created on: 14 June 2011
Author Bio
I’m Nitin Gupta, working with Tata Consultancy Services as CRM ABAP Developer. I have 3 years of experience in the domain of SAP CRM. I have undertaken projects for customers based in India.
Issues Related to Huge Data Volumes ............................................................................................................... 3
Benefits of Data Archiving .................................................................................................................................. 3
Steps in CRM Orders Archiving .......................................................................................................................... 3
Create ZARCH Function Group, a copy of ARCH Function Group ................................................................ 7 The Source Code of the Report for Reloading Orders is as: ........................................................................................ 7
Changes to be Performed at Various Places are as: .................................................................................... 13 Changes in Function Modules: ................................................................................................................................... 13
Changes in Include Programs:- .................................................................................................................................. 13
Assumptions and Limitations: ........................................................................................................................... 17
Related Content ................................................................................................................................................ 18
Disclaimer and Liability Notice .......................................................................................................................... 19
SAP CRM Data Archiving and Reloading
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
This document will give a structured view of how orders in CRM are archived and reloaded back into the database. The techniques explained here can be replicated to perform archiving and reloading of data corresponding to other CRM business objects with minor modifications. The business objects covered in this document correspond to sales, service, complaint and lead transactions.
Issues Related to Huge Data Volumes
Today even the most modern and technologically advanced database systems can suffer from performance bottlenecks caused by large data volumes. On the application side these bottlenecks manifest themselves in the form of poor system performance and on the administration side in the form of an increased use of resources. High data volumes can also have a considerable effect on the Total Cost of Ownership of a system, in spite of falling storage prices.
To avoid the negative effects of large data volumes on costs, performance and system availability, business complete data, which is data no longer needed in everyday business processes, should be removed from the database. However, simply deleting this data is not a useful option in most cases, because often times the data still needs to be available for read accesses. Therefore the data needs to be removed from the database and stored in such a way that it can still be read-accessed later.
Benefits of Data Archiving
Greater System Availability
Improved Performance and Response Times
Save Costs by Optimizing Your Available Resources
Steps in CRM Orders Archiving
1. Pre processing 2. Writing to archive file 3. Deletion from tables 4. Reading the archived data
Note : BASIS steps involved:- Separate file system needs to setup by Basis team:- Specifying Logical file name and file path File names and file paths can be client-specific (transaction FILE) or cross-client (transaction SF01). Logical file path is ARCHIVE_GLOBAL_PATH and logical file name is ARCHIVE_DATA_FILE Assign the Logical file name to Archiving object IDOC(AOBJ)
Archiving Objects:
Sales transaction : CRM_SALDOC
Service transaction : CRM_SERORD
Complaints : CRM_COMP
Lead : CRM_LEAD
Use the SARA transaction, select the archiving object and click on customising. Select technical settings in the pop up window.
SAP CRM Data Archiving and Reloading
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Save, go back. Maintain start date, time and spool parameters and Execute. This schedules a background job which can be seen by clicking on the ‘Job’ button.
Go back to the initial Archive administration screen and click on ‘Management’ button. The archive session would be generated in incomplete state.
Step 3: Deletion
Goto SARA (T-code) -> Enter the archiving object -> Click on Delete button.
In the Archive Selection select the archived package to be deleted. Maintain start date, time and spool parameters and Execute. This schedules a background job which can be seen by clicking on the ‘Job’ button.
Go back to the initial Archive administration screen and click on ‘Management’ button. The archive session would now be completed.
Step 4: Reading the Archived Data
To read the data first we have to activate the corresponding archive infostructure using the transaction SARI. Eg. For sales orders it is SAP_CRM_SALDOC.
After activation of the infostructure one can view the data from SARA (T-code) -> Enter the archiving object -> Click on Read button.
Also at any point in the archiving one can see the archived data using the transaction AS_AFB.
SAP CRM Data Archiving and Reloading
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Reloading your SAP data back into your database is risky and it should be avoided as preached by SAP itself. No standard report is provided by SAP for reloading. One has to create a report for reloading data corresponding to archiving objects. Following is the approach for reloading your data back to your database:-
Create ZARCH Function Group, a copy of ARCH Function Group
The Source Code of the Report for Reloading Orders is as:
The following variables are added in the Global data:-
data : lv_include3_iteration type int4 ,
lv_tab_index type sy-tabix .
CALSS : CLASS cl_session_admin DEFINITION ABSTRACT :-
Current_focus is initially read only, so remove the read only property :-
current_focus TYPE cl_class=>ty_object_class_specifier , "READ-ONLY,
INCLUDE: LZARCHF03:
Following is the source code of the implementation of the method get_record. The statements highlighted in ‘yellow’ color are added/changed in the code :-
METHOD get_record.
DATA:
ls_focus LIKE me->r_admin->current_focus,
l_caller TYPE string, " for error messages
ls_data_object LIKE LINE OF me->t_data_object,
* ls_data_object1 LIKE LINE OF me->r_admin,
l_working_index TYPE me->ty_index,
ls_conversion_info
TYPE LINE OF cl_nametab_admin_r=>ty_struc_id_conv_routines.
FIELD-SYMBOLS : <lv_tab_siz> type cl_data_container=>ty_content .
The statements highlighted in yellow are changed. ZARCH(function pool program name) is written in place of (ls_registered_class-progname), at various places, in the methods mentioned below :-
METHOD execute_put_methods.
IN PROGRAM ZARCH "(ls_registered_class-progname) "changes for reloading
METHOD execute_put_methods.
IN PROGRAM ZARCH "(ls_registered_class-progname) "changes for reloading
INCLUDE: LZARCHF05:
The statements highlighted in yellow are changed. ZARCH(function pool program name) is written in place of (ls_class_info-progname), at various places, in the methods mentioned below :-
METHOD initialize.
IN PROGRAM ZARCH " (ls_class_info-progname) "changes for reloading
Assumptions and Limitations:
A. A copy of the ARCH function group was used in this approach, but it can also be enhanced.
B. One of the short comings of SAP CRM data archiving is that data corresponding to ADRC and a couple of other address related tables is lost once deletion is done. This data is not archived. To overcome this the following approach was implemented :-
1. ZADRC, a copy of ADRC table is created. 2. At the time of archiving, in the pre-process report created, copy the data from ADRC to ZADRC
corresponding to the archiving objects. 3. Archive the ZADRC table using the z-tables archiving strategy. 4. While reloading, reload the ZADRC table and copy the data back to ADRC table.
SAP CRM Data Archiving and Reloading
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.