Skip to Content
Technical Articles
Author's profile photo Thomas Jentsch

SAP Process Automation – Your first simple Action Project: End to End

In this tutorial we will create a very basic Action Project for a simple REST API which will return the list of ToDos.
The goal is to cover all the steps necessary to consume Actions in a Process, not to proivde a real Process use case.

This is part of a blog series for Actions:
SAP Process Automation – Consume APIs with <no-code> using Actions.

Overview of the Steps:

 

Create BTP Destination

In the SAP BTP Cockpit, create a destination that will be used in the Action Editor to test the Action and in the Process execution.

Parameter Value
URL https://jsonplaceholder.typicode.com/
Additional Properties sap.applicationdevelopment.actions.enabled = true
sap.processautomation.enabled = true

Configure Destination for SAP Process Automation

To allow the usage of the BTP destination, you have to add the Destination in SAP Process Automation.

  • In the Settings or SAP Process Automation, select Destinations
  • Click New Destination
    select the Destination from the list and press Add
  • The destination is now added to the lst and can be used in SAP Process Automation

Create Action Project

In this sample we will create a simple Action Project for a REST API.
We will not change input/output parameters or customize the action.

Important: You need an Open API specification for your API to create Actions

  • For this example, just copy the definition from here to a local text file called ToDoAPI.json and save the file. We will use the file to create the Action Project with one Action.
    { "openapi": "3.0.0",
        "info": {
            "description": "This is a fake API of todo list",
            "title": "fake.todo",
            "version": "1.0.0"
        },
        "servers": [ { "url": "https://jsonplaceholder.typicode.com/" } ],
        "paths": {
            "/todos": {
                "get": {
                    "summary": "get list of todos",
                    "description": "get list of todos",
                    "operationId": "get.todos",
                    "responses": {
                        "200": {
                            "description": "Successful response",
                            "content": { 
                                "application/json": {
                                    "schema": {
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "userId": { "type": "number" },
                                                "id": { "type": "number" },
                                                "title": { "type": "string" },
                                                "completed": { "type": "boolean" }
    } } } } } } } } } } }
    ​
  • In the Lobby of SAP Process Automation, create an Action Project.
  • Specify the name ToDo Actions and upload the API spec ToDoAPI.json, click Create
  • Select the actions from the list, click Add
  • Your Action Project will contain one action

Test an Action

You can test the execution of your action in the Action Editor. Lets test the Action ‘get list of todos’.

  • Select ‘get list of todos’ from the list, the action has no input parameters
  • Select Tab Output, shows the fields returned when the action is executed

  • Select Tab Test, you can see the different options available to test an action.
    Connectivity Host allows you to test with an destination or Manual, you can enter the system details here.
  • Select the destination Demo, click Test
    The Response Preview will show the results

Release and Publish to Library

To be able to use the Action in a Process, we have to release and publish the Action Project.

  • Click Release
  • Provide release information, click Release
  • Click Publish to Library
  • On Publish Project, click Publish

Consumption in Process

Create Business Process and use an Action

  • From the Lobby select Create Process
  • Enter the Project Name, e.g. Demo Process and select Create
  • On the Create Process Dialog, enter the Process Name myActionProcess and select Create
    your canvas should look like here
  • Select the + to add a step to your process
  • Select Browse library, you will see all actions
    here I have used a filter to show only Actions from ToDo Actions project
  • Lets use ‘get list of todos’ action, click Add
  • As a last step we have to define a Destination variable
    This variable will be later used in the Execution to assign a destination created in BTP and configured in SAP Process Automation
  • Select Create Destination Variable, set system as Identifier and select Create
  • An Environment variable was created and your process should not display an error anymore
  • Now Save your process

Release and Deploy the Process

To test the action in the process, we will release and deploy the project.

  • clik Release
  • Enter a Version comment, click Release
  • click Deploy
  • On the Deploy a project dialog, select the Destination Demo, click Confirm
  • The Deploy button gets activated, click Deploy
  • Your project is deployed and the deployed version is shown

Test the Process which is using the Action

  • In the Monitor or SAP Process Automation, select Manage –> Process and Workflow Definitions
    you can use filter myActionProcess
  • select the myActionProcess from the list, click Start New Instance
  • On the Start New Instance you can specify input parameters, we have no input so we can use {}, click Start New Instance and Close
  • The instance will be started
  • Select Monitor -> Process and Workflow Instances
  • Reset the Filters to show all instances
  • in the Search, enter myActionProcess
  • Select myActionProcess from the list to show the instance results

Consumption in Automation

coming soon

Conclusion

Following this tutorial, you have seen all the steps to consume an Action in a process.

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sven Diedrich
      Sven Diedrich

      Does this require an running Agent or is the caller SPA itself?

      Author's profile photo Thomas Jentsch
      Thomas Jentsch
      Blog Post Author

      Testing Actions in the Action Editor or execution within a process does not require an running Agent.
      Execution within in automation requires an running Agent.

      Author's profile photo Piyush Gupta
      Piyush Gupta

      Really informative article Thomas Jentsch

      Is it safe to say that Action Project is used to call APIs only?

      If that is the case then isn't there an option to call APIs from activities in Automation?

       

      Author's profile photo Thomas Jentsch
      Thomas Jentsch
      Blog Post Author

      Yes, Action Project is used currently for REST APIs.
      And yes, you can use this also in automations.

      • there are Web Service activitities for automations (independent from Action Project)
      • Actions can be used in automations as well
        you need to add the Action Project as a dependency to your SPA project and after that step you can use the actions in your automations.
        (using an action in processes, the dependency is added automatically for automations this is a manual step)

      Will add the consumption in automations to this blog asap.

      Author's profile photo Bram Degroof
      Bram Degroof

      Hi Thomas,

      I followed your guide but I do not get automatically output fields.

      What am I doing wrong?

      Thanks.

      Author's profile photo Thomas Jentsch
      Thomas Jentsch
      Blog Post Author

      Just tested on my trial and works fine. Seems to be an issue in the ToDoAPI.jsoncan you please check the file and may be create just a new one.

      Author's profile photo Bram Degroof
      Bram Degroof

      Hi Thomas,

      I've checked the file, and try it again, with the same result: no output fields.

      Also when I am trying the blog of Archana Shukla (business partner api - json) (https://blogs.sap.com/2022/10/21/connect-to-external-systems-using-actions-in-sap-process-automation/) I get also no input and output fields.

      Has this something to do with our BTP account. I am not using a trial account but a full BTP account.

      Thanks.

      Kr,

      Bram

      Author's profile photo Vladimír Balko
      Vladimír Balko

      Hello Thomas Jentsch ,

       

      thank you for very nice morning blogpost. It is always very pleasant to start a day with such small and interesting article which will push your knowledge a little bit further.

      But... Everything went fine until I tried to test call the api. I am receiving the error - see below.

      I also tried to add dummy parameter to query and path, tried to do test with manual url instead of destination, but with same result.

      Maybe it is some temporary problem on SAP side?

       

      Error%20on%20test

      Error on test

       

      Also, the lobby and UI of BUILD (SPA) has changed due to recent TechED, but most of screenshots are up to date.

       

      Good work - thanks

       

      Vlado