SAP Business Technology Platform

Last modified: October 1, 2024

Introduction

As an SAP developer, you want to deploy your Mendix app on the SAP Business Technology Platform (SAP BTP). This document explains how you can create environments, deploy to the SAP BTP, and manage these deployments using the Mendix Portal.

This document describes two ways of managing the SAP BTP:

Setting Up SAP BTP for the First Time

Before you can manage your SAP BTP using the Mendix Portal, you will need to set it up. There are two circumstances under which you will have to set up the SAP BTP for the first time.

  1. You have an existing app which has never been deployed on SAP BTP and you want to change the cloud settings. See Change Cloud Settings.

  2. You are creating a new app from an SAP app template. See New SAP App.

Changing the Cloud Settings

In this scenario, you have an existing app which is running in another environment: for instance, on Mendix Cloud. To change this, open your app in Apps, go to Settings, and then switch to the Cloud Settings tab.

Click Set up SAP Cloud to go to the SAP BTP welcome page.

Click Getting Started, then continue with Set Up Region.

New SAP App

In this scenario, you choose a Mendix app template for SAP SAP Apps tab and give it a name.

Once the app has been created you can continue with Set Up Region.

Setting up the Region

You are now prompted with an SAP BTP login screen. Select the region where your SAP BTP is located.

Make sure that you have enough quota in this region for your organization to run a Mendix app. You will need enough quota to create the following:

  • Database
  • Route
  • Binding to XSUAA

If you have already logged on to SAP and your SAP session has not expired, you will only have to choose the region. If you do not have a current SAP session you will be asked for your SAP credentials as well. Providing your credentials will grant the Deployment Portal access to manage your SAP BTP account.

You may be asked to provide your credentials in one of two ways:

  • You will be taken to the SAP authentication page to enter your credentials – in this case, your SAP user name (email address) must be the same as your Mendix user name
  • The Mendix Portal will ask for your credentials, which it will then use to obtain an access token from SAP – the Mendix Portal will then use the access token, but it will not store your credentials (⚠ please note this method is being deprecated)

You will now be asked to provide the final details for the SAP BTP development environment.

You will be able to choose a Domain, Organization, and Space which is configured for you in this region.

If you do not choose a Custom database, you will still be able to choose from a range of different databases, PostgreSQL, Hyperscaler Option and SAP HANA for example. Please ensure that the database you choose is supported by your quota plan for this region and organization. See Databases in SAP BTP, below, for important information on selecting the correct database for your app.

If you select Yes for Custom database?, you will be asked for the Name and the Plan.

After the environment has been created successfully, you will see a confirmation message. Your development environment is now configured and you ca develop your app.

Creating a New Environment

You can create several environments for your app. For example, you may have created a development environment, but you may want environments for test, acceptance, production, and so forth. Additionally, when you switch from another cloud you need to create at least one environment for your Mendix application.

You can do this in the Environments page after opening your app in Apps.

Your Environments page will show you the following:

  • a list of deployment packages for this app
  • a list of environments for this app
  • all the deployment activities which have been performed on this app

To create a new environment, perform the following steps:

  1. Click Add Environment to start the wizard.

  2. Select the region where you want your app to be deployed.

    If no session is active for that region, or the current session does not have access to that region, you will be asked for your SAP credentials for that region.

  3. Select the Domain, Organization, and Space of your app. The URL of the domain will form part of the application’s URL. The URL of the application will be this:

    {appname}-{environment name}.{domain}
    

    This is an example URL:

    https://myapp-development.cfapps.eu10.ondemand.com
    
  4. Click Next.

  5. Enter the name of the environment. This can be anything you choose: for example Test, Acceptance, or Production.

  6. Set the size of the memory that the app needs in order to run. This can also be changed later.

  7. Set Development Mode to Yes if you want the application to run with the Mendix security level of Prototype/demo, or Off (no security). This is not recommended for acceptance or production environments.

  8. Select the database you would like to use. Be aware that even if a specific database is part of the Marketplace it could still be unavailable because of limitations imposed by the quota of your Organization. See Databases in SAP BTP, below, for important information on selecting the correct database for your app.

    If you choose Custom database you will need to enter a name for the database and the plan.

  9. Select File Store Enabled if your application makes use of FileDocument or Image objects. Other sorts of object do not need File Store to be enabled.

  10. Set a Subscription Secret (required). This secret is associated with your Mendix production license. By entering the subscription secret, your application will run in this environment as production. If the subscription secret is invalid, your app will still run, but will restart every 2-4 hours and have a limitation of six concurrent users.

  11. If you want the user to be redirected to a custom URL after they have logged in using XSUAA then, optionally, add Redirect URLs.

  12. Click Next to create the environment and finish the setup.

