SAP CRM Data Archiving and Reloading - …dbmanagement.info/Books/MIX/SAP_CRM_Data_Archiving... ·...
Transcript of SAP CRM Data Archiving and Reloading - …dbmanagement.info/Books/MIX/SAP_CRM_Data_Archiving... ·...
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 1
SAP CRM Data Archiving and
Reloading
Applies to:
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.
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
© 2011 SAP AG 2
Table of Contents
Introduction ......................................................................................................................................................... 3
Issues Related to Huge Data Volumes ............................................................................................................... 3
Benefits of Data Archiving .................................................................................................................................. 3
Steps in CRM Orders Archiving .......................................................................................................................... 3
Archiving Objects: ........................................................................................................................................... 3
Step 1: Pre Processing ................................................................................................................................... 5
Step 2: Writing to Archive File ......................................................................................................................... 5
Step 3: Deletion ............................................................................................................................................... 6
Step 4: Reading the Archived Data ................................................................................................................. 6
Reloading ............................................................................................................................................................ 7
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
© 2011 SAP AG 3
Introduction
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
© 2011 SAP AG 4
In the next screen select the logical file name and other options
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
© 2011 SAP AG 5
Step 1: Pre Processing
For CRM order archiving the pre processing step is vital. The Pre processing involves the following steps :-
Step 1: Identify the orders that are to be archived according to the business requirement.
Step 2: Fill the field ‘Verify_date’ of the order with a timestamp value (IMP: this field can never be left blank ).
Step 3: The statuses ‘Can be archived’ and ‘Can be deleted’ need to be set in CRM_JEST for the orders.
Use the function module ‘CRM_ARC_SET_STATUS’ for this purpose as :-
LS_GUID-OBJ_GUID = WA_CRMD_H-GUID.
LS_GUID-FLAG_ARCHIVABLE = 'X'.
APPEND LS_GUID TO IT_GUID.
CALL FUNCTION 'CRM_ARC_SET_STATUS'
TABLES
PT_OBJGUIDS = IT_GUID.
The selected orders are now ready to be written to archive file.
Step 2: Writing to Archive File
Goto SARA (T-code) -> Enter the archiving object -> Click on Write button.
Enter a Variant name and click on maintain.
Set the input values such as Transaction Type(s), Transaction Number(s), Changed at date range etc.
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
© 2011 SAP AG 6
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
© 2011 SAP AG 7
Reloading
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:
*************************** REPORT STARTS *****************************
************ declaration ********************************
tables: CRMD_ORDERADM_H.
TYPE-POOLS : VRM.
data: archive_handle like sy-tabix.
data: gv_is_crm type c, gv_commit type i, gc_commit type i value 300.
data: a_name like heada-arkey,
gv_cnt_del type i,
gv_cnt_read type i.
data: lv_data type ref to data .
FIELD-SYMBOLS : <FS_valu> TYPE ANY ,
<FS_LINE> TYPE ANY,
<FS_FIELD> TYPE ANY.
DATA: PARAM TYPE VRM_ID,
VALUES TYPE VRM_VALUES,
VALUE LIKE LINE OF VALUES.
data : gv_arch like arch_obj-object,
wa_crmd_header type CRMD_ORDERADM_H .
**********************************************************
******* selection screen ********************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*parameters: gv_arch like arch_obj-object default 'CRM_'.
PARAMETERS : OBJECT(10) AS LISTBOX VISIBLE LENGTH 10.
*parameters: testrun like boole-boole .
parameters: gv_objap like tbz1-objap no-display.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS : order_id like CRMD_ORDERADM_H-object_id .
SELECTION-SCREEN END OF BLOCK B2.
*********************************************************
AT SELECTION-SCREEN OUTPUT.
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
© 2011 SAP AG 8
PARAM = 'OBJECT'.
VALUE-KEY = 'CRM_SALDOC'.
VALUE-TEXT = 'CRM_SALDOC' .
APPEND VALUE TO VALUES.
VALUE-KEY = 'CRM_SERORD'.
VALUE-TEXT = 'CRM_SERORD' .
APPEND VALUE TO VALUES.
VALUE-KEY = 'CRM_COMP'.
VALUE-TEXT = 'CRM_COMP' .
APPEND VALUE TO VALUES.
VALUE-KEY = 'CRM_LEAD'.
VALUE-TEXT = 'CRM_LEAD' .
APPEND VALUE TO VALUES.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = PARAM
VALUES = VALUES.
******************* code starts ************************
START-OF-SELECTION .
gv_arch = object .
if order_id is not initial and OBJECT is not INITIAL .
perform get_customizing
using
gv_arch
changing
gv_commit
gv_is_crm.
perform reload_tables
using
a_name
gv_commit
gv_cnt_del
gv_cnt_read
gv_objap.
endif.
*&---------------------------------------------------------------------*
*& Form get_customizing
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PV_ARCH text
* -->PV_COMMIT text
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
© 2011 SAP AG 9
* -->PV_IS_CRM text
*----------------------------------------------------------------------*
form get_customizing
using pv_arch type OBJCT_TR01
changing pv_commit type i
pv_is_crm type c.
data: lT_CVERS TYPE CVERS OCCURS 5 WITH HEADER LINE.
call function 'ZARCHIVE_GET_CUSTOMIZING_DATA'
EXPORTING
object = pv_arch
IMPORTING
commit_count_for_delete_prg = pv_commit.
if pv_commit is initial.
pv_commit = gc_commit.
endif.
endform. "get_customizing
*&---------------------------------------------------------------------*
*& Form delete_tables
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PA_NAME text
* -->PV_COMMIT text
* -->PV_CNT_DEL text
* -->PV_CNT_READ text
* -->IV_BDT_OBJECT text
*----------------------------------------------------------------------*
form reload_tables
using pa_name type ARKEY
pv_commit type i
pv_cnt_del type i
pv_cnt_read type i
iv_bdt_object type bu_objap.
*------ lokale Daten ---------------------------------------------------
TABLES: ARC_BUFFER, FILENAME, FILEPATH, FILENAMECI.
data: archive_handle like sy-tabix, "Handle zu dieser Datei
lt_return like bus_return occurs 0 with header line,
lv_fatal_error type xflag,
lv_commit type i,
ls_return type bapiret2,
lv_record_ref TYPE REF TO DATA.
DATA: LIN1 TYPE I VALUE 0.
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
© 2011 SAP AG 10
DATA: LIN2 TYPE I VALUE 0.
DATA: LIN3 TYPE I VALUE 0.
data: lv_flag_found(1) type c.
data:BEGIN OF lt_temp_data OCCURS 0,
tab_name type ARC_BUFFER-RNAME,
tab_data TYPE REF TO data,
END OF lt_temp_data.
data: it_temp_data like TABLE OF lt_temp_data,
wa_temp_data like LINE OF it_temp_data,
lv_tab_name type ARC_BUFFER-RNAME,
lv_tab_data TYPE REF TO data .
*------ Code -----------------------------------------------------------
pv_cnt_del = 0.
pv_cnt_read = 0.
lv_commit = 0.
*------ Zeitpunkt ARCH4 ------------------------------------------------
*------ Archivdatei für Löschen öffnen ---------------------------------
* call function 'ARCHIVE_OPEN_FOR_READ'
* EXPORTING
* object = gv_arch
* test_mode = testrun
* IMPORTING
* archive_handle = archive_handle
* EXCEPTIONS
* no_files_available = 1.
CALL FUNCTION 'ZARCHIVE_OPEN_FOR_READ'
EXPORTING
* ARCHIVE_DOCUMENT = '000000'
* ARCHIVE_NAME = ' '
OBJECT = gv_arch
* MAINTAIN_INDEX = ' '
IMPORTING
ARCHIVE_HANDLE = archive_handle
* TABLES
* ARCHIVE_FILES =
* SELECTED_FILES =
EXCEPTIONS
FILE_ALREADY_OPEN = 1
FILE_IO_ERROR = 2
INTERNAL_ERROR = 3
NO_FILES_AVAILABLE = 4
OBJECT_NOT_FOUND = 5
OPEN_ERROR = 6
NOT_AUTHORIZED = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
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
© 2011 SAP AG 11
ENDIF.
call function 'ZARCHIVE_GET_INFORMATION'
EXPORTING
archive_handle = archive_handle
IMPORTING
archive_name = pa_name.
do.
call function 'ZARCHIVE_GET_NEXT_OBJECT'
EXPORTING
archive_handle = archive_handle
EXCEPTIONS
end_of_file = 01.
if sy-subrc <> 0.
exit.
endif.
add 1 to lv_commit.
add 1 to pv_cnt_read.
* lv_flag_found = 0 .
do.
CALL FUNCTION 'ZARCHIVE_GET_NEXT_RECORD'
EXPORTING
ARCHIVE_HANDLE = archive_handle
IMPORTING
* RECORD = ARC_BUFFER-SEGMENT
RECORD_REF = lv_data
RECORD_STRUCTURE = ARC_BUFFER-RNAME
EXCEPTIONS
END_OF_OBJECT = 1.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
lv_flag_found = 0 .
exit.
ENDIF.
if ARC_BUFFER-RNAME <> 'CRMD_ORDERADM_H' and lv_flag_found <> 1 .
wa_temp_data-tab_name = ARC_BUFFER-RNAME .
wa_temp_data-tab_data = lv_data .
append wa_temp_data to it_temp_data .
elseif ARC_BUFFER-RNAME = 'CRMD_ORDERADM_H' .
ASSIGN lv_data->* TO <FS_VALU> .
wa_crmd_header = <FS_VALU> .
if wa_crmd_header-object_id = order_id.
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
© 2011 SAP AG 12
lv_flag_found = 1 .
loop at it_temp_data into wa_temp_data .
lv_tab_name = wa_temp_data-tab_name .
lv_tab_data = wa_temp_data-tab_data .
ASSIGN lv_tab_data->* TO <FS_LINE> .
insert into (lv_tab_name) values <FS_LINE> .
endloop.
CLEAR wa_temp_data .
REFRESH it_temp_data .
ASSIGN lv_data->* TO <FS_LINE> .
insert into (ARC_BUFFER-RNAME) values <FS_LINE> .
else.
CLEAR wa_temp_data .
REFRESH it_temp_data .
lv_flag_found = 0 .
exit.
endif.
elseif ARC_BUFFER-RNAME <> 'CRMD_ORDERADM_H' and lv_flag_found = 1 .
ASSIGN lv_data->* TO <FS_LINE> .
insert into (ARC_BUFFER-RNAME) values <FS_LINE> .
endif.
enddo.
if lv_flag_found = 0 .
exit.
endif.
enddo.
call function 'ZARCHIVE_CLOSE_FILE'
EXPORTING
archive_handle = archive_handle.
endform. "reload_tables
******************* REPORT ENDS *****************************
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
© 2011 SAP AG 13
Changes to be Performed at Various Places are as:
Changes in Function Modules:
FUNCTION ZARCHIVE_GET_NEXT_OBJECT.
The following statement is added immediately after data declaration :-
lv_include3_iteration = 0 . " for next order
FUNCTION ZARCHIVE_CLOSE_FILE.
Following lines commented :-
* IF lr_admin->current_focus-is_object = gc_boolean_true. " changed from <> to =
* error_handling_with_msg
* wrong_access_to_archive '275' 'ARCHIVE_CLOSE_FILE'
* lr_admin->current_focus-class space space.
* ENDIF.
Changes in Include Programs:-
INCLUDE: LZARCHTOP:
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 .
CLEAR:
pr_record, ps_flags, p_length, p_index, p_structure, p_alias.
ls_focus = me->r_admin->current_focus.
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
© 2011 SAP AG 14
IF ls_focus-is_object = gc_boolean_true.
l_caller = me->r_admin->current_object.
ELSE.
l_caller = ls_focus-class.
ENDIF.
READ TABLE me->t_data_object INTO ls_data_object
WITH TABLE KEY s_owner = ls_focus is_meta = gc_boolean_false.
IF NOT sy-subrc IS INITIAL.
MESSAGE e260 WITH l_caller
RAISING end_of_object.
ENDIF.
ASSIGN ls_data_object-R_CONTAINER->* to <lv_tab_siz> .
DESCRIBE TABLE <lv_tab_siz> .
if sy-tfill = ls_data_object-index .
READ TABLE me->t_data_object INTO ls_data_object
WITH KEY s_owner = 'FADDRESS' .
ls_data_object-index = 1 .
MODIFY TABLE me->t_data_object FROM ls_data_object
TRANSPORTING index.
READ TABLE me->t_data_object INTO ls_data_object
WITH KEY is_meta = gc_boolean_false index = '1-'.
IF NOT sy-subrc IS INITIAL.
MESSAGE e260 WITH l_caller
RAISING end_of_object.
ENDIF.
ls_focus = ls_data_object-s_owner .
me->r_admin->current_focus = ls_focus .
endif.
**************code for ibases ***************
if l_caller = 'CRM_IBASE' .
if sy-tfill = 0 .
ls_data_object-index = 1 .
MODIFY TABLE me->t_data_object FROM ls_data_object
TRANSPORTING index.
READ TABLE me->t_data_object INTO ls_data_object
WITH KEY s_owner = 'FADDRESS' .
ls_data_object-index = 1 .
MODIFY TABLE me->t_data_object FROM ls_data_object
TRANSPORTING index.
READ TABLE me->t_data_object INTO ls_data_object
WITH KEY is_meta = gc_boolean_false index = '1-'.
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
© 2011 SAP AG 15
IF NOT sy-subrc IS INITIAL.
MESSAGE e260 WITH l_caller
RAISING end_of_object.
ENDIF.
ls_focus = ls_data_object-s_owner .
me->r_admin->current_focus = ls_focus .
endif.
endif.
************************************************
IF ls_data_object-is_unwrapped = gc_boolean_false.
lv_include3_iteration = 0 . " nitin
me->unwrap_container(
ps_owner = ls_focus p_is_meta = gc_boolean_false ).
READ TABLE me->t_data_object INTO ls_data_object
WITH TABLE KEY s_owner = ls_focus is_meta = gc_boolean_false.
ENDIF.
" determine which entry to read in data container
IF p_req_index IS SUPPLIED.
l_working_index = p_req_index.
ELSE.
" no index given, therefore read next entry
IF ls_data_object-index = me->c_index_undefined.
l_working_index = 1.
ELSEIF ls_data_object-index = me->c_index_end_of_object.
MESSAGE e260 WITH l_caller
RAISING end_of_object.
ELSE.
l_working_index = ls_data_object-index + 1.
ENDIF.
ENDIF.
DO.
CALL METHOD me->read_record_information
EXPORTING
p_container_type = ls_data_object-container_type
pr_container = ls_data_object-r_container
p_index = l_working_index
IMPORTING
p_structure = p_structure
p_alias = p_alias
ps_flags = ps_flags
EXCEPTIONS
no_record = 1.
IF NOT sy-subrc IS INITIAL.
IF p_update_curr_index = gc_boolean_true.
ls_data_object-index = me->c_index_end_of_object.
MODIFY TABLE me->t_data_object FROM ls_data_object
TRANSPORTING index.
ENDIF.
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
© 2011 SAP AG 16
MESSAGE e260 WITH l_caller
RAISING end_of_object.
ENDIF.
" check whether the structure still exists in DDIC
READ TABLE me->r_conversion_info->* INTO ls_conversion_info
WITH KEY s_struc_id-struc_name = p_structure.
IF NOT sy-subrc IS INITIAL.
MESSAGE e261 WITH p_structure
RAISING structure_without_nametab.
ENDIF.
IF ls_conversion_info-s_struc_id-add_id
<> cl_nametab_admin_r=>c_structure_does_not_exist.
EXIT.
ENDIF.
" this structure does not exist in DDIC anymore.
" let's pretend it's not in the data container
ADD 1 TO l_working_index.
ENDDO.
IF p_req_structure IS NOT INITIAL
AND p_structure <> p_req_structure.
MESSAGE e292 WITH p_req_structure
RAISING end_of_level.
ENDIF.
IF p_update_curr_index = gc_boolean_true.
ls_data_object-index = l_working_index.
MODIFY TABLE me->t_data_object FROM ls_data_object
TRANSPORTING index.
ENDIF.
p_index = l_working_index.
IF NOT pr_record IS REQUESTED.
" the record itself is not requested,
" PR_RECORD, P_LENGTH will not be supplied
RETURN.
ENDIF.
CALL METHOD me->read_record
EXPORTING
p_container_type = ls_data_object-container_type
pr_container = ls_data_object-r_container
p_index = l_working_index
p_structure = p_structure
p_convert = p_convert
IMPORTING
pr_record = pr_record
p_length = p_length.
RETURN.
ENDMETHOD. " get_record
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
© 2011 SAP AG 17
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
© 2011 SAP AG 18
Related Content
Data Archiving in SAP CRM
Data Archiving in CRM: a Brief Overview
Archiving Your SAP Data - SAP PRESS
For more information, visit the Customer Relationship Management homepage
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
© 2011 SAP AG 19
Disclaimer and Liability Notice
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.