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: 
Active Contributor
We have now used the new Function Library(FL) object in SAP Integration Suite/Cloud Integration. It does provide a lot of value if you can reuse your existing mappings and FL.

In the first iteration, SAP's migration tool did not work with the FL, which made it more interesting to try to see if it could be used for migration. So we set out to update our migration capability to support its usage.

FL is used in many of customers' Message Mappings, so it is important to get it working, and it works pretty fine. I create a short demo of how the process works.

I'm pretty impressed with the functionality and that it connects message mappings to it if you understand the Message Mapping content. It is not something you want to be doing manually.

Some limitations with the current FL import

It seems the Function Library import has some limitations. The ones we currently know about are

  • Parameters

  • All values of a queue

  • Function without any input

If a FL contains one of the problems, you cannot import the FL. It should be possible to resolve this in future releases by SAP.

Naming of FL

When working FL you create one object like for the script collection. And then you can add multiply FL inside of this. I think the ideal would be to create one package where all your FL will be added in and then create one FL Object with one FL in it.

If you start having duplicates of FL in multiple FL objects, I could imagine it becomes difficult to manage.

Why FL is better than Groovy

In the Figaf we have, for the last two years, been able to migrate message mappings that used FL. We converted the PI FL to a Groovy script. But the script does have some limitations like:

  • Syntax is different

  • $ behaves differently in a string like "200$" where it is seen as the start of a variable and need to be escaped.

  • It misses the Container and GlobalContainer object, which is used in functions

  • If developers are not strong in Groovy, conversion can be an issue.

It does give some freedom to have the option for cases where the Cloud Integration FL cannot be imported.

Migration to ICOs with FL

To use the FL migration, you need to have the FL already imported into the Figaf Tool and then you need to synchronize the object to Figaf as a part of the DevOps process.

Then you can select the ICO you want to migrate.

Selecting ICO and pattern for migration

Once Figaf has read the content, it needs information about the

Selecting the right FL for the mapping

You can select the mapping of the FL from SAP PI to the FL of Cloud Integration. Here you can have the same object multiple times. That is one reason to have good governance around the FL.

Once we check the resulting iFlow and the message mapping we can see it is linked.


And the functions is now used inside to the Message Mapping. If you click the link it will open the FL object in a new tab.


And once I test the mapping with Figaf with the same flow on SAP PI/PO I get an expected mapping with just a time difference, that I could ignore.

To give you an idea about the FL that I have been working with then you can see it here in the imported format. All the methods has been called in the mapping.
package figaf.pitocpi11;

import java.lang.reflect.*;
import java.util.*;

public class OrderFunctions26 extends AFunctionLibrary {

String name = "DANIE2";

public String getName() {
return name;

public void init(GlobalContainer container) throws StreamTransformationException {
container.setParameter("first", "init");

public void cleanUp(GlobalContainer container) throws StreamTransformationException {

//The key property of the UDFs should not be changed. If it is changed it cannot be used
//in the Message Mappings which are imported from ESR system.
@FunctionLibraryMethod(category = "OrderFunctions26", title = "PartnerName", executionType = "SINGLE_VALUE", key = "8c94124c-4498-11ec-bc5a-9cebe8446a8a")
public String PartnerName(@UDFParam(paramCategory = "Argument", title = "") String partner, Container container) throws StreamTransformationException {
return "H " + partner;

@FunctionLibraryMethod(category = "OrderFunctions26", title = "withLine", executionType = "ALL_VALUES_OF_CONTEXT", key = "ac03bb23-2564-11ee-9c69-7a7919221453")
public void withLine(@UDFParam(paramCategory = "Argument", title = "") String[] var1, @UDFParam(paramCategory = "ResultList", title = "") ResultList result, Container container) throws StreamTransformationException {
for (int i = 0; i < var1.length; i++) {
result.addValue(var1[i] + " " + i);

@FunctionLibraryMethod(category = "OrderFunctions26", title = "getGlobalAttribute", executionType = "SINGLE_VALUE", key = "add9d3d9-2563-11ee-9dcb-7a7919221453")
public String getGlobalAttribute(@UDFParam(paramCategory = "Argument", title = "") String var1, Container container) throws StreamTransformationException {
return name;

@FunctionLibraryMethod(category = "OrderFunctions26", title = "globalFunctionTITLE", executionType = "SINGLE_VALUE", key = "5ec8568a-2564-11ee-83d7-7a7919221453")
public String globalFunction(@UDFParam(paramCategory = "Argument", title = "") String var1, Container container) throws StreamTransformationException {
return getName();

@FunctionLibraryMethod(category = "OrderFunctions26", title = "getGlobalContainerVar", executionType = "SINGLE_VALUE", key = "635f8a62-2565-11ee-c128-7a7919221453")
public String getGlobalContainerVar(@UDFParam(paramCategory = "Argument", title = "") String var1, Container container) throws StreamTransformationException {
return (String) container.getGlobalContainer().getParameter("first");

@FunctionLibraryMethod(category = "OrderFunctions26", title = "regex", executionType = "SINGLE_VALUE", key = "cc572e46-7f8a-11ed-b068-00090faa0001")
public String regex(@UDFParam(paramCategory = "Argument", title = "") String var1, Container container) throws StreamTransformationException {
//removes last comment in a line
return var1.replaceAll("\\d+$", "");

@FunctionLibraryMethod(category = "OrderFunctions26", title = "checkLogTrace", executionType = "SINGLE_VALUE", key = "d79728fd-7f8a-11ed-876d-00090faa0001")
public String checkLogTrace(@UDFParam(paramCategory = "Argument", title = "") String var1, Container container) throws StreamTransformationException {
MappingTrace importanttrace = container.getTrace();
return var1;


Try it your self

If you are interested in knowing how your FL works in your message mappings it may be worth checking out the Figaf Tool. You can sign up for our free Migration Edition. Then you can use the tool to create an assessment of your current landscape and test the migration for up to 1 year.

It also gives you 10 free migrations with our tool to see how your Message Mappings will work with the new FL.

It is now released.


Labels in this area