Skip to Content
Technical Articles

SAP RPA 2.0: add activities – Custom script SDK tutorials

This tutorial is based on my SAP Intelligent RPA experience working with the Custom script activity and will introduce a generic Template/ Design Pattern you can adopt for APIs of different products – the Custom script SDK.

  • Developer
    In Custom scripts you can develop JavaScript code and also use APIs (e.g. REST APIs). You will save the Custom script as Automation
  • Citizen Developers or Business Process Experts
    Like Activities provided by IPRA SDK packages, the Automation can be used in the workflow to define an automation process

So the concept supports the Low-Code/No-Code approach of  SAP RPA also for API usage.

I have done this for APIs of different products and recognized, that even for a small set of Custom scripts in my SAP Intelligent RPA Cloud studio projects

  • there is duplicated code
  • adding features would lead to more duplicated code
  • the code is really hard to maintain
  • need a better way to structure and organize the Custom scripts
  • should use JavaScript concepts like: Classes, Functions in variables, …

Tutorial Blogs

Custom script SDK – Overview

Standard SDK Package

Part of the SAP Intelligent RPA product, you can get them from the store.
Content: Data Types, Activities 

Custom script SDK Package

You will develop a Custom script SDK in a Cloud Studio Project, generate and share as Package.
Content: Data Types, Automations

The Custom script activity in the automations

  • will contain the JavaScript code
    supports the ECMAScript (ES6) version that means let, const, and lambda functions, …
    a limitation I have recognized; you cannot use the import statement
    API calls for your product
  • can define Input and Output Parameters
  • can use Standard SDK activities, like
    irpa_core.core.log(‘message’); or irpa_core.clipboard.get();

You can find more implementation details for the Custom script activity in the Cloud Studio User Guide – Custom Scripting.

Design Pattern Sample API

A template package that will be used to develop your Custom script SDKs.
The sample API is very simple, the methods initexecute (with parameters) and done will only write messages to the console.
It provides Data Types and Automations that will be used in your SDK implementation. The JavaClass for the Sample API will be the starting point for your API implementation.

Automation concepts

Here a sample, how the workflow in an automation could look like. In this case we are using the Design Pattern package.

  • Step cs_activity_Sample
    Input Parameter: name of the activity (for the sample API: init, execute, done)
    Input Parameter: parameter value
  • Step Execute
    Input Parameter: parameter value
    the name is already specified in the Automation Execute

So you can have a Automation the could execute all activities of your API (cs_activity) or you have have Automations for each activity (Execute, …).

Custom script – Activities Class

Here the template of the JavaScript class that will implement the methods of the API. You can find the source code in the Design Pattern tutorial and the sample for an Rest API in the SAP Analytics Cloud tutorial.

Conclusion

Hope this tutorial is useful and you can adopt the concepts to develop a Custom script SDK for your API and product.

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.