Academy · SAP Integration Development (PI/PO & Integration Suite) · 300 Professional
Groovy Scripts and Custom Mapping Functions in SAP Cloud Integration
Groovy is the escape hatch in SAP Cloud Integration: reading and setting the body, headers and properties of the Message object, writing custom mapping functions with MappingContext and Output, parsing XML and JSON safely, and logging without leaking data. The course covers script step versions (Groovy 2.4 and 4.0), script collections, local unit tests and contract tests, and when not to script at all, using Contoso's move of its PO interfaces to Integration Suite.
- 58 minutes
- 6 lessons + quiz
- Integration Specialist, BTP & Extension Developer
What you’ll be able to do
- Use the Message object to read and write body, headers and properties
- Write custom functions for message mappings in Groovy
- Parse and build XML and JSON with XmlSlurper, JsonSlurper and builders
- Log payloads safely and avoid personal data in logs
- Organize reusable code in script collections
- Test scripts outside the tenant before deploying
Sources and further reading
- Define a Local Script Step · SAP Help Portal
- Read and Modify Message Header, Message Body, and Exchange Properties · SAP Help Portal
- General Scripting Guidelines · SAP Help Portal
- Add Information to the Message Processing Log · SAP Help Portal
- Access Header and Properties in Message Mapping · SAP Help Portal
- Script API: com.sap.it.api.mapping (MappingContext, Output, ValueMappingApi) · SAP Help Portal (Javadoc)
- Working with Script and Script Collection · SAP Help Portal
- Use Import Statements Supported by the Script Runtime · SAP Help Portal
- Optimize Memory Footprint · SAP Help Portal
- SDK API (Script API on Maven Central) · SAP Help Portal