SAP Business Application Studio, Multitenancy in SAP BTP

Multitenant SaaS application using productivity tools in Business Application Studio

Transitioning to the cloud and developing multitenant applications is a key requirement that nearly every customer has these days. When working with SAP Business Application Studio using productivity tools it is possible for you to achieve this goal with minimum efforts.

To dive deeper, let’s start by understanding multitenancy and its benefits.

What is Multitenancy?

With multitenant architecture a single instance of an application serves multiple consumers. Application providers can own, deploy, and operate tenant-aware applications for multiple consumers. Consumers share resources, so they are used more effectively with reduced costs. The application consumers can launch the applications using consumer-specific URLs and can configure certain application features. SAP Business Technology Platform provides such a multitenant functionality.

There are 3 key terms with respect to multitenancy:

  • Provider Account: This is a sub-account in an SAP Business Technology Platform Global account on which the application is deployed.
  • Consumer/Subscriber Account: This can be a sub-account in an SAP Business Technology Platform’s Global account (owned by customer or SAP) in which the application is subscribed for the customer. This sub-account is owned by the customer.
  • Tenant aware service – This is a service (SaaS) that separates the data of each tenant or subscriber.

With multitenant applications, you can:

  • Isolate data securely for each tenant
  • Optimize resources by sharing them among tenants.
  • Update applications for all tenants in one step instead of approaching it one by one.
Multitenancy

Steps to develop and deploy a multitenant application in Cloud Foundry are:

  1. Create a multitenant CAP application in SAP BTP.
  2. Deploy the Multitenant application to provider subaccount in Cloud Foundry.
  3. Configure the approuter application.
  4. Bind the multitenant application and approuter to xsuaa service instance.
  5. Register application to SAP SaaS Provisioning service.
  6. Application is available to consumers for subscription.

How can you achieve this using SAP Business Application Studio Productivity tools:

  1. Create a CAP application, using SAP Business Application Studio and Enable SaaS multi-tenancy in Guide center.
  2. Deploy the Multitenant application to provider subaccount in Cloud Foundry.
  3. Application is available to consumers for subscription.

SAP Business Application Studio (Productivity Toolkit) provides a Collection of low code tools enabling developers to easily build full stack applications for desktop and mobile use.

Step1

Create a new project in SAP Business Application Studio using the Productivity Toolkit

Create Project

Create the Cloud Application Programming data model, Service and UI:

Create Data Model

Service

Create Service

UI Application

Create UI Application

After creating the application, go to the Guide Center from the left panel.

Open Guide Center

You will find a Guide “Enable SaaS in your Application”.

Enable Multitenancy

You will get a confirmation popup, select “Enable SaaS”.

Multi-tenancy will be enabled for your project.

Note: Once SaaS is enabled for your application, it cannot be reversed.

Multitenancy Enabled

Now, you can see that your project is marked as a SaaS project in the project explorer.

SaaS enabled Project

To view the multitenancy code, click on the explorer on the left-hand side panel and go to “package.json”. You will see that by using SAP Business Application Studio to enable Multitenancy, following has been automated:

  • Added package @sap/cds-mtxs to your project

  • Added these lines to your project’s json to enable multitenancy with sidecar

  • Added a sidecar subproject at mtx/sidecar with this json

  • Modified deployment descriptors such as mta.yaml for Cloud Foundry

Step 2

As a next step, deploy your application to Cloud Foundry. You can do so by clicking the three dots besides project name.

Note: SAP HANA Cloud instance must exist already in your SAP BTP subaccount where you are deploying this application

Deploy project to Cloud Foundry

Go to the dev space of your subaccount in SAP Business Technology Platform (SAP BTP) cockpit and you will find the following applications:

Applications

Step 3

Your service is now available on SAP BTP Cockpit service marketplace to be subscribed. Go ahead and subscribe to the application.

Please note that this application can be subscribed from subaccounts within the same Global account only.

Subscribe from Marketplace

Launch the application to check using the icon next to application name.

Rating: 0 / 5 (0 votes)