Skip to Content
Technical Articles
Author's profile photo Fatih Pense

Cloud Integration(CPI) Custom Functions in Message Mapping(UDF) and Differences from Process Orchestration (PI/PO)

Both SAP Process Orchestration(PO) and Cloud Integration have the same Graphical Message Mapping runtime. Your knowledge of UDF will transfer to CPI for the most part.

If you already know SAP PI/PO, this post aims to jumpstart writing UDFs in Cloud integration.


  • It is written Groovy instead of Java
  • You can write all functions in a single script file.
  • Editors and importing classes are different, and I like the developer experience of Cloud Integration more here.

The biggest difference is the missing execution mode.

While SAP PI/PO supports these 3 execution modes:

  1. All values of queue
  2. All values of context
  3. Single value

Cloud Integration(CPI) doesn’t support number 1: “All values of queue”

Since you can’t get all values in the queue there will be no “context change” in the input.


Single values

For each field you want to include, add it to the signature of the function like field1 and field2 below.

You can just return the result value.


def String exampleSingleValue(String field1, String field2, MappingContext context) {
	//Your code here

	return result;

All values of context

For each field you want to include, add it to the signature of the function like field1Array and field2Array below.

You can add values and “suppress” using the output parameter. There is no “return”.


def void exampleAllValuesInContext(String[] field1Array, String[] field2Array, Output output, MappingContext
context) {
	//Your code here




Checking for context change and suppress

For Cloud Integration(CPI), you can use output.isSuppress(input[index]) for checking suppress.

There is a method for “context change” in the Javadoc documentation. However, since you can’t get context changes in the input, it is not useful.

isContextChange(Object value)

Help page SDK API > Script API
Interface: Output


In SAP PI/PO, you would achieve checking context changes like below:

“” under “ResultList” Interface
You can use the CC to find context changes in the input array that the function was transferred to, for example: a[index].equals(ResultList.CC)


Is “all values of queue” really not supported?

I couldn’t find the answer in the online documentation but in the PDF document “Developer’s Guide: Managing Integration Content” dated 2015-10-28

It is very clear under “ Guidelines for Creating Mapping Scripts using Custom Functions”


There are also related questions in the community:—custom-udf-for-manage-queues–context-change.html

I conclude that it is not supported.

Still, if there is a way to use “All values of queue” that I’m missing, or if there are any plans to support it in the future, I think friendly colleagues from SAP will let us know.

More useful references

Great posts by Vikas containing reimplementation of UDFNodePool functions and step by step explanation of creating a custom function. If you need to transport UDFs from PI to CPI it can be useful:

Examples in the official documentation:

Let me know if I missed any good resources.

Thanks for reading!

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Daniel Graversen
      Daniel Graversen

      Hi Fatih

      Yes there is a few features missing to make the migration simple.

      The Container objects would be a nice feature

      We also had one client that which had used Regex

      In PI text.matches("somehting")  but that will not compile in groovy.  it had to be text.matches(/something/)