An environment is created; with more than one environment it is possible to transport your application between environments (see Transport App Between Environments, below).

Preparing Packages for Deployment

There are two ways of getting a package ready to deploy to SAP.

  • Creating a package directly from a version of the app model held in Team Server
  • Uploading a package which has already been created

Creating a Package from Team Server

At any time, you can create a new deployment package from a committed version of the project. If you are working with Mendix Studio Pro, you will first have to commit the project.

  1. Open the app in Apps.

  2. Go to the Environments page.

  3. Click Create package from Team Server to start the wizard.

  4. Select the branch on the Team server which you want to use.

  5. Select the revision of the branch you want to build.

  6. Add a version number and Tag description as required. The revision number will be added to the version number automatically.

  7. Click Build this revision to build the package.

When the package is ready to be deployed, a green tick will be shown next to the deployment package. To deploy your package, follow the instructions in the Deploy Package section, below.

Uploading an MDA

Alternatively, you can upload an MDA which has already been created from the app model, for example using Create Deployment Package from the App menu in Studio Pro.

  1. Click Upload in the Deployment Package Repository.

  2. Select the package accessible to your local machine.

  3. Click Upload to upload the MDA.

    Upload button and dialog for uploading MDAs

The package will be added to the list of packages in the Deployment Package Repository. To deploy your package, follow the instructions in the Deploy Package section, below.

Deploying a Package

Deploying to an Environment

  1. A green tick indicates that the build has finished. Click Deploy to deploy the package to SAP BTP.

  2. Change the deployment environment if required.

  3. The Timeout value indicates how long (in seconds) Cloud Foundry will wait between starting an app and the first healthy response from the app before deciding that the application has failed to start. For some apps, the default (60 seconds) is too short. If your app is failing to start you can try increasing this value using the Change timeout option.

  4. Click Transport to deploy the package to the SAP environment. This will replace any current app deployed to this environment. If the app is already running, you will be asked to stop it so that your new app can be deployed.

Configuring the Application

  1. You will see confirmation of the package which has been transported.

  2. Change any constants in the Constants tab: select the constant you want to edit and then click Edit.

  3. Toggle any scheduled events in the Scheduled Events tab: select the scheduled event you want to enable or disable and click Toggle.

  4. Select any additional services you need for your app. For more information see Binding Services, below.

  5. Click Continue to continue to the Start Application confirmation page.

  6. Click Start Application to start the application on SAP BTP.

  7. When the application has been started you will receive a confirmation message. Click OK and you will be taken to the Environment Details page for the selected environment. See Environment Details, below.

Unbinding and Deleting Service Instances

If you want to remove a service instance from your environment, you can do it is follows:

  1. Click the three-dot menu for the service and select Unbind Service or Delete Service.

    The options will do the following:

    • Unbind Service – unbind the service instance and move it to the Services To Be Bound section — the service will be bound next time your app is restarted
    • Delete Service – unbind the service instance from the application and delete the service instance from your environment

Transporting an App Between Environments

  1. Click Transport on the source environment you want to transport to another environment. Environments without deployed apps will have the transport button grayed out and cannot be transported.

  2. Change the deployment environment if required by clicking Change environment.

  3. The Timeout value indicates how long (in seconds) Cloud Foundry will wait between starting an app and the first healthy response from the app before deciding that the application has failed to start. For some apps, the default (60 seconds) is too short. If your app is failing to start you can try increasing this value using the Change timeout option.

  4. Click Transport to deploy the package to the SAP environment. This will replace any current app deployed to this environment. If the app is already running, you will be asked to stop it so that your new app can be deployed.

When the app has been transported you will be on the page Configure the Application. This has the same options as the Deploy pages which are described above in the Configure the Application section.

Environment Details

The environment details page contains the following four tabs:

  • General – how the application is deployed on SAP BTP
  • Model Options – application constants and scheduled events
  • Services – Cloud Foundry service management
  • Runtime – custom environment variables which define User-Provided Variables in SAP Cloud Foundry environment — pre-defined variables can be used to control the behavior of the Mendix Runtime

Open the environment details by clicking Details on an environment on the Environments page of the Development Portal. You will also be taken to this page when you successfully deploy or transport your app.

General Tab

This tab contains information on how the application is deployed on SAP BTP.

Most of this page shows information about the app, but there are several options which allow you to change the app.

Start and Stop Application

If the application is running, click Stop Application and confirm when asked to stop the application.

The button will change to Start Application which you can click to (re)start the application.

