Skip to Content
Author's profile photo Divya Mary

SAP API Business Hub : Deploy generated Fiori application to SAP Cloud Platform account

SAP API Business Hub is the central catalog of all SAP and partner APIs for developers to build sample apps, extensions and open integrations with SAP.  In this blog, we would show case the discovery, exploration and consumption of the S/4 HANA Cloud APIs to build a Fiori Application.

SAP Cloud Platform Web IDE a powerful web-based integrated development tool that simplifies end-to-end application development enables developers to quickly discover APIs from SAP API Business Hub to generate Fiori applications.

In the blog Discover, Explore and Consume APIs from SAP API Business Hub, generation of a Fiori application using APIs available in SAP API Business Hub is captured. In this blog, deployment of the generated application in SAP Cloud Platform account would be showcased.

Build Fiori application consuming APIs published in SAP API Business Hub

All the APIs from SAP API Business Hub API Sandbox are protected using API Key.  During the preview of the generated application, SAP API Business Hub project settings takes care of setting the required API Key of the logged in user.  Before deploying the generated application on SAP Cloud Platform account, this api key would have to set explicitly in the generated code.

In this section, the changes required on generated Fiori applications to set the generated api key is shown.

  • Login to SAP API Business Hub to get your API sandbox key ( as described in part 1 of Discover, Explore and Consume SAP API Business Hub APIs blog series)

 

  • Click on the Copy API Key to use it from the API Sandbox. Take some time to read through Disclaimer about the API key usage (*Disclaimer: The SAP API Business Hub provides an API Sandbox to try out APIs. The API Sandbox is intended solely for evaluation purposes and should not be relied on for any productive use. Please refer to official SAP documentation and developer websites for package and API information for SAP packages. SAP does not represent or warrant that the information provided on this website is current, complete or error-free, or that this website will continue to be made available.)

 

  • Open SAP Cloud Platform Web IDE Full stack service.
  • Build a Fiori application named MyPlannedOrders as described in part 2 of Discover, Explore and Consume SAP API Business Hub APIs blog series.

 

 

 

 

 

 

 

 

  • Expand the generated MyPlannedOrders.
  • Click on manifest.json from the expanded project in WorkSpace explorer and change the mainService datasource to set a custom http header named apikey to the API sandbox api key
 "" : {
 "dataSource": "mainService",
 "preload": true,
 "settings":{
 "headers": {
 "apikey": "YOUR_API_KEY_FOR_API_SANDBOX"
 }
 }
 }

 

 

Deploy Fiori application to SAP Cloud Platform

  • Select the generated MyPlannedOrders Fiori application, click on the menu button Deploy. Select Deploy to SAP Cloud Platform option.

 

  • In the Deploy Application to SAP Cloud Platform dialog, provide an application name ( say myplannedorders)  and click Deploy.

 

  • Click on Open the active version of the application link to open the deployed application in a new tab with the url like below https://myplannedorders-yourcloudplatformtenant/?hc_reset

 

 

  • This responds with HTTP status code 404 – Not Found.

 

 

  • To view the application, /webapp/index needs to be appended removing ?hc_reset from the application URL in browser ( e.g https://myplannedorders-yourcloudplatformtenant/webapp/index.html)

 

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo parthibaraja vijayan
      parthibaraja vijayan

      Hi Divya,

       

      Thanks for the well explained blog.

       

      Is it possible to deploy the Fiori application created consumed from SAP API management into an on premise system such as a Gateway system.

      Appreciate your response.

       

      Regards,

      Parthibaraja

      Author's profile photo Divya Mary
      Divya Mary
      Blog Post Author

      Hi Parthibaraja,

      Thanks a lot for the kind words.

      Today SAP Cloud Platform API Management is more tailored for the cloud to cloud or cloud to on premise scenario, i.e, Fiori application running on Cloud ( SAP Cloud Platform) and accessing data from Cloud endpoints or on premise endpoints ( via SAP Cloud Connector ).

      Details about running Fiori application in on premise system is captured here.

      Thanks and Best Regards,

      Divya

      Author's profile photo Michael Kaufmann
      Michael Kaufmann

      Hi,

       

      that does not work like described in the article

       

      there are some basic steps missing regarding the Fiori Master Detail development

       

      Regards,

      Michael

      Author's profile photo Sandesh Agawane
      Sandesh Agawane

      Hi Divya,

       

      it's very nice tutorial but it's been long time and now everything is changed. I'm trying to call workflow API from fiori application but it's show CORS error... can you help with that..

      Thanks in advance

      Sandesh Agawane