SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Create a User Interface with CAP (SAP HANA Cloud)

Use services based on SAP Cloud Application Programming Model Node.js and use an SAP Fiori wizard to create a user interface.

Overview

🎓 beginner 20 min. SAP HANA CloudBeginnerSAP HANASAP Business Application StudioSAP Cloud Application Programming Model

You will learn

  • โœ”How to create an SAP Fiori freestyle web interface
  • โœ”How to configure the approuter

Prerequisites

Prerequisites

  • This tutorial is designed for SAP HANA Cloud. It is not designed for SAP HANA on premise or SAP HANA, express edition.
  • You have created database artifacts and loaded data as explained in the previous tutorial.

Steps

Step 1 Run the services
โ€”

  1. From the previous tutorial we have a .env file in the /db folder. This file contains the connection details to the SAP HANA Cloud instance and it was created when we performed the bind operation from the SAP HANA Projects view.

    .env file
    .env file

  2. We can use this same configuration information from Cloud Foundry to start the CAP service layer and connect it to SAP HANA as well. Use the command cds bind -2 MyHANAApp-dev:SharedDevKey to tell CAP to bind to this same HANA Cloud HDI service instance that we bound to earlier in the SAP HANA Projects view.

    cds bind to db service
    cds bind to db service

  3. Run the command npm install to install any Node.js dependent modules needed by the Cloud Application Programming Model.

    npm install
    npm install

  4. Our project is setup for real XSUAA security and we will use that later in this tutorial. But for now we want to test without configuration of the necessary authentication and authorization setup. To do so, open the package.json file in the root of your project. Change the cds.requires.auth property from xsuaa to mocked so we can test with mock authentication.

    Mocked Authentication
    Mocked Authentication

  5. Now issue the command cds watch --profile hybrid. This will start the CAP service locally and use the binding configuration to connect to our remote HANA database instance. Once started you will see a dialog with a button that says Open in New Tab. Press this button to test the CAP service in a new browser tab.

    npm start
    npm start

    If you accidentally close this dialog, you can always open the running services via View > Command Pallette and then choosing Ports: Preview and choosing the running service from the list

  6. You should see the list of entities you exposed.

    Welcome Page
    Welcome Page

  7. You can click on the entities to see the values in a JSON format being served from the SAP HANA Cloud database.

    Service Test
    Service Test

Step 2 Test the services
+
Step 3 Configure routing
+
Step 4 Create a Fiori web interface
+
Step 5 Enahance the Fiori UI via Annotations
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Run the services 2. Test the services 3. Configure routing 4. Create a Fiori web interface 5. Enahance the Fiori UI via Annotations

Learn more →