You are on page 1of 15

Archiving and Deleting XML Messages in PI

Step by step guide to Archiving and Deleting XML Messages in SAP PI

NETREY POWDWAL
26.04.2010

Contents
1 Document Control.........................................................................................................................3 2 Security Classification...................................................................................................................3 3 Target Audience............................................................................................................................3 4 Introduction:..................................................................................................................................5 5 Configuration:................................................................................................................................6 5.1 Global path for archiving files:.................................................................................................7 5.2 Assignment of physical path to logical path:...........................................................................7 5.3 Logical file name definition: cross client..................................................................................8 5.4 Archiving object-specific customizing:.....................................................................................8 5.5 Activation of archive infostructure: SAP_BC_XMB..................................................................9 5.6 Interfaces for archiving:...........................................................................................................9 5.7 Rentention periods:...............................................................................................................10 5.7.1 Asynchronous messages:..............................................................................................10 5.7.2 Synchronous messages:................................................................................................10 5.7.3 History Entries:...............................................................................................................10 5.8 Archive Job Scheduling:.......................................................................................................11 5.8.1 Viewing archived messages:..........................................................................................12 5.9 Delete Job Scheduling:.........................................................................................................13 5.10 Housekeeping Job ZBC_XMB_REFRESH_ADAPTER_STATUS:......................................14 6 Conclusion:.................................................................................................................................14 7 References:.................................................................................................................................14

3 (15)

1 Document Control
This document explains the concept of archiving and deleting XML messages in SAP PI system. The documentation covers the archiving and deleting procedure only at Integration Engine level (ABAP Stack).

Document Attributes Project name Document ID Area of Validity Responsible Storage Location SAP Process Integration Netrey Powdwal SAP AIMS

Document Control, revision history Date issued 26 Apr 2010 Version 1.0 Author ini. Netrey Powdwal Control ini. Approval ini. Reason for change Initial Version

2 Security Classification
TCS Internal.

3 Target Audience
SAP PI and BASIS consultants.

TCS Internal

4 (15) Related Documents

NA

TCS Internal

5 (15)

4 Introduction:
Problem statement: Tables that store the XML messages in PI are rapidly growing and you are running out of disk space. As a temporary measure, you increased the table space, but this is afterall a temporary solution. The disk space is limited and if you go on increasing the disk space like this then you will run out of the entire disk space soon and it will affect the performance of the system badly. It might also bring the entire PI system down and all message transfers will come to halt. The growing table space is a serious threat to the system and you need to quickly find a solution to clear the XML messages and reduce the disk space usage. Preparations: Before we start the configuration, its a good idea to note down the current status of the system. i.e. current table space comsumption so that we can compare the results after archiving and deleting to see the reduction in table space. For this, go to transaction SARA, enter the archiving object BC_XMB and click on Database Tables button. Select All Tables radio button and click on Space Statistics button to see the table space statistics. Note: As mentioed earlier, this document deals with messages at Integration Engine level only. It does not involve handling of messages at Java stack (Adapter Engine). The main tables that grow rapidly with growing traffic in PI are, SXMSPMAST: Integration Engine: Message Queue (Master) SXMSCLUR: XMB Resources Cluster SXMSCLUP: XMB Property Cluster

Go to transaction SE11 and open these tables and check the Number of Entries in each of these.

Program RSXMB_DEL_TO_ARCH: This is a very useful program. There are mainly 2 types of messages in PI; messages that are marked for archiving and those marked for deletion. By default, the message will be marked for deletion. We need to explicitly confiture interfaces so that those messages will be marked for archiving. This configuration needs to be done even before sending the very first message in PI. If this configuration is not done already then all messages in PI will be marked for deletion. We can use the program RSXMB_DEL_TO_ARCH to change the deletion flag of these message to archiving flag. Note that this action is irreversible. Field ITFACTION of the table SXMSPMAST stores the flag. We can check this table after executing the program to see if the flag has been updated properly. This program takes a great amount of time to execute depending on the amount of messages that are read as per input criteria. It is recommended to run this program in background. Also, enter the maximum

TCS Internal

6 (15) possible value in Maximum Runtime (s) parameter (E.g. 86,400 seconds). Do not forget to remove the Test Mode checkbox before executing.

5 Configuration:
Now we come to the actual configuration part. Follow the given path to reach the following screen. SPRO > SAP Reference IMG > Cross Applicaton Components > General Application Functions > Mass Data Archiving > Cross-Archiving Object Customizing Check if all the settings are as per shown in the screen below. Cross-Object Customizing Data Archiving: Details

TCS Internal

7 (15)

5.1 Global path for archiving files:


Now follow the below path to configure the archive file settings. SPRO > SAP Reference IMG > Cross Applicaton Components > General Application Functions > Mass Data Archiving > Create Logical File Path Here I have created a logical file path ARCHIVE_GLOBAL_PATH

5.2 Assignment of physical path to logical path:


Once we create a logical path, it has to be assigned to the physical path on the disk. Click on Assignment of Physical Paths to Logical Path. Mention the physical path as shown below. <FILENAME> is a placeholder which will contain the actual file name at runtime.

TCS Internal

8 (15)

5.3 Logical file name definition: cross client


