You are on page 1of 15

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

Applies to:
SAP NetWeaver Process Integration 3.0 / 7.0 / 7.1.

Summary
This document explains the step by step procedure of archiving and deleting of XML messages in SAP NetWeaver Process Integration. The document covers the archiving and deleting procedure only at Integration Engine level (ABAP Stack). Author: Netrey R. Powdwal

Company: Tata Consultancy Services Created on: 27 August 2010

Author Bio
Netrey is SAP NetWeaver PI Consultant from Tata Consultancy Services. He has 4 years of experience in the industry with SAP ABAP and Process Integration expertise.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

Table of Contents
Introduction: ........................................................................................................................................................ 3 Configuration: ..................................................................................................................................................... 4 Global path for archiving files: ......................................................................................................................... 5 Assignment of physical path to logical path: ................................................................................................... 5 Logical file name definition: cross client .......................................................................................................... 6 Archiving object-specific customizing: ............................................................................................................ 6 Activation of archive infostructure: SAP_BC_XMB ......................................................................................... 7 Interfaces for archiving: ................................................................................................................................... 7 Rentention periods: ......................................................................................................................................... 8
Asynchronous messages: ............................................................................................................................................ 8 Synchronous messages: .............................................................................................................................................. 8 History Entries:............................................................................................................................................................. 8

Archive Job Scheduling:.................................................................................................................................. 9


Viewing archived messages:...................................................................................................................................... 10

Delete Job Scheduling: ................................................................................................................................. 11 Housekeeping Job ZBC_XMB_REFRESH_ADAPTER_STATUS: .............................................................. 12 Conclusion: ....................................................................................................................................................... 13 Related Content ................................................................................................................................................ 14 Disclaimer and Liability Notice .......................................................................................................................... 15

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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 possible value in Maximum Runtime (s) parameter (E.g. 86,400 seconds). Do not forget to remove the Test Mode checkbox before executing.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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.

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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.

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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. Asynchronous messages: XML Messages Without Errors Awaiting Deletion: (1 Day) Messages which are older than a day and are marked 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: XML Messages Without Errors Awaiting Deletion: (1 Day) Messages which are older than a day and are marked for deletion will be deleted forever from the database tables. XML Messages Without Errors Awaiting Archiving: (0 Days) Synchronous messages which are successful will be deleted immediately. History Entries: 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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 8

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 9

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 10

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 11

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 12

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

Conclusion:
Congratulations! You have successfully configured PI system to archive and delete XML messages. Now the next step is to verify the configuration. In the beginning 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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 13

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

Related Content
PI Archiving Conceptual Overview Wiki on SCN Archiving and Deletion in PI on SAPTechnichal Archiving and Deleting on SAPHelp Introduction to Data Archiving on SAPHelp SAP Notes: 872388 Section 5 k 2. 872388 Section 5 k 1. 1042379 789352 1239882 842187 862423

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 14

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 15

You might also like