Extend SAP SuccessFactors on SAP BTP with CAP – Deploy Application to Cloud Foundry


Prerequisites

To follow-up with this blog post you must have read and completed the following previous blog posts in this series:

Build the MTA Archive

Before we build the MTA Archive for deployment, let’s not forget to switch back the database from in-memory SQLite to SAP HANA (if not already). For that, just open the package.json file from the CAP service and set the cds.requires.db.kind parameter to “hana” like demonstrated below:

Figure%201%20-%20Switch%20the%20database%20back%20to%20HANA

Figure 1 – Switch the database back to HANA

Now we can start the procedure to build the archive. Let’s begin by building the CAP service.

1. In the Terminal type cds build –production and press Enter (don’t forget to press CTRL+C to terminate cds watch if it was previously running)

Figure%202%20-%20Build%20CAP%20service

Figure 2 – Build CAP service

This will update the gen folder with the latest version of the artifacts (including database) for the CAP service deployment.

2. On the left-hand pane right-click the mta.yaml file and select Build MTA Project

Figure%203%20-%20Build%20MTA%20Project

Figure 3 – Build MTA Project

It’s going to take some seconds until the build process completes. When it does, it will display a message “Terminal will be reused by tasks” in a dedicated terminal named “Task Build MTA Project“. Look for the message “Build succeeded” among the lines in that console to make sure the build process was successful.

Figure%204%20-%20Successful%20build

Figure 4 – Successful build

If the process is successful you’ll notice that a file named sfsf-projman_1.0.0.mtar will be generated into a new folder named mta_archives like demonstrated below:

Figure 5 – MTA archive generated

Deploy the MTA Archive

IMPORTANT NOTE: before you trigger the process to deploy the MTA archive to Cloud Foundry you MUST make sure you comply with two requirements:

  1. You are properly logged into your Cloud Foundry landscape on SAP BTP by following the instructions on the blog post: Jumpstart the CAP Project
  2. Your SAP HANA Cloud database is up and running (remember that everything shuts down overnight on trial accounts!)

On the left-hand pane right-click the sfsf-projman_1.0.0.mtar file and select Deploy MTA Archive

Figure%206%20-%20Deploy%20MTA%20Archive

Figure 6 – Deploy MTA Archive

It’s going to take a while until the deployment process finishes. When it does, it will display a message “Terminal will be reused by tasks” in a dedicated terminal named “Task Deploy MTA Archive“. Look for the message “Process finished” in the last lines and see that there’s no errors/failures listed among the other lines in that console to make sure the deployment process was truly successful.

Figure%207%20-%20Successful%20deployment

Figure 7 – Successful deployment

Test the Deployed Application

Before we jump into testing the application, we must remember that it’s meant for project administrators, meaning, users with the Admin role assigned. So, let’s assign the role to our user in SAP BTP.

1. In the SAP BTP cockpit, on the left-hand pane expand the Security menu and click on Role Collections. On the right side, using the search box, search for the sfsf_projman_Administrator role and click on it.

Figure%208%20-%20Find%20Role%20Collection

Figure 8 – Find Role Collection

2. Click on the Edit button at the top-right corner, then, in the Users list, select the Default identity provider from the dropdown list and provide your SAP BTP user ID and your e-mail (usually in trial accounts they are both your e-mail). Click on the “+” button on top of the list and then click on the Save button at the top-right corner.

Figure%209%20-%20Add%20user%20to%20Role%20Collection

Figure 9 – Add user to Role Collection

Now we are OK to test the application.

3. On the left-hand pane, click on HTML5 Applications and locate your Business Solution (sfsf-projman-<your subdomain>). Then, click on the link of the Application Name

Figure%2010%20-%20Start%20application

Figure 10 – Start application

An SAP Fiori Launchpad will open-up in a new browser tab with the application tile in it:

Figure%2027%20-%20Fiori%20Launchpad

Figure 11 – SAP Fiori Launchpad

Click on the tile and the List Report page for the Project entity will be loaded:

Figure%2028%20-%20List%20Report%20page%20for%20Project%20entity

Figure 12 – List Report page for Project entity

Now, click on the Go button and the initial test data (loaded to the HANA database from the CSV files) will be displayed:

Figure 13 – Initial test data displayed

And that’s it! You have successfully deployed a fully working SAP Fiori Elements application to SAP BTP Cloud Foundry!

You can, now, test it at your will, in the same way you did using the Fiori Preview in the steps of the blog post: Prepare the UI with CDS Annotations

Finally, the last step in the journey of this blog posts series is to add your application to a user-driven launchpad using SAP BTP’s Launchpad Service.

Conclusion

After having gone through the steps of this blog post you should have successfully deployed your solution to SAP BTP Cloud Foundry utilizing the MTA (Multi-Target Application) approach and the centralized HTML5 application repository managed by the Launchpad Service. Now, to finally complete the full job, it’s come the time to add it as a tile to a user-driven launchpad.

NOTE: all the instructions provided in this blog post apply exactly the same to any CAP project using an HTML5 application as the UI and that should be deployed to Cloud Foundry on SAP BTP using the HTML5 applications repository (managed approuter).

Please, do not hesitate to submit your questions in SAP Community through the Q&A tag link: https://answers.sap.com/index.html

Next blog post in this series

  • Add Application to the Launchpad