Вы находитесь на странице: 1из 5

SAP Network Blog: Archiving IDoc https://weblogs.sdn.sap.

com/pub/wlg/9044

Blogs

Archiving IDoc Subscribe


Goutham B Print
Business Card
Permalink
Company: Infosys
Posted on Mar. 25, 2008 12:01 AM in ABAP

Archiving: Archiving involves Compressing & Transferring the data which is accessed less frequently, from the database to an external
storage device so that the data can be reused at a later date.
Need for archiving:
1. Archiving resolves memory space and performance problems caused by large volumes of transaction data.
2. Ensures that data growth remains moderate so that the database remains manageable in the long term.
Archiving IDoc’s: IDoc’s are stored in several database tables. To keep the access times small (to reduce the database load), without
losing any IDoc’s, we archive the IDoc’s at operating system level. These archives can then be moved to external storage media, such as
disks (using Archive Link) or magnetic tape.
How are the IDoc’s archived?
Two steps are involved in archiving the IDoc’s
• Firstly the IDoc’s are archived.
• Secondly, the IDoc’s in the database which are archived are deleted from the database.
This helps us in having data integrity. Unless until the archived files are verified with the files in the database, the files in database are not
deleted.
Data is usually archived via the central transaction SARA. In the case of IDoc’s, the corresponding tables are addressed via the ‘archiving
object IDoc’. Various processing methods are assigned to the archiving class IDOC’S.
The IDoc archiving tools were developed with the Archive Development Kit (ADK), which supports object-oriented programming methods.
This has led to the use of archiving object IDOC, which contains the necessary database tables and the archiving class IDOC, which has the
function modules required for processing. The archiving object IDOC is accessed "from outside" using reports which (indirectly) call the ADK
function modules. The selection parameters for these reports are configured in the variant maintenance function for the central archiving
transaction. The ADK function modules, in turn, use the function modules from archiving class IDOC to access the database tables.
Prerequisite:
Maintaining logical and physical path: Transaction code - FILE
1. To assign a logical name for the path, click on the ‘new entries’ button. Enter a name for file path and its short description.

2. To assign the physical path, select the logical name created, and double click on the ‘assignment of physical paths to logical path’ in the

1 of 5 3/26/2008 3:45 PM
SAP Network Blog: Archiving IDoc https://weblogs.sdn.sap.com/pub/wlg/9044

left side panel. And then click on ‘new entries’.

• Enter the syntax group that identifies the common syntax for a particular operating system.
• Enter the path where the files should be stored. For example, C:\TMP\<FILENAME>. The path name should end with reserved word
‘FILENAME’ as a place holder<FILENAME>.The physical path name is used by the function module FILE_GET_NAME at runtime to create a
complete platform specific filename.
Note: we can add many other keywords like <date>, <opsys>, <client> etc...The reserved words are replaced by their current values at
runtime. For example the <date> is replaced by date in sy-datum, <opsys> is replaced by operating system in call, and <client> is
replaced by client in sy-mandt.
3. After maintaining the logical path names, we should define the logical name.

Click on ‘new entries’ button and enter the file name.


Procedure for Archiving an IDoc:
• Search the IDoc’s (not only with the control or address information, but also with the data it contains) using transaction WE09.
• After searching the IDoc’s, we need to check the status of the IDoc’s we need to archive. Certain IDoc statuses are classified as archivable
in the standard system, while others are not. The current status of an IDoc must be archivable before the IDoc can be archived.
We can archive IDoc’s with status which facilitates archiving. For example, an idoc which was not processed yet cannot be archived. And
the idoc with the status code 53 (posted successfully) can be archived. So in order to archive an idoc we need to check the status of that
idoc.
There are two ways to archive an idoc
1. Through standard report programs or
2. Through the central archiving transaction SARA.

Through standard report programs:


The following are the programs used for archiving IDoc’s
RSEXARCA – program for archiving.
RSEXARCD – program for deleting archived IDoc’s from the database.
RSEXARCR – program to read the IDoc’s from archive file.
RSEXARCL – Program to Retrieve IDoc’s from the archive into the database.
To archive idoc using report program RSEXARCA:
This program helps to archive the data .After archiving successfully, we need to delete the data in the database.
This report program has the following important select options for selecting IDoc’s to archive.

2 of 5 3/26/2008 3:45 PM
SAP Network Blog: Archiving IDoc https://weblogs.sdn.sap.com/pub/wlg/9044

1. Time at which the control record was last changed


2. Time of IDoc creation
3. Current status
4. Logical message
5. Direction
6. IDoc number
7. Partner
The system displays the status after writing the archive file. After archiving use the program RSEXARCR to read the data of the archived file
(After reading the archived file a log is generated with the fields of control record) and then use program RSEXARCD to delete the IDoc’s
from the database.
To reload the archived IDoc’s into database:
To reload the archived IDoc’s into the system use program RSEXARCL.This program checks the client, preventing data to be loaded in the
wrong client. It also checks whether the idoc number that is being reloaded already exists in the database.
The IDoc’s reloaded into the database have status 35(for inbound) and 71 (for outbound IDoc’s) i.e. status as ‘reloaded’. So when we start
archiving again these IDoc’s are not archived. To archive these IDoc’s again we need to change the status of these IDoc’s.

Using the transaction SARA:


1. Enter the archiving object name (An archiving object name deals with related business data that is read from the database by a write
program and deleted by the associated delete program after the data has been successfully archived).

2. To customize the object, click on the ‘customizing’ button and enter the appropriate data.

3 of 5 3/26/2008 3:45 PM
SAP Network Blog: Archiving IDoc https://weblogs.sdn.sap.com/pub/wlg/9044

3. Click on ‘write’ to find the ‘archive administration screen’. Enter the variant name. The variant determines the parameters with which the
archiving program is to be started.
To create a variant: Enter a name for the variant, and choose Maintain. The program selection screen appears with available options and
selection criteria. Enter the desired values and choose Variant -> Attributes. You go to the variant attribute maintenance. Enter the
necessary data and save your entries.

3. Mention the spool parameters, the start time of archiving and execute.

4 of 5 3/26/2008 3:45 PM
SAP Network Blog: Archiving IDoc https://weblogs.sdn.sap.com/pub/wlg/9044

Goutham B is a Software Engineer working with Infosys.

Add to: del.icio.us | Digg | Reddit

Comment on this weblog

5 of 5 3/26/2008 3:45 PM

Вам также может понравиться