Connect to External Systems using Actions in SAP Process Automation
SAP Process Automation is a service in SAP Business Technology Platform which combine capabilities from SAP Workflow Management (workflow, business rules, process visibility, Inbox) and SAP Robotic Process Automation (RPA Bots). This new combined offering was released in February this year. Since then, we have been releasing many features and functionality to enhance overall experience in the area of automation design, process design, form design, process execution, process lifecycle and governance. Learn more from the roadmap
Just this week, we released Action feature in SAP Process Automation. Action is a mean to connect processes with external systems, be it SAP or non-SAP systems. This is an important piece of the puzzle especially if you want to automate or extend your business processes for any available LoB processes like S/4HANA, Ariba, SuccessFactors etc. These extensions can be easily build using SAP Process Automation, and using Actions you can connect to your given S/4HANA, Ariba or other SAP LoB systems for any kind of GET, POST, PATCH and other calls.
For example, posting an invoice to the S/4HANA system after approval from business process or getting the employee details from SuccessFactors system for off-boarding process or updating purchase requisition details for the changes in the order in Ariba system or getting asset details from Asset Management system before sending it for approval for asset depreciation. There are many such real-world examples where you will need to create, fetch or update the data in the backend system based on the process outcomes (approval, validation etc.)
Through this blog, I will show you how to use Action feature in SAP Process Automation to post Business Partner master data in S/4HANA after approval via business process.
Let us start with the concept first. There are 3 main artefacts which will be needed to connect to external system from business process automation:
- Action Project: Simplify experience for citizen developers to consume business functions / APIs from the library of curated content (read this blog from Vivek Vishal on Action Project)
- Action Library: Enable citizen developers to quickly compose processes, automations and applications by consuming from the library of curated content
- Action: Simplify integration, interaction and invocation between external systems by providing a common skill (learn with simple example from Thomas Jentsch)
Here is the quick overview of the steps to:
- Create, Configure and Test Action Projects
- Add, Configure and Monitor Action in Business Process
Now let us realize the steps with very simple use case to create the business partner master data in the backend S/4HANA Cloud System.
Create Destination in SAP BTP Cockpit
Note: The username and password are of the communication user created to access Business Partner OData API in my S/4HANA cloud system. This username, password and other credential parameters will differ based on the system you choose.
Also notice the additional parameters:
- sap.processautomation.enabled = true is needed to add this destination in the SAP Process Automation Settings.
- sap.applicationdevelopment.actions.enabled = true is needed if you want to use this destination while testing in Action Project.
Prepare or Download the open API specification from API Business Hub.
note: Action Project works only with OpenAPI specification 2.x or 3.x. You can find these specifications with the SAP published APIs in API Business Hub or you can also generate OpenAPI specification for your own custom API like calling integration flow or any custom OData API published from ECC system.
In this example, I have used Business Partner APIs published in API Business Hub
Create and Configure Action Project
Now its time to create and configure Action Project from Application Development Workbench Lobby, with the given OpenAPI specification
Note: I have only added two methods (or Actions or APIs) to this project, and I have also updated the title and trimmed the Input fields based on my requirement.
It is suggested to use minimalist set of input and output fields to avoid cluttering the business process context with unwanted fields that will not be used anytime during the process design or execution. You can always add or update the fields later if the requirement changes.
- Don’t forget to test the Action and check if it’s working fine with destination connection:
- Once you have configured and tested, Release and Publish the Actions of the Action project in the Action Library
Add Action in Business Process
For this I have created a simple Business Partner Approval Process which has:
- Start form to fill the details of the Business Partner
- Enrichment form to add address details
- Business rules to setup default values for missing mandatory fields
- Conditional Flow to determine if the approval is needed based on Business Partner Category and Organization
- Approval Form to approve or reject by the manager
Once the approval is done, I have added an Action by browsing the actions published in the Action Library
Then, I have configured the Action to add destination variable, mapped the Action Input with the actual process context and check the output that will be appended in the process context after execution and this output can be consumed for further processing.
- Do not forget the release and deploy the project. At the time of deployment, you will be promoted to associate the destination variable with the actual destination name. You can the select the one from the drop downnote: If you do not find the destination in the drop down, then ensure that you have added the destination via the Settings option.
Monitor Action in Business Process
As last step, run the process and monitor the outcome of Action execution from the Monitor Application.
Notice that the process context will be updated with the output from the Action execution including the newly created Business Partner ID. You can access this output for any further usage like sending email to the requestor or checking the backend S/4HANA system with the given Business Partner ID etc.
With the introduction of action project and actions, you can now build and manage business processes which involves connectivity using APIs. Watch the step-by-step video from Devtoberfest on how to create and use Actions in SAP Process Automation
Go and try out the Action Project and connect to external systems. If you have any suggestions, feedback or comments, please do let us know – we will be happy to take them and improve our product further.
Nice blog. Is there any way we can configure outlook or Gmail with trial account SPA or BTP free subscription? I configured the destination in free tier but not able to test mail sending.
Yes you can send emails. No restrictions from SAP Process Automation side. Check your email server. With gmail, there are some additional settings you have to do in Gmail account.
Samannaya Roy There is documentation on sending emails, but I will publish soon a video on how to send emails 3 different ways within SPA. But if you need some help let me know.
Really nice and helpful blog ... and your Devtoberfest presentation was great: https://www.youtube.com/watch?v=HU7Lir3AQbY
Am glad you liked it. Thanks for posting it again.
Informative blog but screenshot are blurred.
The action body fields are not pre-determined by the JSON when I create an action.
I follow the exact steps as in your video.
Is there something wrong with the product?
If you have not deleted the fields then all of them should appear when you create the Action Project for first time. Can you please try doing that again.
Thanks for the blog,
I am facing error 503 Unable to fetch CSRF token when the Action is added into Process however the action works fine if tested from action editor.
* CSRF path is updated already not sure if this is limitation with trial account
** I am trying to access on prem S4 system API.
Have you configured the cloud connector for on-prem call?
Yes Cloud Connector is up and running for BTP and S4 on prem.
I can test the API from Action editor(POST call) and its successful. But when I add the action in process its gives 503 Unable to fetch CSRF token error . Seems this is limitation with Trail account.
** API POST call works fine in Action editor but not in process.
Can you please let me know (attach a screenshot if possible) what is the path that you have configured for CSRF token in Action Project.
Thanks for continues support please find below screenshot for CSRF enablement.
Action with Default CSRF
How many level of hierarchy you have in to_PurchaseReqItem in the body? Can you expand and show me. Currently we are supporting only one level of Hierarchy - which means you should not have any other tree node inside to_PurchaseReqItem
yes there is one more entity in to_PurchaseReqItem.
Please find below Hierarchy.
One question in my mind how it works in Editor but.
Hi Archana - we are also facing the same issue, please let us know if any solution to this issue. we have only 1 level of hierarchy.
Does the Action project takes care of csrf token automatically when we try to do a POST/PUT call?
I followed your steps and calling the API Destination in Actions is working correctly. But if I run the process automation we keep receiving an Error 401. Do you have any idea how we can fix the problem?
Thank you so much in advance!