SAP Builders Blog Posts
Learn from peers about their low-code journey and write your own blog posts to share your thoughts and experiences as you become an SAP Builder.
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_Wroblewski
Developer Advocate
Developer Advocate

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). 

IT Department

 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.

  1. Run the boosters for at least SAP Build Apps and SAP Build Process Automation.
  2. Assign the "Build" roles, at least for SAP Build Apps and SAP Build Process Automation.

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:

  • BTP service
  • SAP S/4HANA Cloud

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):

Additional PropertyValue
AppgyverEnabledtrue
HTML5.DynamicDestinationtrue
WebIDEEnabledtrue

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. 

dan_wroblewski_1-1668350360690.png

For the BTP service with the activities list, my colleague created an CAP service without authentication.

dan_wroblewski_2-1668350486649.png

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.

dan_wroblewski_0-1668350940136.png

On your service key, click the three dots and choose View.

dan_wroblewski_1-1668351153895.png

You will get the service key information, including the information you need for the destination.

dan_wroblewski_0-1668350686850.png

You will use this destination to trigger processes and get information about processes.

 

Business User

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. 

dan_wroblewski_0-1668437335223.png

I added input parameters for data I needed to receive from my app.

dan_wroblewski_2-1668437464108.png

I added mail steps for 2 reasons:

  • Just to notify me if the process was triggered, and its status.
  • At the end of the process, I needed a way to tell if the process was approved or not, and currently there is no way to specify context or set parameters in the end steps to know if it was approved. So I added mail steps, and later when I got the execution log I could check which mail step was executed. 

And this was the finally condition definition:

dan_wroblewski_1-1668437433723.png

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:

  • Custom navigation
  • Opacity property to be able to show the activities both as a list and tiles
  • Formula for defining colors so we can show different colors if the activity is approved or not   

Connecting to the Data

This is quite simple. You go to the Data tab, and click Add Integration > BTP Destinations.

dan_wroblewski_0-1668351856756.png

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.

dan_wroblewski_1-1668352011858.png

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:

dan_wroblewski_2-1668352172553.png

You need to now configure the Base part and the Create part.

dan_wroblewski_1-1668434742495.png

For the Base part do the following:

  1. Give the data resource a name.
  2. Select the destination for connection to SAP Build Process Automation API.
  3. Under Resource schema, add the parameters that are required by your process. For example, I defined input parameters for activity, price and other stuff. These need to be defined here. The parameter names are case-sensitive.
  4. This should be automatic, but check under Common request headers that you have defined an Authorization header and it is set to the formula:
    • "Bearer " + query.authConfig.authToken

For the Create part do the following:

  1. Enable the Create method.
  2. Under Request headers, set the following: 
    Content-Typeapplication/json
  3. Under request body mapper, set to the formula:
    • ENCODE_JSON({ "definitionId": "<your process name>", "context": query.record })​

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.

dan_wroblewski_3-1668435592444.png

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.

dan_wroblewski_0-1668435788659.png

Configuring the flow function is really simple:

  1. For Resource name, select the data resource we created earlier for calling the Process Automation API.
  2. For record, bind the parameters as needed to pass the values our process needs. I had to use wrap some parameters in the NUMBER function  to make sure their type was understood by Process Automation.

dan_wroblewski_0-1668438186138.png

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:

  • In the Base part, instead of passing the parameters for triggering the workflow, I passed only the ID of process instance, an ID that is returned when you trigger the workflow.
  • For the Create part, the HTTP method is GET, no request body mapping is required, and the URL path needs to be defined, to the following (spaidinput is the name I gave to the ID parameter).
    • "/" + query.record.spaidinput + "/execution-logs"

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). 

dan_wroblewski_0-1668436615735.png

The API call returns a JSON list that represents the execution log of the process instance.  

dan_wroblewski_1-1668436812875.png

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")))

 

 

 

 

 

 

 

 

 

 

 

 

 

6 Comments
BaerbelWinkler
Active Contributor

Hi Dan!

Thanks for the write-up which makes it clear that even with SAP Build there's (a lot) more invovled than meets the eye during a demo at TechEd!

I'm somewhat confused (nothing new here!) with regards to SAP Build and most of the LowCode/NoCode capabilities. So here are some questions and thoughts:

In which type of system (dev, qa, prod?) does what is shown in the demos actually happen? From the various snippets I watched thus far it looks like this can at least partially be done by end-users in a productive SAP-system and then instantly used. This to me seems a rather "weird" thing to allow, especially as it's not just for data retrieval and display but also for creating and updating actual data in the system. Coming from a typical ERP 3-tier-landscape background where everything workbench-related gets maintained in a DEV-system and then transported via e.g. QA to PROD, "building" processes in PROD directly (if this is what is actually happen here!), feels somewhat wrong. So what am I missing here?

And also: once something has been created via SAP Build, who'll ensure that it's not breaking anything else and who'll maintain it in the future or tend to "improvement requests"?

As you can tell: "I have questions" and I'm looking forward to reading your and others' answers!

Thanks much and cheers

Bärbel

DianaRoesner
Advisor
Advisor

Hi @BaerbelWinkler ,

thanks for your questions. You’re definitely not the only one thinking about these topics around how to maintain IT security with business users now building software themselves, or how to manage the lifecycle and support of an application. Companies usually have governance concepts for their low-code development practice to manage and ensure security, integrations into core solutions, support – you name it. These governance concepts are very individual to each organization and always rely on both: in-product mechanisms as well as people and processes (i.e. a dedicated CoE).

For in-product governance for example already have monitoring capabilities in SAP Build Process Automation: The system sends notifications whenever we have downtime for automation. There are many further items planned for 2023, i.e. the multistep approval by IT and LoB before deployment to production, and a Governance Tower Center to track key KPIs such as number of active projects, pending requests, score of projects etc. 

We will also leverage existing SAP frameworks and tools such as CALM for broader lifecycle management and Transport Management System for automated handover between development and productive tenants.

When it comes to people and processes, we’ve seen different models at our customers

  • Some companies work more with a control mechanism where business experts are only allowed to deploy applications productively upon certification à this is especially truly for regulated industries, i.e. Chemicals (for instance we work with a large German chemical company that has certified >300 business users already)
  • Others provide training, yet no mandatory certification 
  • Common practice is the 4-eye principle for any productive release (ideally from both IT and the LOB that will be using the new application)

I hope this helps already. We’re always happy to hear your feedback and input as these new capabilities materialize.

Best,
Diana

138392
Explorer

Hi @Dan_Wroblewski ,

Thank very much!!!

former_member44770
Discoverer
0 Kudos

Dear Team,

Thanks for the write up , we are having issue with create or update method when creating a Build App, do we have a demo or an example how it can be achieved.

Thanks!

Ratna Rajesh P

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

@former_member44770 Can you explain what problems you are having with the create and update method? Do you mena with the flow function Create Record, or are you referring to a specific service you are calling?

former_member44770
Discoverer
0 Kudos

Hi 

Thanks for responding.

I have added some information in this question , please let me know if any further information is required..

https://answers.sap.com/questions/13763850/post-method-in-sap-appgyer.html?source=email-global-notif...