Create New Record with Parameters via REST API in SAP Build Apps

Estimated read time 4 min read

 

Hi folks, in this blog post I will show you how we can create a BTP destination, how we can integrate it with SAP Build Apps and how we can create new record with giving parameters to REST API.

Firstly, we define our destination in BTP Destinations.

Then in SAP Build Apps go to the Data tab and click on “Create Data Entity” then select SAP BTP Destination REST API integration.

In the opening window name your Data entity and select your BTP destination.

Then go to create section and make it enabled. Give your service’s path and go to test tab. Here my parameters are ‘1283212’ and ‘88858’. First test your service then click on “Autodetect Schema From Response” below. Now you will be able to see your Resource schema at Base section.



At the Base section go to Resource schema and click on “Add New” on top. Just create an object ex. “parameters” here then you can create text type parameters inside of it. These will be our parameters to send.

Now go to create section again and edit your path. For me it was this before:

 

refSave?Text1=’1283212-88858′

 

But now I give my variables instead of 1283212 and 88858 values with formula. The formula will look like this:

 

“refSave?Text1='”+query.record.parametre.tradeNo+”-“+query.record.parametre.tradeItemNo+”‘”

 

Now we go to variables screen and create two page variables. For me they are “selectedTradeNo” and “selectedTradeItemNo” I gave them default 1283212 and 88858 values.

Then in view screen add a button to our canvas. Open logic canvas of the button and add a “Create record” node. Go the properties of “Create record” node and select your resource name. For me it is “refSave” as I gave this name to my data entity when configuring REST API section above.  

Then click on Record on the left and map your page variables with the parameters you added to the resource schema.

Now you will be able to run the application and make a create request with given parameters. You can see your request on browser when your app is running.

Please comment on this blog post if you have any questions or recommendations.

 

​  Hi folks, in this blog post I will show you how we can create a BTP destination, how we can integrate it with SAP Build Apps and how we can create new record with giving parameters to REST API.Firstly, we define our destination in BTP Destinations.Then in SAP Build Apps go to the Data tab and click on “Create Data Entity” then select SAP BTP Destination REST API integration.In the opening window name your Data entity and select your BTP destination.Then go to create section and make it enabled. Give your service’s path and go to test tab. Here my parameters are ‘1283212’ and ‘88858’. First test your service then click on “Autodetect Schema From Response” below. Now you will be able to see your Resource schema at Base section.At the Base section go to Resource schema and click on “Add New” on top. Just create an object ex. “parameters” here then you can create text type parameters inside of it. These will be our parameters to send.Now go to create section again and edit your path. For me it was this before: refSave?Text1=’1283212-88858′ But now I give my variables instead of 1283212 and 88858 values with formula. The formula will look like this: “refSave?Text1='”+query.record.parametre.tradeNo+”-“+query.record.parametre.tradeItemNo+”‘” Now we go to variables screen and create two page variables. For me they are “selectedTradeNo” and “selectedTradeItemNo” I gave them default 1283212 and 88858 values.Then in view screen add a button to our canvas. Open logic canvas of the button and add a “Create record” node. Go the properties of “Create record” node and select your resource name. For me it is “refSave” as I gave this name to my data entity when configuring REST API section above.  Then click on Record on the left and map your page variables with the parameters you added to the resource schema.Now you will be able to run the application and make a create request with given parameters. You can see your request on browser when your app is running.Please comment on this blog post if you have any questions or recommendations.   Read More Technology Blogs by Members articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author

+ There are no comments

Add yours