Skip to Content
Product Information
Author's profile photo Deepak G Deshpande

SAP Integration Suite – Import PI/PO Function Library into Cloud Integration


SAP Cloud Integration version 6.40.**, one of the capabilities of SAP Integration Suite, comes with a feature enhancement to import SAP PI/PO Function Library, also referred in some context of UDFs (user defined functions). If you have Function Libraries in your PI/PO Enterprise Service Repository (ESR), you can connect and import them into your SAP Cloud Integration tenant.

This feature is available only in SAP Integration Suite standard and above service plans.

SAP Cloud Integration version 6.40. ** software update is planned on start/mid of Jun 2023  (date and time subjected to change).

Function Library

Function libraries are objects where mapping user can create/use user defined functions (UDF) in SAP PI/PO, ESR system. This blog will not cover the details of Function Libraries as topic. It only covers its import feature in Cloud Integration. There are many SAP Blog Posts and documentation (e.g. ) on Function libraries, you can refer them for more information.

ESR System Configuration

Objects import from ESR into Cloud Integration tenant is not a new topic. This support has been enabled in the past for, e.g., PI/PO Message Mappings from ESR system. If you are aware of this, then it all starts with configuration of your ESR system details in Cloud Integration Settings page. If you are not aware about this, you can check Cloud Integration documentation at link on ESR configuration in your Cloud Integration tenant.

Importing Function Library

In SAP Cloud Integration, you first create a Function Libraries artifact, as below.


Function Libraries artifact gets created.

Click on the row to open the editor

In the editor click on Edit and Upload, this shall open up the ES Repository connection dialog.

Click on Connect, once the connection is successful, you will see set of function libraries available in that ESR system.


Filter the function library of your choice in the filter field, select the row, click on Select button. This will import selected function library

Once it gets imported in the Resources tab, click on it, function library code editor will be opened, as shown in the screenshot below.


Observe the auto generated comment, which state that key property not to be tempered. And also, all the custom methods/user defined functions are listed.

From the imported function library, the method (udf) tailString will be taken as example for assignment and usage in the Cloud Integration Message Mapping artifact.

Using Function Library in Message Mapping

Once the function library is imported, you can consume this in message mapping. For this, open any existing message mapping or create a new message mapping in Cloud Integration.

In the Resources section, References tab, select the function library artifact – in which you have imported function library- and refer it.

Clicking on Function Libraries, it will list the function libraries artifacts of the current integration package, as shown below

Select the artifact, and click on OK.

You will see the function libraries artifact appearing in the References section.

Now, select the mapping definition line, which opens up the expression editor in the bottom section of canvas of message mapping editor, click on Assign icon/button as shown below.

Click on the Referenced Resources tab, and select the UDF/Function library as shown in below screenshot and click on OK button

Once you assign, the UDF will start appearing in Custom Functions list of expression editor as shown below.


As you observed above, the tailString function is available. You can click/drag-and-drop in expression editor to use it.


Since the function is available in the expression editor, you can use that function/UDF, and message mapping story continues from here ( I am not going to explain the rest of the story, because information on how to create/use message mapping in Cloud Integration is already covered as part of other blogs).

Finally, you can refer this message mapping in integration flow. Deploy Function Libraries artifact, Message mapping artifact and Integration flow and trigger the message as per your integration scenario.

Next steps

We plan to address the below limitations in upcoming releases.

  1. Limitations – Currently there are some limitations on importing of function library from PI
    1. Methods having executionType value ‘ALL_VALUES_OF_QUEUE’, having ‘paramCategory’ value as ‘Parameter’ will not be supported.
    2. argument other than GlobalContianer will not be supported for init and cleanUp method
    3. Category and Title combination for a function library method should be unique in a function library class
    4. Function library with referene to imported archives are not supported.
  2. Importing of PI/PI Message Mapping along with referenced Function Library in one-go : Currently, there is no support for importing message mapping along with referenced function library together at one-go from PI/PO.



