Reloading is optional and should only be used in exceptional cases. The application must decide if a reload is necessary or not.
In the standard process, a reloading of archived data is not required, as archived data and direct access to individual data objects can be performed by using the Read API.
There are two cases which need to be distinguished:
-
Data must be reloaded shortly after deleting data from the database within the archiving process. An example for this case would be if selection criteria were set wrongly for the archiving process.
-
Reload of archived data after a long period of time. In this case it must be ensured that references to and within the reloaded data are still available in database. Furthermore, it needs to be guaranteed that no table key conflicts exist. Since this is not a real error, it's strongly recommended not to reload the data in this case.
The runtime to reload archived data from an external storage system back into the database should be implemented in a central ABAP class. This ABAP class has to register interface IF_ARCH_RELOAD to be able to be selected in an archiving object definition in ADT.
|
|
||
|---|---|---|
|
Method |
Parameter |
Description |
|
Returns an instance of the delete API. Reference to interface |
Importing: |
Name of the archiving object which will be used |
|
Importing: |
Sessions of the archiving object which will be used |
|
|
Importing: |
Reload program runs in test mode |
|
|
Returning: |
Instance of the reload API for further processing |
|
|
Read a data object from an archive file |
Importing: |
Range on dates on which archive files have been created |
|
Importing: |
Range on users which have created archive files |
|
|
Importing: |
Archiving object which will be used |
|
|
Returning: |
Archiving sessions' attributes |
|
|
|
||
|---|---|---|
|
Method |
Parameter |
Description |
|
Read records by structure from the current data object |
Importing: |
Name of a structure of all data records in the table |
|
Exporting: |
Table containing the data records |
|
|
Read data object from the archive file |
Exporting: |
Archive key according to archive management |
|
Exporting: |
Boolean values: TRUE (=’X’) FALSE (= ‘ ‘) |
|
|
Exporting: |
Sessions of the archiving object which will be used |
|
|
Exporting: |
Offset of data object in the archive |
|
|
|
|
|
|
Reloading the data of an internal table |
Importing: |
DDIC structure name of an internal table |
|
Tables: |
|
|
|
Open archive files will be closed |
|
|
A typical flow of the archiving reload process would be as follows:
-
Determine archiving sessions which are still available for reload by using the method
CL_ARCH_RELOAD_API=> GET_SESSIONS_TO_RELOAD, with filter options on creating user and creation date of the archive file. -
Create an instance of the reload API and open the archiving reload session for one of the selected archiving sessions by using the method
CL_ARCH_RELOAD_API=>GET_INSTANCE. -
Open the next data object via method
GET_NEXT_DATA_OBJECT. If the method returnsEV_END_OF_FILE = TRUE (‘X’), continue with step 6 to call the methodFINALIZE. -
Reload the data of the object from the external storage system back into your database tables, either by:
-
Use of the method
RELOAD_DATA_FOR_OBJECT -
Or use of the method
RELOAD_DATA_FOR_TABLE. This method needs to be called once for each table. -
Use of the method
GET_DATA_RECORDS. With this method, the result needs to be used to perform your ownINSERTstatements.
-
-
Continue with the next data object. See step 3.
-
Finish the archiving reload session by calling the method
FINALIZE.
An example coding snippet:
CONSTANTS: lc_object TYPE if_arch_api_types=>ty_object_name VALUE 'MY_OBJECT'. DATA: lv_test TYPE abap_bool VALUE abap_true, lt_data TYPE STANDARD TABLE OF my_header_table, lv_session TYPE sarch_session_number. " get newest complete archiving session DATA(lt_sessions) = cl_arch_reload_api=>get_sessions_to_reload( iv_archiving_object = lc_object ). SORT lt_sessions BY creation_date DESCENDING creation_time DESCENDING. READ TABLE lt_sessions ASSIGNING FIELD-SYMBOL(<ls_session>) INDEX 1. DATA(lo_reload) = cl_arch_reload_api=>get_instance ( iv_archiving_object = lc_object iv_archiving_session = lv_session iv_testmode = lv_test ). " read next data object from archive file into internal memory DO. lo_reload->get_next_data_object( IMPORTING ev_end_of_file = DATA(lv_end_of_file) ev_archive_key = DATA(lv_archive_key) ev_object_offset = DATA(lv_offset) ). IF lv_end_of_file = abap_true. EXIT. ENDIF. " optional: remove " read archived data for table ZADK_SFLIGHT lo_reload->get_data_records( EXPORTING iv_record_structure = 'MY_HEADER_TABLE' IMPORTING et_data_records = lt_data ). " reload the data into the data base lo_reload->reload_data_for_object( ). " optional: delete data from customer owned index DELETE FROM <my_index_table> WHERE archive_key = @lv_archive_key. ENDDO. COMMIT WORK. lo_reload->finalize( ).