Skip to Content
Technical Articles
Author's profile photo Sookriti Mishra

SAP Cloud Platform Integration (CPI) || Part 5 || Content Modifier

Dear Reader,

This blog post is a part of a series of blog posts related to SAP Cloud Platform Integration. The blogs so far are:

  • My adventure in learning CPI || Part 1 || All about SAP Cloud
  • My adventure in learning CPI || Part 2 || Deployment Models
  • My adventure in learning CPI || Part 3 || Cloud Security
  • SAP Cloud Platform Integration (CPI) || Part 4 || Know your tool

Up next:

  • SAP Cloud Platform Integration (CPI) || Part 6 || Configuring Mail Adapter

————————————————————————————————————————————–

 

A Content Modifer is one of the most important functions provided by SAP.

content modifier shall help you to modify the incoming message or payload, by changing it’s content that are involved in Message Processing (i.e. Message Header, Message Exhange Property, or Message Body).

In the Message Header, and Message Exchange Property, you can declare Header Element, and Property Elements, which can or cannot be included in the outgoing Message to the next step, as shown in the screenshots below:

Header:

Property:

 

Question: What is the difference between Header, and Property?

The scope of the element declared in the Header is beyond the scope of the IFlow, 

The scope of the element decalred in the Property is only within the IFlow i.e. the property parameters are not handed over to the receiver.

In the Message Body, you can do the following:

1. Call the Header Elements, like:

${header.elementname}

2. Call the Property Elements, like:

${property.elementname}

3. Call the body of the previous Content Modifier, like:

${in.body}

As shown in the screenshot below, I have called the Header, and body, and since, the received expects the output in xml, the tags have been maintained like wise.

OUTPUT from this Content Modifier is:

 

Now, I have used one more content modifier to explain you the functionalities even better, so, follow the series of images to see how it works.

Here, I have inserted a Groovy Script after every Content Modifier because I wanted to see the payload after the IFlow is deployed. I shall share the script’s content in the Part 7 of this series.

In the Content Modifier 2, below is the Header, Property, and Message Body:

As you can see in the screenshot above, I have used the code ${in.body} to call the content of the previous i.e. Content Modifier 1.

Now, the output to this, after you have “Saved as version”, and “Deployed” is below.

That is it about Content Modifier.

Hope you had a good read.

If you wish to know more, or have any queries on the said processes, then please feel free to drop a comment.

 

Thanks & Regards,

Sookriti Mishra

 

Assigned tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sibi Sivakumar
      Sibi Sivakumar

      Good blog 🙂

      Author's profile photo Dilip Mehra
      Dilip Mehra

      Hi,

       

      Thanks , that helps to understand better.

      Just one suggestion, in the first ContentModifer , you should have pasted one more screenshot for entries made for header.name, header.executionDateTime and property.gender, so that people can understand from that's where they are called in the message body tab.

      But , thanks for the effort.

       

      Author's profile photo Pushkar Patel
      Pushkar Patel

      Hi Sookriti, Is it possible to handle multiple occurrence in Message Body?

      If I extend your example mentioned above, I want to pass multiple employees using Message Body ?

      <EmployeeData>
      <Employee><EmpName>Employee1</EmpName><Address>Mumbai</Address><EmpID>123</EmpID></Employee1>

      <Employee><EmpName>Employee2</EmpName><Address>Delhi</Address><EmpID>456</EmpID></Employee>

      <Employee><EmpName>Employee3</EmpName><Address>Pune</Address><EmpID>789</EmpID></Employee>

      </EmployeeData>

      Can it be achieved via Content Modified or I will need to do it in mapping.

       

      Thanks,

      Pushkar

      Author's profile photo Sai Pachipulusu
      Sai Pachipulusu

      Hi Pushkar,

       

      The ${in.body} holds the entire input payload which receives from the sender/previous Content modifier step. You can directly pass the entire payload to the receiver system or you can manipulate the data according to the receiver structure.

      Hope this sorts your query. Please do write back any further info required.

      Author's profile photo Vivek Kumar Singh
      Vivek Kumar Singh

      Hi Sookriti Mishra ,

      Nice blog explained everything in detailed but somehow i am unable to solve problem when Umlaut character gets passed in URL If you see Project ID has umlaut character in it -> Ü

      https://XXXXXX.s4hana.ondemand.com/sap/opu/odata/CPD/SC_PROJ_ENGMT_CREATE_UPD_SRV/ProjectSet(ProjectID='CZÜRIAT1V00287')

       

      Error -
      org.apache.olingo.odata2.api.uri.UriSyntaxException: Invalid URI syntax., cause: java.lang.IllegalArgumentException

       

      Thanks

      VIvek Singh