In this lesson, the following topics are discussed:
- Scripting overview.
- Developing Groovy Scripts with the inline editor.
- Create Groovy Scripts with an external editor.
Scripting Overview
You can use Java or Groovy scripts for message processing, which can be useful in the following scenarios:
- Add Information to the Message Processing Log
- You can use the Script step to add information to the message processing log (MPL).
- Read and Modify Message Header, Message Body, and Exchange Properties
- You can use the Script step to address (get, add, modify, or delete) the message header, the message body, and exchange properties, using the interface Message object.
- Read and Modify SOAP Headers
- You can use the Script step to address SOAP headers.
- Read and Modify Partner Directory Content
- You can use the Script step to address Partner Directory content.
- Handle Exceptions
- You can use the Script step to identify exceptions that arise when sending messages using the HTTP or OData V2 receiver adapter.
- Read Security-Related Artifacts
- You can use the Script step to address security-related artifacts (for example, keystore entries).
- Additional Use Cases
Java Docs for com.sap.gateway.ip.core.customdev.util packages
The Java doc can be found here: com.sap.it.script.custom-development 2.7.1 API
Developing Groovy Scripts with the Inline Editor
You can use the inLine editor directly in the following manner.
Procedure
- Position a Groovy Script component on the expiration path.
- Choose the Create button from the context menu.
- After that, you are in the inline editor of the Groovy script. There is already a basic script created, on which you can build.
- You will have code compilation and more.


Then, proceed with the standard simulation and/or testing process by deploying and tracing the flow.
Create Groovy Scripts with an External Editor
You can build a local development environment with Eclipse, IntelliJ, or Visual Code. You can get the corresponding SDK here: SAP Development Tools at Using Script API → Script API.
There is also an online editor with which you can write and test directly. Use Groovy IDE for easy development and testing of your scripts. All necessary SDKs are already implemented.

After copying the code, paste it into the scripting component, and proceed as usual.
Resources
There is a whole range of examples and demos in the SAP Help Portal:
- Blogs:
- Understanding Groovy Scripting for SAP Integration Suite – Part 1: https://blogs.sap.com/2021/04/08/understanding-groovy-scripting-for-sap-integration-suite-part-1/
- SAP Cloud Platform Integration (CPI) || Part 7 || Maintaining logs by using "Groovy Scripts", even if the integration flow is not on trace mode: https://blogs.sap.com/2020/01/09/sap-cloud-platform-integration-cpi-part-7-maintaining-logs-using-groovy-scripts-even-if-the-iflow-is-not-on-trace-mode./
- SAP Cloud Integration (CPI/HCI) || Writing Groovy Scripts _ With Basic Examples | SAP Blogs
- Samples
- Script Collections: Using Script Collection across various Integration Flows in a Package in SAP CPI: https://blogs.sap.com/2021/06/07/using-script-collection-across-various-packages-in-sap-cpi/.
- Script API: https://tools.hana.ondemand.com/#cloudintegration. Using Script API.
Summary
Scripts in Java or Groovy can be created using a Script SDK, which allows for processing messages and their metadata in various ways. The SDK allows for setting and reading exchange parameters, writing logs, intercepting exceptions, and more. These scripts can be created using both the Inline Editor and an online IDE that includes all the necessary SDKs, making it possible to test the script directly.