Introduction
One of the usage patterns of SAP Build Process Automation is to utilize a custom UI5 application for initiating workflows. In this scenario you can create a UI5 application in SAP Business Application Studio (BAS) using
"Workflow UI" > "Start UI" template.
However, attempting to test the app from BAS may lead to 404 errors, indicating that the route to workflow API has not been resolved.
Error testing from BAS
In this blog post, I will share how to test workflow start UI from SAP Business Application studio.
Prerequisite
- A process have been created in SAP Build Process Automation
Settings
Please follow below steps to enable testing in BAS.
- Create destination
- Configure ui5.yaml
Create Destination
This destination is only for testing within BAS. Once the application is deployed, the SAP Build Process Automation "service" will be used to call the API, as seen in the xs-app.json configuration below.
{
"welcomeFile": "/index.html",
"authenticationMethod": "route",
"routes": [
{
"source": "^/bpmworkflowruntime/(.*)$",
"target": "/public/workflow/rest/$1",
"service": "com.sap.spa.processautomation",
"endpoint": "api",
"authenticationType": "xsuaa"
},
First, create a service instance of SAP Build Process Automation with the "standard" plan and generate a service key for it.
Service instance
Next, proceed to create a destination using credentials from the service key.
Workflow destination
Property |
Value |
---|
Name |
Destination Name (Any) |
Type |
HTTP |
URL |
"endpoints.api" in the service key |
Proxy Type |
Internet |
Client ID |
"uaa.clientid" in the service key |
Client Secret |
"uaa.clientsecret" in the service key |
Token Service URL |
"uaa.url" int the service key + /oautn/token |
HTML5.DynamicDestination |
true |
WebIDEEnabled |
true |
Important: the properties "HTML5.DynamicDestination" and "WebIDEEnabled" are required to make BAS aware of the destination.
Configure ui5.yaml
Add the following setting to ui5.yaml.
backend:
- path: /bpmworkflowruntime
pathPrefix: /public/workflow/rest
url: https://spa-api-gateway-bpi-us-prod.cfapps.us10.hana.ondemand.com
destination: workflowruntime #your destination name
The complete content will look like the picture below.
ui5.yaml
Result
As a result, the invocation of the workflow API becomes successful. Interestingly, although fetching xsrf-token failed, the actual POST request was successful.
Successful testing from BAS
Final Words
While the start UI can be tested in BAS using the provided settings, I haven't found a way to locally test task UIs. To the best of my knowledge, task UIs can solely be tested from My Inbox app. If anyone has insights on how to test them within BAS, kindly share your knowledge. In the meantime, I will explore potential solutions.
Update October 2023: I have published a new blog post on how to enable local testing of task UIs.
Testing SAP Build Process Automation task UI in SAP Business Application Studio