Deploy the Fiori App to Cloud Foundry
Deploy the application to the SAP BTP, Cloud Foundry environment to be able to share it with your coworkers.
Overview
You will learn
- How to build and deploy the application to the cloud.
- How to interact with the SAPUI5 flex services to adapt the application to end-users.
Prerequisites
Prerequisites
- You have previously created an SAPUI5 application and select
SAP Build Work Zone, standard editionas the deployment target. - You have also completed all other tutorial as part of the mission Develop an App for SAP Build Work Zone, standard edition with Your Own Dev Tools.
- You have set up an SAP BTP account for tutorials. Follow the instructions to get an account, and then to set up entitlements and service instances for the following BTP services:
- SAP Build Work Zone, standard edition
- Destination Service
- Authorization and Trust Management Service (xsuaa)
- HTML5 Application Repository Service
Steps
Run the following command to package the project into one single archive. This archive contains the full source files (for debugging), as well as the bundled resources (for faster loading times):
npm run buildYou can find the definition of this script in the
scriptssection of thepackage.jsonfile.
Next, deploy the generated archive and track the deployment progress in the terminal with the following command:
npm run deployUse
cf loginto establish a connection to the Cloud Foundry endpoint if you haven’t done so yet. This tutorial might help you if you are not sure how to do so.
The great thing about deploying a single .mtar file is that the Cloud Foundry environment will provision all required services for you. Here is a list of all services that are required for this project (you can see them enumerated in the mta.yaml file).
| Service instance name | service | service plan |
|---|---|---|
tutorial.myui5project-destination-service | destination | lite |
tutorial.myui5project-uaa | xsuaa | application |
tutorial.myui5project-html-repo-host | html5-apps-repo | app-host |
At the end of the deployment process log, you should see a line that looks similar to this one:
Uploading content module "tutorial.myui5project-ui-deployer" in target service "tutorial.myui5project-html-repo-host"...
Deploying content module "tutorial.myui5project-ui-deployer" in target service "tutorial.myui5project-html-repo-host"...
Skipping deletion of services, because the command line option "--delete-services" is not specified.
Process finished.
Use "cf dmol -i 6002f603-45d2-11ef-91d3-eeee0a906a68" to download the logs of the process.This means you uploaded the app successfully. The URL of your app will now follow this pattern: https://<subdomain>.launchpad.cfapps.<region>.hana.ondemand.com/<some-id>.basicservice.myui5app-0.0.1.
You can also install this plugin and run
cf html5-list -di tutorial.myui5project-destination-service -u --runtime launchpadto print the full URL of your web app. With this URL you can access your application, but it will probably not load correctly. That is because we specifiedLocal resources (SAPUI5)as the location to load SAPUI5 from upon project generation. But we didn’t ship our application with any SAPUI5 libraries. Once we embed our application into a Fiori launchpad, the SAPUI5 libraries will be loaded from there.
Now it’s time to embed the app in SAP Build Work Zone, standard edition:
- Open the admin UI of the SAP Build Work Zone, standard edition. You can find the link to the UI under “Instances and Subscriptions” in the SAP BTP Cockpit.
- Access the Channel Manager menu. You should now see the following screen and click the refresh button to synchronize with the HTML5 Application Repository Service.

- Open the Content Manager menu and click on the button Content Explorer.

- Click on the tile that says HTML5 Apps.

- You should now see the following screen from where you can select the web app you just deployed. Select the checkbox next to
My UI5 Applicationand hit the Add button.

- Go back to the Content Manager and click on the group default. In case you don’t see this group, use the + New button to create a new one.

- Select the Edit button. You should be able to assign the app to the group via the Assignment Status switch. Don’t forget to Save the group before navigating back.

- Now you need to make this application visible to your users. To keep it simple, make the app visible to everyone. For this, select the Everyone role.

- You are already familiar with the steps needed here. Select the Edit button to edit the role. Assign the app to the role via the Assignment Status switch and click Save before navigating back.

- Go to the menu Site Directory and use the Create Site button to create a new site if you don’t have an existing one.

- You can choose any name for the new site, e.g.
Tutorial.

- There’s no need to edit this site, all you need comes with the default configuration. Click the button on the top right corner to open your new site.

- Click on My UI5 Application to open your web application. Also note that you see your initials in the top-right user menu. This shows that you are signed in (perhaps automatically via Single-Sign-On).

- Apply another filter with the following criteria:
- The
ProductIDshall be less than 18. - The
CategoryIDshall be less than 60.
- The

- Open the views dialog and save the current filter variant by clicking Save as.

- Name the view
TutorialFilter, check both checkboxes, and hit Save. This user-specific variant is now stored in the backend and is therefore persistent.

Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.