If you receive an error trying to start the app, please refer to the App Will Not Start section under Issues, below.

Change Admin Password

Click Change Admin Password to change the password for the administrator account (by default, MxAdmin) in your Mendix app.

View Recent Log

Click View Recent Log to see recent events written to the log.

Delete Environment

Delete Environment enables you to delete the environment and, optionally, all its resources: including the app.

You will be asked to confirm that this environment should be removed. You will also be asked to confirm that the resources associated with the environment should also be removed. Note that the default is NOT to remove the resources.

Change Development Mode

Click Change to change the Development Mode toggle. Set it to Yes if you want the application to run with only prototype security, or completely without security. This is not recommended for acceptance or production environments.

Change App URL

Click Change to change the App URL for this environment.

Change Redirect URLs

Click Change to change the Redirect URLs. Redirect URLs are custom URLs (for example, appname.subdomain.domain.com) where the user will be redirected after signing on using XSUAA, instead of being redirected to the generated URL (for example, appname.cfapps.eu10.hana.ondemand.com) of the app.

Scaling

If the app is started or stopped (that is, the environment has been created successfully and the app has been deployed without errors) then options to scale the app are available.

Use the Instances slider to change the number of instances of the app which can run. This allows you to scale the app horizontally to support a large numbers of users, or to improve the app’s resilience by allowing it to continue to run if there are any issues with one of the instances.

Use the Memory per instance slider to change the amount of memory allocated to each instance of the app (“user’s current memory”).

Click Scale Now to apply the new settings. If the application is running, it will be stopped and restarted to apply the settings. If it is stopped it will not be started automatically; the new settings will be used the next time the application is started.

Click Reset to return the values to what they were before the sliders were moved.

Change License Subscription ID

Click Change to change the subscription secret which is the code which registers your production Mendix license to this environment.

Model Options Tab

This tab displays the application constants and allows you to edit them. It also lets you enable or disable scheduled events.

Scheduled Events

You can see the status of each scheduled event. CURRENTLY ENABLED shows the status in the running app. ENABLED shows that status that will be applied the next time the app is restarted.

To change the state of a scheduled event, select it, then click Toggle to change the ENABLED flag.

Constants

You can see the value of all the constants used by the app. CURRENT VALUE is the value in the running app. NEW VALUE is the value which will be used the next time the app is restarted.

To change a value, select the constant you want to change and click Edit.

Services Tab

This tab displays Cloud Foundry services which are bound to the app, waiting to be bound to the app, or available to be bound to the app. These are the services which are available to you in SAP BTP and are the same services that you can see in the SAP BTP marketplace.

Connecting Services

To connect a service in the Available Services section, do the following steps:

  1. Select one or more services (you can search for them by name).

  2. Select a Plan for each service. This must be a plan which is part of your quota for this space.

  3. Select a JSON File to upload if you need to add extra configuration.

  4. Click Connect Services.

    The services you have selected will be added as Services To Be Bound. Now, you can upload JSON File with a configuration that will be applied to the service binding.

To upload the JSON File for service binding, follow these steps:

  1. Select the service in the Service To Be Bound section.
  2. Click More Options ( ) next to the service for which you want to upload the file.
  3. Select Add Binding Configuration.
  4. Select the JSON File to upload.
  5. Click Save.

The service bindings will be created with the provided configurations when you restart the application.

If you receive an error trying to restart the app, please refer to the App Will Not Start section under Issues, below.

Unbinding and Removing Services

If you no longer require a service, you can unbind it or remove it from your app.

Unbinding a Service
  1. Click More Options ( ) next to the service you want to unbind in the Bound Services section.

  2. Select one of the following:

    • Unbind Service – unbind the service instance and move it to the Services To Be Bound section — the service will be bound again next time your app is restarted
    • Delete Service – unbind the service instance from the application and delete the service instance from your environment
  3. Confirm by clicking the appropriate button

    • Unbind
    • Delete & Restart App
    • Delete – if you want to unbind more services or do not want the change to happen immediately, then you can choose Delete. However, this may leave the app in an unstable state as the service will be deleted from the environment
    • Cancel – do not delete or unbind this service

    Once the service is deleted, it is deleted from the app environment and returned to the list of Available Services. If the service is unbound but not deleted, it is returned to the list of Services To Be Bound, and will be rebound next time the app is restarted.

Removing an Unbound Service
  1. Click More Options ( ) next to the service you want to remove in the Services To Be Bound section.

  2. Select Remove Service.

  3. Confirm by clicking Remove.

    The service is deleted from the app environment and returned to the list of Available Services.

Add Binding Configuration

