Skip to Content
Technical Articles
Author's profile photo Abhinav Verma

Reusable artifact consumption across packages in SAP CPI

Introduction

With the release of 5.33.x/ 6.25.x, SAP Cloud Integration now provides a feature where users can consume the reusable artifacts such as Script Collection and Message Mapping Artifacts across different packages. This enhancement will bring a better reusability experience for the usage of script collection across integration packages.

Till now, Integration Developers were allowed to use the reusable artifacts within the same package and cannot use them outside another package.

Kindly refer to these blogs to learn more aboutĀ  Script Collection Artifact and Message Mapping Artifact.

Problem Statement

In the first increment, the reusable artifact usage was within the package, this led to duplication of the resources if the same is required to consume in any other integration package.

If any Integration Developer wants to reuse artifacts in another package, it was not possible. As the result, an Integration developer is left with two options.

1. Export and Import the reusable artifacts.

2. Recreate the reusable artifacts again which will leads to duplicate effort.

To overcome this problem, SAP has now released a feature where reusable artifacts can be used across the packages of the tenant workspace.

How to consume this feature

We will take a simple example to understand this feature. Let’s say Integration Developer A has built a package which is having MPLAttachment Groovy Script in the Script collection.

 

This script is common and it can easily be used in any other Integration flow present in different packages. This is not specific to any Integration flow. Now, Integration Developer BĀ has built another package in the same tenant and he also wants to have MPLAttachment script in this Integration flow. Instead of creating a new script again, he can simply reuse the same which is built by Integration Developer A.

Let’s understand how Integration Developers will do it.

Here, I have created another package where I will consume the reusable artifact in the Integration flow.

Open the Integration flow in edit mode and select the Resource Tab. Go to add References and select Script Collection.

 

Click on Script Collection, by default it will open the current package(as per the existing features). Select the package where the reusable artifacts are present from the dropdown.

 

Select the reusable artifact and click Ok. It will get added to the Resource Tab.

Reusable artifacts will get added to the Resource Tab under reference. It will show the Reusable artifact name, Type of artifact, and package from which it is referred.

Now add a Groovy Script element in the Integration flow and click on Assign. It will show you the list of script collections reusable artifacts under the References tab. Integration Developer can select from the dropdown and use it in his Integration flow.

Similarly, an Integration developer can refer to the message mapping artifacts from another package. This feature will be very useful for Integration developers and will allow them to use the existing reusable artifacts across different packages.

In case of any questions or feedback, please feel free to comment on this blog post.

 

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Nick Yang
      Nick Yang

      This is a good feature to reduce duplicated groovy code or mapping artifacts within the tenant.

      But, based on my testing result. CPI doesn't stop you deleting the script that has already been referenced by other integration flows. CPI only warns you when you deleting the script object.

      I would say this should be considered when having this feature in CPI.

      Author's profile photo Kamlesh Zanje
      Kamlesh Zanje

      Hello Nick Yang,

      This will be addressed via the dependency management/where-used concept for the reusable artifacts. It is still in the grooming and ideation phase. Nevertheless, thanks for sharing the feedback.

      Regards,

      Kamlesh.

      Author's profile photo Christopher Kuehn
      Christopher Kuehn

      Dear SAP-Team,

      thanks a lot. This is a very helpful feature. But what about to make use of a global mapping function library (Script Collection) and use those UDFs in different message mappings? Is this also planned for the future roadmap?

      Thanks and best regards!

      Christopher