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

Deploy a CAP Business Service to SAP Business Technology Platform

This tutorial shows you how to deploy your SAP Cloud Application Programming Model (CAP) application to SAP Business Technology Platform (BTP), Cloud Foundry environment using SAP HANA Cloud service.

Overview

🎓 beginner 30 min. SAP Cloud Application Programming ModelBeginnerNode JsSAP Business Technology PlatformSAP FioriSAP HANA Cloud

You will learn

René Jeglinsky R René Jeglinsky December 10, 2024
Created by December 10, 2024
Contributors

Prerequisites

Prerequisites

Steps

Intro

It’s now time to switch to SAP HANA as a database and prepare your project for an MTA deployment to SAP BTP Cloud Foundry. To continue with this tutorial you need to use an existing SAP HANA Cloud service instance or set up a new SAP HANA Cloud service instance to deploy your CAP application.

Your SAP HANA Cloud service instance will be automatically stopped overnight, according to the server region time zone. That means you need to restart your instance every day, before you start working with your trial.

Step 1 Enhance project configuration for production

  1. If cds watch is still running in VS Code, choose Ctrl + C in the command line to stop the service.

  2. To prepare the project, execute in the root level of your project in VS Code:

    Shell/Bash
    cds add hana,mta,xsuaa,approuter --for production

    --for production adds all configuration added by this command in the package.json file into a cds.requires.[production] block.

    hana configures deployment for SAP HANA, so a data source of type hana is added in the cds.requires.[production].db block. See section Node.js configuration in the CAP documentation for more details.

    mta adds the mta.yaml file. This file reflects your project configuration.

    xsuaa creates an xs-security.json and also the needed configuration in the mta.yaml file. An authentication of kind xsuaa is added in the cds.requires.[production].auth block.

    approuter adds the configuration and needed files for a standalone AppRouter so that the authentication flow works after deployment.

    Learn more about those steps in the Deploy to Cloud Foundry guide in the CAP documentation.

  3. Update your dependencies, as with the previous command you added some dependencies to your package.json.

    Shell/Bash
    npm update --package-lock-only
  4. (Optional) Following this tutorial strictly, you don’t have an own UI yet in your project. To enable the index page with SAP Fiori preview, add the following configuration in the package.json of your my-bookshop project in VS Code:

    JSON
    "cds": {
      "fiori": {
        "preview": true
      },
      "server": {
        "index": true
      },
    }

    server.index:true enables the generated index page also in production mode as you saw it in your local application in the previous tutorial in step 4 when using cds watch. fiori_preview:true enables SAP Fiori preview in the same way. These features are meant to help you during development and should not be used in productive applications.

Step 2 Identify SAP BTP Cloud Foundry endpoint
+
Step 3 Deploy using cf deploy
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 3
1. Enhance project configuration for production 2. Identify SAP BTP Cloud Foundry endpoint 3. Deploy using cf deploy

Learn more →