Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
Hello All,

In this blog post, I will show you how to trigger the Business Process of  SAP Build Process Automation in SAP Build Apps.

Below is the sequence of the steps to be followed.

 

1. Create a destination in SAP BTP Cockpit

2. Create an API Trigger for Business Process in SAP Build Process Automation

3. Configure the  BTP Destination in SAP Build Apps.

4. Test the Destination Configuration in SAP Build Apps.

 

Create a destination in the SAP BTP Cockpit


1. Create a Destination to connect SAP Build Process Automation with SAP Build Apps.

Enter the value under the URL. This is the API call to trigger your Business Process.

https://spa-api-gateway-bpi-eu-prod.cfapps.eu10.hana.ondemand.com/public/workflow/rest/v1/workflow-i...

Change the authentication to OAuth2ClientCredentials, Client ID, Client Secret, and Token Service URL can be retrieved from the SAP Build Process Automation Instance from your tenant.

Add these Additional Properties for this destination to work in SAP Build Apps.

AppgyverEnabled
HTML5.DynamicDestination
WebIDEEnabled



Create an API Trigger for Business Process in SAP Build Process Automation


Prepare your Business Process by creating an API trigger and configuring the input parameters to integrate with SAP Build Apps.

Refer to the blog post on How to create an API Trigger.

 

Configure the  BTP Destination in SAP Build Apps.


Follow the documentation to Enable BTP Authentication in your app,

 

.We have successfully created a destination in BTP and created an API trigger for Business Process in SAP Build Process Automation. Let's configure the destination in SAP Build Apps.

1. Click on CREATE DATA ENTITY and select SAP BTP destination REST API integration.

 


3. As the BTP destination name, select AppGyver_SPA.(Destination which was created BTP Cockpit)


 

4. Under the Data resource name, a name can be given to this data connection, like "SendtoSPA".


5. Under Resource schema, click on + ADD NEW to create a schema. Name the new schema "filename" and select the Field type as Text. Choose ADD.

Schema is the structure of the data. A schema is created which is similar to the Database. In this scenario,  and schema should be created matching the schema of your API trigger in SAP Build  Process Automation.


6. Similarly, add three other schemas with the following names:

"foldername"
"employeename"
"employeemail"
Select the Field type for all of them as Text.


7. Select the create tab, and enable it.


8. Open the binding menu for Request headers by clicking on the X icon.


9. In the binding menu, select List of values.


10. Click on Add value, and enter the following values:

Header name: Content-Type
Header value: application/json

Click on SAVE.


11. open the binding menu for Request body mapper.



12. Open the formula editor. Enter the following formula:

Your Definition ID was copied from SAP Build Process Automation. Refer to the blog post to  get the definitionId of your Business Process.


13. Click on SAVE.



Test the Destination Configuration in SAP Build Apps


You can test if this Data connection is working.
Switch to the TEST tab and enter the below values in the following fields to test the connection:

Click on RUN TEST.


 

Scroll down and check the Status of the Response.

If you are getting any errors please recheck the above steps. If you get the response as Status: OK, then the connection is successful.

Select SAVE DATA RESOURCE.


 

You can successfully link this data source to any UI element like Button in Build Apps!
20 Comments
janschober
Participant
0 Kudos
Thanks chaitanyapriya.puvvada for this excellent blog. Awesome and comprehensive summary!
richardbourne
Explorer
0 Kudos
Hi Chaitanya,

Im really excited to get this going but I'm failing to connect when creating a Destination in BTP. I get a 401 unauthorised message when i click the check connection button. The only thing different I see is that the AppgyverEnabled property is missing from the list. Could this be the issue or am I missing something from the Set Up? I used the booster to set everything up.

Many thanks

Richard

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

rbourne,

Can you please share the details of the destination that you have created mainly the token URL and API URL   that you used while creating the destination?

Hope you have added /oauth/token to your authentication URL to form Token URL 

 

 

gizemsoyluutr
Explorer
0 Kudos
Hello chaitanyapriya.puvvada ,

Thank you for excellent blog. I have issue to connect when creating a Destination in BTP. I get a 401 unauthorized message when i click the check connection button. All process is working on postman. Do you have any idea?


Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos
You can ignore that 401 message.Few a times ,even though credentials are correct it throws an error.If  your credentials are working fine in postman and if the same is maintained in destination  you can ignore the message.

We created a detailed tutorial on this.
karna
Discoverer

Hi chaitanyapriya.puvvada 

 

