Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

**Updated on 07/Dec/2020 for Custom Status**

Most of us already know that the ID based message search in SAP CPI is limited to Message ID or Correlation ID or Application ID. In this blog let us explore on using more Searchable Identifier(s).

While Message ID and Correlation ID are technical identifiers generated by CPI, we are left with just Application ID to set a process/functional identifier like Purchase Order Number, Sales Order Number, Customer Number, etc. This helps to search the MPL based on the business identifier for monitoring/troubleshooting.

However, in my SAP CPI journey, there were multiple instances where I had a need to have more than one ID to use for MPL search, for eg

  • Application ID set to Customer Number from IDOC, however, I also require a search based on IDOC number.

  • Application ID set to Order Number from message sent over message broker, however, I also require a search based on Message-ID from Message broker.

I achieved this use case by setting the additional ID as a Custom Header in MPL. Let us see in this blog on implementing it.


Let us see the implementation in a scenario where a DEBMAS IDoc is sent for Business Partner Replication. We would set BP Number as Application ID and IDoc Number as Custom Header. Then we see how to search MPL based on both these IDs.


Set Application ID

Use the Content Modifier step to set the below standard MPL headers.

SAP_Sender Header Constant Sender System Name
SAP_Receiver Header Constant Receiver System Name
SAP_MessageType Header Constant Message Type
SAP_ApplicationID Header XPath XPath to read the business identifier i.e. /DEBMAS07/IDOC/E1KNA1M/KUNNR
SAP_MessageProcessingLogCustomStatus Property Constant Custom Status

Also, extract the IDOC number into a header field.

IDOCNUM XPath XPath to IDoc number field i.e /DEBMAS07/IDOC/EDI_DC40/DOCNUM

Content Modifier

Set Custom Header

Use the groovy script to read the IDoc Number extracted in Content Modifier and set it as a Custom Header using addCustomHeaderProperty method of MessageLogFactory Interface.


def Message processData(Message message) {

def messageLog = messageLogFactory.getMessageLog(message);
if(messageLog != null){
//Read IDoc number from Header
def IDOCNUM = message.getHeaders().get("IDOCNUM");
//Set IDoc number as Custom Header
messageLog.addCustomHeaderProperty("IDOCNUM", IDOCNUM);
return message;

Message Processing Log

This is how the MPL is for a BP 1000000001 processed with IDoc 0000000123456789.

Standard MPL Headers

Search based on Application ID

This is a straight forward search in SAP CPI Message processing Monitor. A search for ID "1000000001" yields two messages processed for this BP.

Search based MPL Headers

Search based on Custom Header ID

The standard UI does not allow us to search message based on the Custom Header Identifier OOTB. Hence we will use MPL OData API to retrieve the Message ID.

https://{{cpi_tmn_host}}/itspaces/odata/api/v1/MessageProcessingLogCustomHeaderProperties?$filter=Na... eq 'IDOCNUM' and Value eq '0000000123456789'&$expand=Log&$format=json

Note: Custom Header is inserted as a Name/Value pair, hence the $filter parameter should be passed with the Custom Header Name and the value that we are searching for.

The API Call fetches the Message ID matching the custom header search condition. Use it in the standard Message Processing monitor to search and troubleshoot.


Use the Custom Header to Insert one or more searchable identifiers. However, use it wisely as any wrong usage can lead to a large MPL size on the tenant. I also hope that in a future update SAP will enable us to search messages based on Custom Header in the Monitor UI. Until then we could use the SuperEasy extension from fatih.pense.

Labels in this area