Why the Content Modifier Is the Step You Will Use Most
If you open ten real integration flows, nine of them contain a Content Modifier. It is the simplest and most-used step in SAP CPI. With it you can read a value out of the incoming message, store it for later, add a fixed value, and rewrite the message that travels on to the next step.
To use it well you need to understand three places where CPI keeps data while a message is processed. In this article you will learn them, and then see them working in a small flow that you test with Postman. It continues the series, so you should already be able to build a flow with an HTTPS sender and call it from Postman (see article 3).
The Three Data Containers
SAP describes the Content Modifier as a step that changes one of three data containers during message processing:
| Container | What it is | Typical use |
|---|---|---|
| Message Header | Key and value pairs that travel with the message. Headers describe the message, for example its content type. | Set Content-Type, keep an ID that the receiver should get, add routing information. |
| Exchange Property | Key and value pairs that live only inside CPI while the message is processed. The receiver never sees them. | Remember a value for later steps, store a timestamp, keep a copy of the original message. |
| Message Body | The payload itself: the business data being transferred. | Build a new message, a confirmation text or a JSON response. |
A header is like the label on an envelope: it travels with the letter. A property is like a sticky note on your own desk: you can use it while you work, but it never leaves your desk. The body is the letter itself.
The Columns of the Header and Property Tables
The Message Header and Exchange Property tabs both contain a table. Each row creates or deletes one entry:
| Column | Meaning |
|---|---|
| Action | Create adds or changes the entry. Delete removes it (you must give the name). |
| Name | The name of the header or property, for example OrderId. |
| Source Type | Where the value comes from (see the next table). |
| Source Value | The value itself, an expression, an XPath, or the name of another header or property, depending on the source type. |
| Data Type | Only used for the types XPath and Expression. A typical value is java.lang.String. |
Source types you will use first
| Source Type | What it does | Example value |
|---|---|---|
| Constant | Writes a fixed value. | Postman |
| XPath | Reads a value from the incoming XML message. | /Order/ID |
| Expression | Uses Camel Simple language to read headers, properties, the body or the date. | ${date:now:yyyy-MM-dd HH:mm:ss} |
| Header | Copies the value of another header. | the header name |
| Property | Copies the value of an exchange property. | the property name |
Other types exist as well, for example variables and external parameters. Start with the five above.
Reading values later with expressions
${header.OrderId} value of the header OrderId
${property.CustomerName} value of the exchange property CustomerName
${in.body} the current message body
${date:now:yyyy-MM-dd} today's date in the format you choose
On the Message Body tab you choose between two types. Constant writes your text exactly as typed. Expression evaluates the placeholders above. If the body field is left empty, the body is not changed.
Build the Practice Flow
The flow receives a small XML order from Postman. It copies two values into a header and a property, adds a constant and a timestamp, and answers with a sentence that uses all of them.
- In your package, add a new integration flow, for example
Content_Modifier_Demo, and choose Edit. - Delete the Receiver. Draw a line from the Sender to the Start event and choose the HTTPS adapter.
- Set Address to
/modify, keep the user roleESBMessaging.sendand untick CSRF Protected for this practice flow (as in article 3). - From Message Transformers drop a Content Modifier between Start and End.
Message Header tab
| Action | Name | Source Type | Source Value | Data Type |
|---|---|---|---|---|
| Create | OrderId | XPath | /Order/ID | java.lang.String |
| Create | Source | Constant | Postman |
Exchange Property tab
| Action | Name | Source Type | Source Value | Data Type |
|---|---|---|---|---|
| Create | CustomerName | XPath | /Order/Customer/Name | java.lang.String |
| Create | ReceivedAt | Expression | ${date:now:yyyy-MM-dd HH:mm:ss} | java.lang.String |
Message Body tab
Choose the type Expression and enter:
Order ${header.OrderId} from ${property.CustomerName}
Source: ${header.Source}
Received at: ${property.ReceivedAt}
Save and deploy the flow, then copy its endpoint from Manage Integration Content as you did in article 3.
Test with Postman
- Create a POST request to the endpoint (it ends with
/http/modify) and use the same OAuth 2.0 setup as in article 3. - On the Body tab choose raw and select XML as the type. Enter made-up data:
<Order>
<ID>1001</ID>
<Customer>
<Name>Asha</Name>
<Country>IN</Country>
</Customer>
</Order>
- Choose Send.
The response should look like this (your time will differ):
Order 1001 from Asha
Source: Postman
Received at: 2026-11-17 09:30:00
Every value in the answer came from a different place: the order ID from a header (read with XPath), the
customer name and the timestamp from properties, and Postman from a constant.
Extend It: Return JSON with the Right Content-Type
Now make the answer more useful. Many callers expect JSON, and the Content-Type header tells them what
they receive. Add a second Content Modifier after the first one:
Message Header tab
| Action | Name | Source Type | Source Value |
|---|---|---|---|
| Create | Content-Type | Constant | application/json |
Message Body tab (type Expression)
{
"orderId": "${header.OrderId}",
"customer": "${property.CustomerName}",
"source": "${header.Source}"
}
Redeploy and send the same request. Postman should now show a JSON object. If it still shows plain text, check
that the header name Content-Type is spelled exactly and that the second Content Modifier sits after the first.
Steps run in the order you draw them. The first Content Modifier reads from the incoming XML. After it has replaced the body, the XML is gone, which is why the values were saved in a header and a property first. Plan your flow like this: read first, save the values, then rewrite the body.
Header or Property: How to Choose
| Question | Use a header | Use a property |
|---|---|---|
| Should the receiver or caller receive the value? | Yes, if the adapter allows it. | No. It stays inside CPI. |
| Is the value large? | Avoid. Headers have size limits. | Better, or keep it in the body. |
| Is it technical information for your own later steps? | Possible. | Best choice. |
Is it a standard HTTP value such as Content-Type? | Yes. | No. |
Common Mistakes
| Problem | Usual cause | Fix |
|---|---|---|
| The value is empty | The XPath does not match, the message is not XML, or the XML uses a namespace. | Compare the XPath with the real message, character by character. For namespaced XML, use the namespace-aware XPath. |
| The placeholder is printed as text | The body type is Constant instead of Expression. | Switch the Message Body type to Expression. |
| XPath step fails or returns the wrong type | The Data Type column is empty. | Enter java.lang.String for XPath and Expression entries. |
| Header or property is "not found" | A typo, or a different upper and lower case. | Names are case sensitive. Copy the exact name. |
| The original body is lost | A later Content Modifier replaced the body before you saved what you needed. | Save values or the whole ${in.body} into a property first. |
| The body did not change | The body field was left empty. | An empty body field means "do not change". Enter your text or expression. |
Interview Questions
1. What can the Content Modifier change?
It can change three data containers: the message header, the exchange property and the message body. You can create or delete headers and properties, and rewrite the body.
2. What is the difference between a header and a property?
A header travels with the message and can be passed on to the receiver by the adapter. A property exists only during processing inside CPI and is never sent to the receiver.
3. What is the difference between Constant and Expression?
Constant writes the text exactly as entered. Expression evaluates placeholders such as ${header.name},
${property.name} and ${in.body} using Camel Simple language.
4. When do you use XPath as the source type?
When the incoming message is XML and you want to read one element or attribute from it, for example
/Order/ID. You also set a data type such as java.lang.String.
5. What happens if the body field of a Content Modifier is empty?
The body is not changed. The incoming body is passed on as it is.
6. Why would you save ${in.body} into a property?
So that you can use the original message later, after another step has replaced the body, for example when you want to log it, compare it, or send it in a different call.
Frequently Asked Questions
Can the Content Modifier read JSON?
The XPath type works on XML. For JSON, a common approach is to convert the message to XML first with a Converter step, or to use a script. Start with XML while you learn.
Can I use more than one Content Modifier in a flow?
Yes. Real flows often have several, each with a clear purpose, for example one to read values and one to build the final message.
Do headers appear in the response to Postman?
Some do, for example Content-Type is used to describe the response. Other headers may or may not be passed on,
depending on the adapter's settings. Do not rely on a header reaching a system unless you tested it.
Conclusion
The Content Modifier is small, but it teaches the most important idea in CPI: data lives in a header, a property or the body, and your job is to move it to the right place at the right time. In the next articles you will use these values to route messages, handle errors and map structures.
- 1. SAP BTP and CPI basics: palette, adapters and the cockpit
- 2. Why SAP CPI is used: use cases and real-world examples
- 3. Your first SAP CPI integration flow with Postman
- 4. SAP CPI encryption and decryption with Postman
- 5. Content Modifier: headers, properties and body (you are here)
Next: more SAP CPI articles are coming. Follow SAPwithSAI on Telegram to hear when they are published.