When a service is in the Services To Be Bound section, you can add a new binding configuration, if this is supported by the service and the Mendix Portal.

If you want to change the configuration of a service which is already bound, you will need to unbind the service first, as described above.

  1. Click More Options ( ) next to the service you want to (re)configure in the Services To Be Bound section.

  2. Select Add Binding Configuration.

  3. You can either use the Configurator to create your configuration by clicking Open Editor, or click Browse… to upload an existing file as the configuration.

    See the documentation for the service you are configuring for more information.

Service Names

The services which are created by the Mendix Portal will be named automatically. You will see these names in the SAP BTP cockpit. The name of the service will normally be App name + _ + Environment Name + _ + a random 6-character suffix. All spaces will be removed from the app and environment names. For example, MyApp_Development_c7sd9q.

However, the maximum length for the service name is 50 characters. If this limit would be exceeded by the name created above, an alternative service name will be used. The format of this is Environment Name + _ + a random 6-character suffix. If the Environment name is longer than 43 characters, only the first 43 characters are used.

Runtime Tab

In the Runtime tab, you can Add, Edit, or Delete custom runtime settings and environment variables.

Custom Runtime Settings

You can add custom server settings which configure Mendix Runtime beyond the standard SAP deployment. See Runtime Customization and the Mendix Cloud Foundry Buildpack GitHub repository for information about the settings which are available.

Custom Environment Variables

Supported Environment Variables

You can choose to add supported variables by selecting them from a drop-down list.

  • DT_PAAS_TOKEN – the token for integrating your Dynatrace environment with Cloud Foundry
  • DT_SAAS_URL – the monitoring endpoint URL of the Dynatrace service
  • DT_TENANT – the unique identifier of your Dynatrace environment
  • NON_MENDIX_PUBLIC_CLOUD - must be set to true when using Datadog, Dynatrace, or other similar tools
List of custom environment variables

The variables beginning DT_ set up Dynatrace. Setting these variables means that the Dynatrace OneAgent is loaded into your environment. You will then receive all J2EE-related metrics from your app. See Dynatrace OneAgent for more information.

Unsupported Environment Variables

You can also enter other environment variables which can be used to support Mendix features which are in beta. In this case, click No for Supported and enter the name of the variable as well as its value.

List of custom environment variables

Databases in SAP BTP

Mendix needs access to a relational database back end and can run using different types of database. For deployment to SAP BTP, you have the choice of PostgreSQL, Hyperscaler Option or SAP HANA.

Running Mendix on PostgreSQL, Hyperscaler Option

Select the postgresql-db (PostgreSQL, Hyperscaler Option) database service.

You will need to upload a file which contains the configuration for this database – click Browse… to select your configuration file. You can use the SAP Hyperscaler PostgreSQL Configurator to help you create the configuration file and find more information in the Parameters section of PostgreSQL on SAP Business Technology Platform, Hyperscaler Option in the SAP Help Portal.

During the creation of the environment, the selected PostgreSQL, Hyperscaler Option service will be added to your space and, when you deploy your app, the app will be bound to it.

This database service should not be unbound from your environment: see Services Tab, above, for more information on required services.

SAP Hyperscaler PostgreSQL Configurator

To get help to create the configuration file, click the Configurator button.

On the new page which is displayed you can set the required values for your SAP Hyperscaler PostgreSQL database. Tooltips describe the values which you need to provide.

Click Upload Configuration To Service to automatically apply the generated configuration to the PostgreSQL, Hyperscaler Option database service. Alternatively, click Download Configuration File to create the file which you can then use on the Services tab to configure your PostgreSQL, Hyperscaler Option database.

Running Mendix on SAP HANA

SAP HANA Configuration for Full Accounts

To run a Mendix application on SAP BTP using SAP HANA as the database, there are two options. Both these options need to be set up in the SAP BTP cockpit. You can choose one of the following options:

  • Provision the SAP HANA DB Service and make it available in your application space.
  • Provision SAP HANA Cloud and make this service available to your application space.

Once one of these services is available, you can use the SAP Cloud deployment functions of the Mendix SAP Mendix Portal to deploy your app and use the HANA_SCHEMA service to bind your application to the provisioned service. The HANA_SCHEMA will create a separate schema on the SAP HANA Database which isolates your application’s data from other applications. In this way the SAP HANA DB/Cloud Service will be shared across applications.

If you have issues with your app running on SAP HANA, you will need to use the SAP BTP cockpit to investigate. The Mendix Portal does not have information on the status or configuration of the SAP HANA service.

SAP HANA Configuration for Trial Accounts

For new trial accounts, you can bind your Mendix app to a trial SAP HANA database. Just choose hanatrial-securestore from the drop-down of supported databases.

