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!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member183249
Active Participant
Code reusability is one of the strongest feature of any tool. Earlier SAP Cloud Integration was lacking a prime feature of script reusability like we used to reuse the objects of different software component versions in SAP PI/PO. Till now we were creating same script in many flows as Scripts were referred locally by an Integration flow. We were keeping redundant code on the server like logging payload/headers etc.

But now this issue has been addressed in SAP CPI and script reusability feature is available in Integration Suite to avoid redundant script writing. We can create multiple scripts under one artifact ( script Collection) and that can be called in multiple packages/integration flows

This blog will illustrate the steps to create a script collection and using the underlying script in any package/integration flow.

Step 1: Go to Package -> Edit -> Add Artifact -> Scrip Collection


 

Step 2: Put the name and description of the collection


Step 3: Click on Script collection & edit. Create the Groovy or Java Script repository under this artifact.


Step 4: Create required reusable Java/Groovy scripts.


Step 5: Save and Deploy the artifact.


Now we


Step 6: Go to Integration flow where you want to use script collection. Click on Resources tab. Under that References and Add References.


 

Step 7: Add the Script Collection References. It will list down all the packages those are having Script Collection. Select your package and Script Collection to create a reference link.


Once library is added. It will be visible under reference tab. You can see the package name once you hover the mouse on collection name.


 

Step 8: Now simply add Groovy/Java Script palette and assign the script from reference tab. It will list down all the scripts available in script collection artifact.


 

Step 9: Save and Deploy the Flow and Script Collection artifact

Step 10: Trigger the test payload from Postman and you can see the logPayload scrip will be executed from the referenced package/artifact/Script Collection


 


 

SAP has delivered very nice and much awaited feature but it still it needs some refinement.

  • After deploying the script library it should show where used feature so that any developer can find the interfaces those are using a specific script or script collections.

  • Currently, Script Collection created in package can be used in different integration flows


 

 
15 Comments
Labels in this area