Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 

Hello Integrators!


In this blog, we shall explore a slightly advanced feature of SAP Cloud Platform Integration (f.k.a HCI) - scripting.


What is Scripting and When to use scripting?


By scripting, I am referring to the use of a scripting language (like Groovy, JavaScript) in your integration projects. SAP Cloud Platform Integration provides a rich set of functionality to transform your data - mapping, content modifier, converters, and so on. However, at times you want to perform a more complex task that lies outside of the native functionality provided. For example, say you receive the following incoming payload:

The payload comes from an HR system that tracks based on activities recorded every day. You want to integrate to a time recording system, that expects the total number of work hours against each person. Expected payload is in this format:

So, we have to parse through the entire incoming payload, calculate the number of hours against each person, and map to the final payload format. Achieving this scenario using the native functionality set of SAP Cloud Platform Integration could be a little tedious task. It can be easy accomplished using custom transformation functions. That is where scripting comes in.


Which Scripting Languages are supported?


SAP Cloud Platform Integration supports two forms of scripting languages: Groovy and JavaScript


  • Groovy is an Object Oriented Scripting Language which provides dynamic, easy-to-use capabilities. It absorbs most of the syntax from Java. Learn more Groovy from its site here.

  • JavaScript is a dynamic programming language of the Web. Most HTML pages are programmed using


Both scripting languages are easy to learn and come with a host of resources that you can use in your integration project.


How to use Scripting?


In the integration project, you should create the following folders in your project for scripting:



The src.main.resource.script folder should contain all the scripts. In an integration flow, the script step is available as part of the Message Transformer step. In the context menu of the script step, you can create or assign existing scripts from the folder.


When you create a new script, you shall get the default code editor in Eclipse with the following view. Functions to access the message are provided to you by default.

Using External Libraries in Scripting


One more cool feature you could use in the scripting message is the use of external libraries in your project.There are many open source libraries available to you.


Let's say you want read an XML file in Groovy using an Xpath library. And you finalized on using Jaxen. Then, here is how you proceed in an integration flow project.


Step 1: Import the Jaxen libraries in the src.main.resources.lib folder


Step 2: Include the import definitions in the script file of your integration flow

Step 3: Modify the processData function with your function logic


That is it! The procedure to use script in integration flows is simple.




You can utilise a scripting language in your SAP Cloud Platform Integration project for complex transformations.As language of choice, you have Groovy or JavaScript - and in addition, you can augment it with external libraries. We strongly recommend that you first look at the native functionality supported by the toolset before writing scripts. By its inherent nature, scripts can make integration projects harder to maintain.


Best Regards,