Some older trial accounts do not include hanatrial-securestore. In this case you will get an error when you try to deploy your Mendix app saying that provisioning has failed because service hanatrial with plan securestore is not found.

SAP HANA Performance Tuning

If your SAP HANA database has performance issues, you may be able to improve performance by performing the following tuning:

  1. Obtain the following service binding credentials from the SAP BTP cockpit, or via the cli:

    • Host
    • Url
    • Schema
    • Password
    • User
  2. Go to the Runtime tab of your app environment

  3. Enter the following unsupported environment variables with the associated values, using the values taken from the service binding credentials:

    Variable Value
    MXRUNTIME_DatabaseHost {host}
    MXRUNTIME_DatabaseJdbcUrl {url} + &nonBlockingIO=false&timeZonePerObject=false&packetSize=130000&closeHandlesByCleaner=false&transactionalLobs=false&maxLazyDroppedStatements=100&statementCacheSize=500&deferredPrepared=true
    MXRUNTIME_DatabaseName {schema}
    MXRUNTIME_DatabasePassword {password}
    MXRUNTIME_DatabaseUserName {user}
    MXRUNTIME_DatabaseType SAPHANA
  4. Go to the General tab and restart your app to apply the changes.

The additional parameters that you added to the url in the MXRUNTIME_DatabaseJdbcUrl will set the following tuning parameters:

Parameter Value
closeHandlesByCleaner false
deferredPrepare true
maxLazyDroppedStatements 100
nonBlockingIO false
packetSize 130000
statementCacheSize 500
timeZonePerObject false
transactionalLobs false

Deleting an App

If you are the last person to leave a Mendix app you can delete the app. However, this will not delete the app or resources on SAP BTP. To leave the app, find it on the My Apps page in the Mendix Portal, and then click Leave app.

If you are the last member of the app development team, you will be asked if you want to delete the app.

You can still delete the app and its resources from the SAP BTP cockpit, but you will then have to remove all the resources individually.

Troubleshooting

If you encounter any issues with your apps on SAP BTP, use the following troubleshooting tips to help you solve them.

Environment is not Created

If you add an environment and it fails to be created it will be shown with a red symbol next to it on the Environments page:

Cause

This could be caused by exceeding your organization quota limit for a service which you are trying to create, or for some other reason. To find the exact cause, do the following:

  1. Click Details next to the failed environment.

  2. Click Details on the error message at the top of the page.

A more detailed description of the reason why the environment creation failed will be displayed.

Solution

Resolve the issue described in the error message.

App Will Not Start

Under some circumstances an app with a service in the Services To Be Bound status will not restart. You will get an error with Could not bind service… in the details.

Cause

This indicates that SAP Cloud Portal is not able to bind the service, even though it has been instantiated correctly.

Solution

If you remove the service from the app, the app should restart successfully.

If you are trying to bind more than one new service, it is not possible to identify within the Mendix Portal which service is causing the issue. If the culprit is not obvious, you will have to remove all the services or go to SAP Cloud Portal where you can use the service name in the error message to find which service is causing the error.

An Error Occurs While Deploying App From Studio Pro

If an app is deployed to SAP using the Studio Pro Run or Publish button before it has been started from the Mendix Portal, the deployment will fail.

Cause

The deployment fails because the marketplace services have not been bound.

Solution

If you use the Mendix Portal to look at the details of the environment to which you are deploying, you will see that the services are still waiting to be bound.

Start the app from the Mendix Portal to bind the services. Once they are bound, you can deploy your app from Studio Pro, as usual.

Error: Unable to Initialize Metrics Client: Unsupported Metric Type

The app cannot be started with Datadog, Dynatrace, or other similar tools configured. The following error is displayed: Caused by: com.mendix.metrics.MonitoringConfigurationError: Unable to initialize Metrics client: unsupported metric type: statsd.

Cause

Starting from Mendix version 9.7, the support for the statsd is removed.

Solution

  1. In the Runtime tab, in the Custom Environment Variables section, add a new variable with the following settings:

    • Supported - select Yes
    • Name - select NON_MENDIX_PUBLIC_CLOUD
    • Value - select true
  2. Redeploy your application, and then restart it. Just restarting the app is not sufficient because additional dependencies need to be included.

Status of SAP BTP Deployment

The Mendix status page (https://status.mendix.com/) shows the current status of Mendix services. If you have issues with deploying to SAP BTP via the Mendix Portal, you can check the Mendix status page to see if SAP BTP deployment is operational (under Mendix Services) or if there are other Mendix issues which may be affecting your deployment.

Read More