During the keynote at SAP TechEd, I delivered a short demo of how I can build an app with SAP Build Apps that authenticates to BTP, uses destinations to get SAP S/4HANA and BTP service data, and uses the same destination functionality to trigger workflows on SAP Build Process Automation and to get the status of those workflows.
The first 2 tasks would generally be done by an an IT administrator or developer: enabling SAP Build and building the services and destinations.
After that, the remaining tasks would be done by a business user, perhaps with a little help from a developer (especially for the exact setup of the REST API data resource for Process Automation).
Enabling SAP Build
I will write another blog on how to set up SAP Build, since at the time of this writing the product had not been released and the exact way to set up was not yet published. And I don't like to write about anything that I don't try myself.
But I will give you an outline of what's required, which should be enough to get started.
Again, I will write again here and provide the documentation, as well as my experience setting this up on the new landscapes released today.
Note that you can also use a US10 trial account, but again, I do not have all the details at this time.
Creating Destinations (IT)
For the project I created 2 "data" destinations:
You are basically on your own for these, since I cannot give you my SAP S/4HANA system or my BTP service. You will have to get your own SAP S/4HANA service (not sure if there is a trial system), and instead of the BTP service you can use whatever free service, like from TripAdvsor or whatever.
I will show you the destination configuration, since you must have the following properties (requirements are changing all the time so some properties may no longer be needed):
For the SAP S/4HANA Cloud system, you have to create a communication user (this tutorial might also help, but this is beyond the scope of SAP Build) and give it the rights for the Business Partner APIs.
For the BTP service with the activities list, my colleague created an CAP service without authentication.
The last destination you need is to the Process Automation APIs. I am told this is now created automatically when you enable Process Automation with the booster. But here's how to do it manually.
You have to go to your SAP Process Automation instance (not subscription), and make sure to create a service key: Services > Instances and Subscriptions, and click on your instance. If you don't have a service key yet, click on Create and create one.
On your service key, click the three dots and choose View.
You will get the service key information, including the information you need for the destination.
You will use this destination to trigger processes and get information about processes.
Once IT has set up their part, business users can go ahead and build their apps.
Building the SAP Process Automation
I created a simple process, that had a condition and a single approval step.
I added input parameters for data I needed to receive from my app.
I added mail steps for 2 reasons:
And this was the finally condition definition:
Building the UI
I will not go into detail about the UI, since it did not reflect any special new capabilities of the new SAP Build. Feel free to comment if there is something in the UI we should that was not clear.
Note we used:
Connecting to the Data
This is quite simple. You go to the Data tab, and click Add Integration > BTP Destinations.
You get a list of destinations. Select one, and now you can browse data. When you're ready, click Install Integration, then select the entities you want to enable and click Enable Data Entity. Then click Save.
You will now see the new data source in the Data tab.
And now you can create data variables with it, or configure data components, as you could with regular data sources.
Setting Up Connection to Process Automation
Again, this may be set up for you when you install SAP Build, but in case it's not, here's how you would create it from the destination for connecting to the Process Automation APIs (IT did this earlier).
Go to the Data tab, and select SAP BTP Destination REST API Integration:
You need to now configure the Base part and the Create part.
For the Base part do the following:
For the Create part do the following:
Replace <your process name> with the name of your process. Go to SAP Build Process Automation, and then go to the Monitor tab > Manage > Processes and Workflows, and find your deployed process. To the right you find the ID of the process. This is the ID to put in the formula above.
Triggering a Process
To trigger a workflow, you just need to create an event and then run a Create Record flow function.
I created a button, and to the tap event of the button, I added a Create Record flow function.
Configuring the flow function is really simple:
Getting Status of the Process Instance
For getting status of a workflow, the path of the API is different so I created a separate data resource based on the same Process Automation destination.
The only differences were:
To actually get the status, I had to do a workaround.
First I created a button to trigger the API call, which triggered the Create record flow function. That flow function pointed to the data resource I just described, and the single input parameter was set to the current process instance ID (which I saved when I triggered the workflow).
The API call returns a JSON list that represents the execution log of the process instance.
In my process, I defined separate Mail steps if the process was approved or if it was rejected, So I used a formula that searched that list (which I saved to a page variable) to see if I got the activity for approval or for rejection.
NOT(IS_EMPTY(FIND(pageVars.Workflow, item.subject == "Approved Mail")))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.