Click on Logical File Name Definiton to specify the file name format for the archive file. I have created a file with the format <PARAM_1>_<PARAM_3>_<DATE>_<TIME>_<PARAM_2>.ARCHIVE. Here, PARAM_1, PARAM_2, PARAM_3, DATE and TIME are variables that will be populated at runtime. Including Date and Time in file name ensures the uniqueness of the file name.

5.4 Archiving object-specific customizing:


Follow the path SPRO > SAP Reference IMG > Cross Applicaton Components > General Application Functions > Mass Data Archiving > Archiving Object-Specific Customizing. Select archiving object BC_XMB and click on Details. Select the logical file name that we created in earlier step. Check all the settings are as per the screenshot below. Select the radio button Start Automatically under Delete Jobs. This will start the archive-delete job once the archive job is complete. I am using the naming convention archive-delete job here to avoid confusion with the delete job. Delete job deletes all messages which are marked for deletion whereas archive-delete job deletes messages which are marked for archive once they are archived by the archive job.

TCS Internal

9 (15)

5.5 Activation of archive infostructure: SAP_BC_XMB


Open transaction SARJ (or follow the path SARA > Information System > Customizing). Press F4. Select Archive Infostructure SAP_BC_XMB for archive object BC_XMB and click on Activate.

5.6 Interfaces for archiving:


Follow the path SXMB_ADM (t-code) > Define Interfaces for Archiving and Retention Periods. Mention all the interfaces for which you intend the archive the messages. Click on Multiple Selection > Select all required interfaces > Press F8. All interfaces will apprear under Interfaces to Be Archived. Messages of all interfaces that are excluded here will be marked for deletion. In future, if new interfaces are added to the system then entry has to be made here for archiving. Otherwise, those messages will also be marked for deletion by default.

TCS Internal

10 (15)

5.7 Rentention periods:


Once you are done adding all the interfaces to the list, click on Retention Periods button to jump to the following screen. Here you can mention the period for which the messages should be retained in database before they are archived or deleted. Below is the explanation of various parameters maintained in the screenshot below.
5.7.1 Asynchronous messages:

XML Messages Without Errors Awaiting Deletion: (1 Day) Messages which are older than a day and are maked for deletion will be deleted forever from the database tables. This will not affect the messages which are marked for archive. XML Messages Without Errors Awaiting Archiving: (30 Days) Messages which are older than 30 days and are marked for archive will be archived to a file and deleted from the database tables.
Synchronous messages:

5.7.2

XML Messages Without Errors Awaiting Deletion: (1 Day) Messages which are older than a day and are maked for deletion will be deleted forever from the database tables. XML Messages Without Errors Awaiting Archiving: (0 Days) Synchronouse messages which are successful will be deleted immediately.
History Entries:

5.7.3

History Entries for Deleted XML Messages: (30 Days) History entries are required for QoS Exactly Once. It is recommended to keep history entries at least for 7 days.

TCS Internal

11 (15)

5.8 Archive Job Scheduling:


Now we are ready to schedule the jobs. Go to transaction SXMB_ADM and select Schedule Archiving Job

Maintain Start Date and Spool Parameter and click on Schedule Archiving. Once the job is scheduled, click on Job Overview to see the job.

TCS Internal

12 (15)
5.8.1 Viewing archived messages:

Go to transaction SXMB_MONI and select Archived XML Messages (Seach Using Archive)

Select the archive file and press Enter. Note that if the File Status is shown as Delete Completed then archiving was done successfully.

You will see the messages which were archived.

TCS Internal

13 (15)

5.9 Delete Job Scheduling:


Go to transaction SXMB_ADM and select Schedule Delete Jobs. Select both the checkboxes, enter the start date, time and period (to schedule periodic job) and press F8. Click on Jobs button to see the scheduled delete job. Once the delete job is complete, you will be able to see the total number of records affected in the Job Log.

TCS Internal

14 (15)

5.10 Housekeeping Job ZBC_XMB_REFRESH_ADAPTER_STATUS:


Create a job with program SXMS_REFRESH_ADAPTER_STATUS and schedule it periodically to update status of successful messages. If you have receiver Idoc communication channels, sometimes the delivery status of the Idocs is not know to the PI system and the message status does not change to Final. These messages are excluded when the delete job runs. To avoid this, schedule this job, say weekly, to update the message status.

6 Conclusion:
Congratulations! You have successfully configured PI system to archive and delete messages. Now the next step is to verify the configuration. In the beginnig we had noted down the system status before archiving. Now same steps need to be performed to check the system status after archiving i.e. we will check the number of table entries of all critical tables mentioned above. This will ensure that the messages were actually archived and deleted and the setup was successful.

7 References:
http://sdn.sap.com/ http://service.sap.com/ http://wiki.sdn.sap.com/wiki/display/XI/PI+Archiving+Conceptual+Overview http://www.saptechnical.com/Tutorials/XI/Archiving/Index.htm http://help.sap.com/saphelp_nw04/helpdata/en/0e/80553b4d53273de10000000a114084/content.htm http://help.sap.com/saphelp_nwpi71/helpdata/EN/8d/3e4c11462a11d189000000e8323d3a/frameset.htm

TCS Internal

15 (15) SAP Notes: 1. 872388 Section 5 k 2. 2. 872388 Section 5 k 1. 3. 1042379 4. 789352 5. 1239882 6. 842187 7. 862423

TCS Internal

You might also like