Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 

Here I am just explaining the Importance of Groovy script in the Real time scenarios when we are dealing with Cloud Integration.

Groovy scripting is an integral and important feature of SAP Cloud Platform Integration (CPI). The goals of this repository are: Providing templates when you are implementing a new script. Easily finding Groovy functions related to the CPI topic at hand. Minimizing search engine time for common tasks.


SAP Value Mapping:

SAP Enterprise Support value maps – an empowerment and support program, which leads you through the knowledge, skills, and services needed to address business challenges and adopt intelligent technologies.


Business Requirement: How to access Value Maps from Script.



Valuefrom valueMaps can be accessed programmatically from a script with the help of the
getMappedValue api of the ValueMappingApi class.


Classes needed:


Method signature:
public String getMappedValue(String sourceAgency, String sourceIdentifier, String sourceValue,
String targetAgency, String targetIdentifier);


Sample Code:
Get a handle to the ValueMappingApi service:
def service = ITApiFactory.getApi(ValueMappingApi.class, null);


Step 1: Create a Value Mapping


Step 2: Create an Integration Scenario using below Script.



import java.util.HashMap;

def Message processData(Message message)

def a = ITApiFactory.getApi(ValueMappingApi.class, null);
def mappedValue = a.getMappedValue("Input", "CountryCode", "IND", "Output", "Country");
def messageLog = messageLogFactory.getMessageLog(message);
message.setProperty("Mapped Value", mappedValue);
messageLog.addAttachmentAsString("Payload", mappedValue, "text/plain");

return message;


Step 3: Please check your Message output in Monitoring section.

Conclusion –

Hope this document will help to beginners to understand CPI concept of Groovy Script. Happy Learning 🙂


1 Comment
Labels in this area