This is an excellent blog, I followed exactly the same steps to trigger API from Build Apps to the Process Automation . But getting 404 error while testing the integration of API trigger from Build Apps to Process Automation

 

  1. API trigger from Postman is successful .Can see the results in Process Automation My Inbox
  2. API trigger from the Build Apps Sample Application is not working while testing the schema from the Build API destination

 

Please suggest the reason for the error and solution.

Note the Destination to SPA icheck connection is working fine. But getting 401 error message. But that can be ignored as you have suggested and from Postman to Process Automation API trigger  is working fine

francoishardy
Product and Topic Expert
Product and Topic Expert
Hi, I have the same issue here, did you find the solution ?
induthiru
Participant
0 Kudos
chaitanyapriya.puvvada : Is there a way to achieve this functionality without enabling BTP destination? We are working on an app that scans barcodes and hence has to be used with a mobile preview only. However, BTP destination currently does not work with mobile preview. So, in such cases how do we call a process automation from SAP build apps?
agpekka
Advisor
Advisor
0 Kudos

Hi, We are currently working with mobile btp authentication.
In the meanwhile, however, if your api is normally accessible you can create the integration via classic data entities. Just do not use the BTP connection, but the normal one with direct url to the api of yours.

induthiru
Participant
0 Kudos
agpekka : Thanks for your reply!

We managed to accomplish this, but wasn't easy though :-). I am leaving the reference to a fantastic blog that we referred to. This is just a workaround until the mobile BTP authentication is working and can help anyone who faces the same issue as us.

How-to: Combine SAP Build Process Automation with SAP Build Apps – Version 1 | SAP Blogs
Rwitte
Participant
0 Kudos

Hi chaitanyapriya.puvvada ,

any updates here? I am also the same issue as karna14 and francoishardy . In Postman everything is working fine, but as response for the destination check on BTP and the trigger test in SAP Build apps I get a 401 🙁 Therefore I am a bit stuck here.

Best regards,
Raphael

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello francoishardy  raphael.witte ,

Can you re-create the destination and double-check if you have entered the correct credentials?
Rwitte
Participant
0 Kudos
Hello chaitanyapriya.puvvada ,

my problem has already resolved itself after just waiting one day and trying again. Maybe just a hickup somewhere. Nevertheless thanks for the response!

 

Best regards,
Raphael
VictorNoroc
Explorer
0 Kudos
Hi chaitanyapriya.puvvada ,

is there a documentation on how to use Response mapper option?

As currently there I can use a formula that should return an object with 4 properties, but I could not find what are these 4 properties.

Thank you,

Victor

 
arockiaraj007
Discoverer
0 Kudos

Hello priya, thankful for the guidelines and it is basic understandable, but how to api trigger flow and get my definition Id of sap build process automation


This is correct for get my destination mockserver data integrate into sap build apps

sengupta01
Discoverer
0 Kudos
Hi chaitanyapriya.puvvada ,

I am also the same issue as karna14 and francoishardy . In API everything is working fine, but as response for the destination check on BTP and the trigger test in SAP Build apps I get a 401. Therefore I am a bit stuck here.

 

But If I use bearer Token generated by API tryout after adding the environment in the test Trigger in SAP Build apps its working.

Can you please tell m why the Bearer token is not generating automatically in SAP Build app Test

Regards,

Abhishek
gabriel_martins
Discoverer
0 Kudos
Hi chaitanyapriya.puvvada.

Thanks for the excellent blog and great explanation! I'm working on an ap using the Document Information Extraction API. Unfortunately, when testing "create" [POST] it failed and i received 400 error. I truly believe all the configuration steps were done correctly. In the "file" field, I tried the local file system path and file's name. Both didn't work as well. In "option" i'm using a JSON code.

create-test-1.png

create-config.png

And here it is my destination configuration:

destination.png

If you have any idea or suggestion, could you help me with this? Thanks for all.

G. M.
Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi gabriel_martins

400 error means your request is malformatted.

Please check the request parameters.

I would suggest raising a query in the SAP Build Apps Community as the query is related to more SAP Build Apps than SAP Build Process Automation.
GauravKoundal
Explorer
0 Kudos

 

Hi @Chaitanya_Priya ,

I am getting 404 error while testing the API trigger in SAP Build through destination but through postman API trigger is successful and am getting 201 response. 

Can you please help me on this.

GauravKoundal_1-1709137860785.png

complete response 

GauravKoundal_2-1709137936274.png

Thanks,

Gaurav 

 

 

chaudras
Explorer
0 Kudos

@gabriel_martins - I am also facing same issue with CORS. Could you achieve this POST call to Document information extraction from Build App ?