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 Cloud Foundry or XS Advanced App that Queries SAP HANA

Create a Node.js app that queries SAP HANA and can be run in Cloud Foundry or XS Advanced.

Overview

🎓 beginner 15 min. SAP HANA CloudBeginnerSAP HANA Cloud SAP HANA DatabaseSAP HANASAP HANA Express EditionNode JsSAP BTP Cloud Foundry EnvironmentSAP Business Technology PlatformSAP Connectivity Service

You will learn

  • โœ”How to use the command line interface (CLI) to deploy a Node.js app to Cloud Foundry or XS advanced
  • โœ”How to view the logs and enable tracing in the deployed app
  • โœ”How to connect from a Node.js app running in Cloud Foundry to an on-premise SAP HANA instance through the Cloud Connector

Prerequisites

Prerequisites

  • You have completed the first 4 tutorials in this mission

Steps

Intro

In the previous tutorials, applications that queried SAP HANA were run on a local machine. In this tutorial, a simple application will be run within the SAP BTP which uses Cloud Foundry or within the SAP HANA, express edition which uses XS advanced (and is also based on Cloud Foundry).

For additional details, consult Developing Applications on SAP BTP, Cloud Foundry runtime or The XS Advanced Programming Model.


Step 1 Get started with the Command Line Interface (CLI)
โ€”

The command line interface (CLI) for Cloud Foundry is named cf while the CLI used for apps running in SAP HANA, express edition is named xs.

  1. Check to see if you have the CF CLI installed and verify the version.

    Shell
    cf -v

    cf cli version
    cf cli version

    To install the CLI, see Installing the cf CLI. After installing, add the Cloud Foundry folder to your path environment variable.

    Check to see if you have the XS CLI installed and verify its version.

    Shell
    xs -v

    xs cli version
    xs cli version

    The installer for xs can be downloaded from SAP Software Downloads under SAP HANA PLATFORM EDITION | SAP HANA PLATFORM EDITION 2.0 | XS RUNTIME 1.

  2. Access help by running the following:

    Shell
    cf help
    cf help login
    Shell
    xs help
    xs help login
  3. Log in to the Cloud Foundry or XS advanced.

    Shell
    cf login

    cf login
    cf login

    If you are an SAP employee, you may need to enter your password followed by a two-factor authentication passcode or if you have single sign-on enabled use the –sso option.

    The API URL, if requested, can be found in the Overview page in SAP BTP cockpit.

    api URL
    api URL

    The API URL can be set with the below command.

    Shell
    cf api <API Endpoint>

    XS advanced

    Shell
    xs login

    xs login
    xs login

    The API URL, if requested, can be verified in the XSA is up app.

    xsa running
    xsa running

  4. Additional examples are shown below to view the target information, running services, and deployed apps.

    Shell
    cf target
    cf services
    cf apps
    cf buildpacks

    XS advanced

    Shell
    xs target
    xs services
    xs apps
    xs buildpacks

    services
    services

    Additional details can be found at Getting Started with the cf CLI and Get Started with the XS CLI Client.

Step 2 Create Node.js app that queries SAP HANA
+
Step 3 Deploy and test in SAP BTP or XS Advanced
+
Step 4 Additional commands
+
Step 5 Connect from the Node.js app running in the cloud to an on-premise database (optional)
+
Step 6 Knowledge check
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 6
1. Get started with the Command Line Interface (CLI) 2. Create Node.js app that queries SAP HANA 3. Deploy and test in SAP BTP or XS Advanced 4. Additional commands 5. Connect from the Node.js app running in the cloud to an on-premise database (optional) 6. Knowledge check

Learn more →