Tuesday, 11 November 2025

SAP CPI : Content Modifier – Message Header

Introduction

In this second part of the CPI Basics series, we will focus on one of the most used steps in an iFlow: the Content Modifier.

The Content Modifier allows us to enrich and control the message as it passes through CPI. In this document, we will specifically explore the Message Header function:

Message Header → used to pass dynamic values to external systems. For example, extracting a value from the incoming payload and using it in an OData query filter.

To make this exploration practical, we will implement a simple integration scenario:

The SOAP Sender Adapter will be used as the entry point of the message, simulating an external system sending a request to CPI.

The OData Request Reply Adapter will be used as the target system, where the message header will be applied in the query filter to fetch data.

By the end of this document, you will clearly see how a Message Header can influence the request and response payload in a real integration flow.


1. Create IFlow

Step 1: Create a New Integration Flow

Open your CPI tenant → Design → Create new iFlow.






Give IFlow name and description
 





Step 2: Add Sender (SOAP Adapter)

The SOAP adapter is used when the source system communicates using
the SOAP protocol. It is common in SAP environments and in integrations with legacy systems that expose SOAP-based web services.

Benefits:
Widely supported in SAP and non-SAP systems.
Well-suited for structured XML messages.
Supports secure communication (HTTPS, certificates, WS-Security).

Constraints:
Limited to SOAP/XML format (no native JSON).
Payloads can be verbose and less flexible compared to REST/OData.
Transformation may be required if the target system expects a different structure.

Configuration steps:
1. In your iFlow, drag the Sender element from the palette to the canvas.






Choose SOAP 1x



2. Configure the SOAP Adapter:
o Open tab Connection and set the endpoint name (e.g.,/ContentModifier).
o Message Exchange Pattern: Request-Reply mean a synchronous pattern where the sender sends a request and waits for the response before continuing.




Step 3: Add Content Modifier
The Content Modifier is used to set or change values in the message during processing. It provides three functions: Message Header, Message Properties, and Message Body. This time we will focus on Message Header.

Configuration steps:
1. In your iFlow, drag the Content Modifier step between the SOAP Sender and the
Request Reply.







2. Double-click the Content Modifier and configure:
Message Header
Add a new header, for example:
o Name: OrderNo
o Source Type: xpath (XPath is A query language to navigate XML documents).
o Source Value: //in (‘//’ known as relative path, meaning it will search for the element <in> anywhere in the XML, not from the root).
o Data Type: java.lang.String (The Java data type for text, used here to store the extracted value as a string)
So  in  this  Message  Header,  you’re  basically  telling  CPI: “Look into the incoming XML, find <in>, take its value as text, and store it in a header named OrderNo.”
This header will be passed to the OData adapter and used in the query filter.






Step 4: Add Receiver (OData Request Reply Adapter)
The OData Request Reply Adapter is used to connect CPI with an external system that exposes OData services. In this step, we will send a request with the header value (OrderNo) as a filter and get the response payload back.
Benefits:
Standard protocol widely used in SAP and non-SAP systems.
Supports querying, filtering, and CRUD operations.
Integrates easily with SAP systems like SuccessFactors, S/4HANA, or SAP Gateway.
Constraints:
Requires a valid OData service endpoint.
Query options must match the service metadata; otherwise, requests fail.
Limited for complex business logic (might require multiple calls).

Configuration steps:
1. In your iFlow, go to external call and drag a Request Reply step after the Content Modifier.





2. Drag a line from the Request Reply to a new Receiver.




3. Select OData Adapter for the Receiver connection, choose OData V2.


4. Configure the adapter:

-         Address: https://services.odata.org/V2/Northwind/Northwind.svc (Provide the OData service endpoint)





- Click tab Processing, and then click select button




- Click button Step 2


- Click search button at field Select Entity and chose Orders.


- Click Select All Fields



- Click Step 3




Click search help at field Filter By and choose OrderID



-         Choose Equal and Write ${header.OrderNo}

A screenshot of a computer  AI-generated content may be incorrect.


Click Finish button


- Save and deploy the iFlow





Step 5: Check Deployment Result

After deploying the iFlow, you need to make sure it runs without errors.
Steps:
1. Go to Monitor → Manage Integration Content in your CPI tenant.


2. Find your iFlow (e.g., Z_IF_CONTENT_MODIFIER).


3. Verify the status:
o Started → The iFlow is running successfully and ready to process messages.
o Failed/Stopped → Open the log to review error details (e.g., adapter configuration, authentication).
4. If the status is not Started, fix the error and redeploy.



2. Subscribe Process Integration Runtime
Before testing the iFlow, ensure that a Process Integration Runtime is available in your subaccount.
Steps:
1. Go to your SAP BTP Cockpit → Subaccount.
2. Navigate to Instances and Subscriptions.
3. Choose Process Integration Runtime and click Create button.



4. Choose integration-flow for field Plan



5. Input instance name (e.g., Z_LEARN_CPI) and click Create.


6. Confirm and wait until the instance is provisioned.


3. Create Service Key
To enable external tools to call your iFlow, create a Service Key for the Process Integration Runtime instance.
Steps:
1. In BTP Cockpit, go to your Subaccount → Instances and Subscriptions.
2. Select your Process Integration Runtime instance.

3. Go to the Service Keys tab and click Create button.



4. Give service key name (e.g., Z_CPI_ACCESS_KEY) and click Create button.


5. The system will generate a JSON object containing authentication details (Client ID, Client Secret, Token URL, etc.).



6. We will use clientid and clientsecret for authentication when testing the iFlow.




4. Test the iFlow via SOAP UI
Now that the iFlow is deployed and started, we can test it using SOAP UI.





Steps:
1. Download WSDL from the iFlow
o In CPI, go to Monitor → Manage Integration Content.


o Select your iFlow (Z_IF_CONTENT_MODIFIER) and Under Endpoints, click on the button download for WSDL without policies.




2. Import WSDL into SOAP UI
In SOAP UI, create a new SOAP Project.



Browse and select the WSDL file you just downloaded.



SOAP UI will generate the correct request structure for the iFlow.



3. Prepare the SOAP Request
In the generated request, add the <in> value (e.g., <in>10248</in>).


4. Add Authentication
Click Auth button


Under Authentication, choose Basic Authentication.




Enter clientid from service key for username and clientsecret for password.



See the response payload as the result


We also can check the message from Monitor Message Processing



No comments:

Post a Comment