SAP Cloud Integration – with version 6.40.** release – opens up the opportunities for you to bring your PI/PO re-usable function library objects into Cloud Integration and enrich your integration scenarios 🙂 .


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Michael John
      Michael John

      Dear Deepak,

      Thank you for the helpful blog. The code which is imported into CI will live as java code forever? If we need to modify this code in future for any changes then should we follow java syntax like PI/PO?Is it a good decision to convert this into groovy for long term support and compatibility reasons?

      Author's profile photo Deepak G Deshpande
      Deepak G Deshpande
      Blog Post Author

      Hi Michael,

      Thank you.

      The imported function library will stay as Java code, and yes, in case of modifications, you follow the PI/PO syntax directly while editing the code. We don't have any plans to convert this to groovy.

      Let me ask you, do you see any value add in converting it to groovy script ? If so, what is it?



      Author's profile photo Daniel Graversen
      Daniel Graversen

      Hi Michael

      In Figaf migration tool, we do convert Function Libraries into Groovy and link it.

      We run into problems like $ in a String like " 100$" or regex(which we now automate) and a few other problems.

      But moving this out to the masses would not be a way to go and there are too many ways to handle it.

      It would be nice to use Groovy for future functions and just have one way to handle extensions of mappings. But I think the java is the best way.



      Author's profile photo Mohan Kanaka
      Mohan Kanaka

      Nice blog Thanks Deepak for sharing.

      As mentioned by Michael whether the java code supports in the mapping in CPI or the code translates to groovy ? this means in CPI we can define udfs using java instead of groovy scripting as an option?

      Author's profile photo Vijay Konam
      Vijay Konam

      CPI supports JAVA scripting by default from the beginning.

      Author's profile photo Javier Garcia
      Javier Garcia


      This is great! Thanks for adding this feature. Couple of questions though:

      1. Is the idea that script collections cannot be used inside mappings but function libraries does? That will be important information to know so we can build one or the other depending on the purpose.

        Note: There are innovation requests about allowing usage of script libraries with +20 votes

      2. You mentioned “Clicking on Function Libraries, it will list the function libraries artifacts of the current integration package”

        Can you import function libraries from a different package in this on in a future release? That will allow to build global functions that can be reused in many packages/iFlows.


      Thanks again, it is a great step forward



      Author's profile photo Deepak G Deshpande
      Deepak G Deshpande
      Blog Post Author

      Hi Javier,

      1. We do have plans to enable script collection usage in the message mapping. So, in future, you will see support of assigning script collection in the message mapping. Support for enabling function library in message mapping is to help PI/PO users to bring them and re-use in cloud integration.
      2. >>Clicking on Function Libraries, it will list the function libraries artifacts of the current integration package << I said because it is a default behaviour of the dialog, it select the current package where the message mapping is available. You can select other/different packages as well in the current release itself, and if you have imported function libraries in other packages, you will be able to select the other package and you shall see function libraries in it.



      Author's profile photo Javier Garcia
      Javier Garcia

      Great! Thanks Deepak

      Author's profile photo Rupert Clifford
      Rupert Clifford

      Nice article, do you know when this function will be available? it is already end of june...

      Author's profile photo Deepak G Deshpande
      Deepak G Deshpande
      Blog Post Author


      I checked with responsible team and learnt that this new software has been rolled-out to all the tenants recently. I request you to cross-check your tenant. If your tenant has the above mentioned service plans, this feature should be available at your end.




      Author's profile photo Rupert Clifford
      Rupert Clifford

      thanks  Deepak! indeed it was  not available to us due to issue in upgrade of our tenant - has been resolved by support..

      Author's profile photo Daniel Graversen
      Daniel Graversen


      I guess another limitation is the use of Functions without any input parameters here, you get  the error

      Resource "X " cannot be added.

      Author's profile photo Punith Oswal
      Punith Oswal

      Hello Deepak,


      Thanks for the detailed information.

      I was eager to know when will the below mentioned limitation will be solved and release in production?


      Limitations – Currently there are some limitations on importing of function library from PI

      1. Methods having executionType value ‘ALL_VALUES_OF_QUEUE’, having ‘paramCategory’ value as ‘Parameter’ will not be supported.


      Thanks in advance,

      Punith O.

      Author's profile photo Daniel Graversen
      Daniel Graversen


      We have now tried and linked the Function Libraries with our migrated mappings. It works quite well.

      See the blog

      Migrating Message Mappings that uses Function Libraries | SAP Blogs