Skip to content

Installing the Tools

SAP Business Application Studio

From the SAP Business Application Studio home page, click on the Create Dev Space button.

  • Enter a Dev Space name, e.g. test.

  • Select the SAP Mobile Application kind of application.

  • Click on the Create Dev Space button.

  • Wait while the Dev Space is STARTING.

  • When the Dev Space is RUNNING, click on the underlined Dev Space name.

  • From the Terminal menu, select the New Terminal option.

  • After the $ prompt in the Terminal window, enter a mkdir command to create a project folder. For example:

    mkdir ~/projects/test
    
  • From the File menu, select the Open... option, and use it to open the project folder that was created in the Terminal window in the previous step.

Note

The Visual Studio Code Extension, Java Development Kit, Apache Maven, Apache Tomcat and Cloud Foundry CLI are preinstalled in SAP Business Application Studio, so the corresponding installation sections in this document can be skipped. The subsequent sections for Visual Studio Code Commands and Visual Studio Code Tasks are still applicable to SAP Business Application Studio.

Visual Studio Code Extension

Visual Studio Code can be used to access the mobile back-end tools on a desktop computer system.

Install Java Development Kit

  • Download and install the SapMachine Java Development Kit (JDK). Ensure that the JDK version that you download and install is not for a more recent version of Java than is supported by your intended target Java application server, and is also at least Java 11.

  • Ensure that the JAVA_HOME environment variable is set in the PATH and that it refers to the correct JDK installation.

    Mac/Linux Terminal:

    $JAVA_HOME/bin/java -version
    

    Windows Command Prompt:

    %JAVA_HOME%\bin\java -version
    
  • Restart Visual Studio Code (if running) so it can pick up the PATH change. Running the java -version command in a Visual Studio Code Terminal will verify that the PATH setting has been picked up.

Install Apache Maven

  • Download and install Apache Maven.

  • Ensure that the mvn command is available in the PATH by issuing the following command in a Windows Command Prompt or Mac/Linux Terminal.

    mvn -help
    
  • Restart Visual Studio Code (if running) so it can pick up the PATH change. Running the mvn -help command in a Visual Studio Code Terminal will verify that the PATH setting has been picked up.

Install Apache Tomcat

This step is optional, but may be helpful for local testing, or on-premise production deployment, of your generated OData service.

  1. Download and install Apache Tomcat 9 (for Java EE), or preferably Apache Tomcat 10+ (for Jakarta EE).

    If you will use Apache Tomcat 9 (for Java EE), you should add the -javax option to the server-app.options file that will be generated later when you create the OData service.

  2. Note that the following instructions refer to CATALINA_BASE and CATALINA_HOME which are described in Tomcat Directories and Files.

  3. Configure Tomcat as appropriate to your local environment. To enable generated OData services to access your target database, create the $CATALINA_BASE/conf/jdbc/DefaultDB.properties file with configuration parameters as defined by Apache Commons DBCP. You might need to create the $CATALINA_BASE/conf/jdbc folder if it doesn't already exist.

    The following example configures Tomcat to access a local SAP HANA Express Edition database.

    driverClassName=com.sap.db.jdbc.Driver
    url=jdbc:sap://hxehost:39013?autocommit=true&currentschema=myschema
    username=SYSTEM
    password=MyHanaPassword
    

    To obfuscate (hide) the password, see Local Password Obfuscation.

    Alternatively you may define a jdbc/DefaultDB Resource in $CATALINA_BASE/conf/config.xml.

  4. Copy the JDBC driver file(s) for your database (e.g. ngdbc.jar for SAP HANA) to the $CATALINA_HOME/lib folder (or the $CATALINA_BASE/lib folder).

Note

Steps 3 and 4 above can be deferred if you will initially use the -h2db option for an Embedded H2 Database (for testing only).

Install Cloud Foundry CLI

If you wish to enable command-line deployment to SAP Business Technology Platform (Cloud Foundry environment), including when using Visual Studio Code Tasks, install the Cloud Foundry Command Line Interface.

Ensure that the cf command is available in the PATH by issuing the following command in a Mac/Linux Terminal or Windows Command Prompt.

cf help
  • Restart Visual Studio Code (if running) so it can pick up the PATH change. Running the cf help command in a Visual Studio Code Terminal will verify that the PATH setting has been picked up.

Note

Before attempting deployment to Cloud Foundry, you should use the cf login command to connect and login to your Cloud Foundry space. This needs to be repeated whenever the login expires (e.g. daily).

Visual Studio Code Commands

Note

This section is also applicable to SAP Business Application Studio.

The mobile back-end tools extension provides two additional commands to the Command Palette, accessed by View > Command Palette...

  1. MBT: New OData CSDL document (metadata)

    • Command parameters:

      • Schema namespace
      • Namespace alias
      • Metadata file name
    • You might already have a CSDL document, in which case place a copy of it into your project's root folder instead of creating a new document, and refer to the Conventions for OData Metadata describing the xmlns:xsi and xsi:schemaLocation attributes which enable the XML Language Support by Red Hat extension to locate the XML Schema files for OData CSDL validation.

    • Use the file extension .csdl.xml for OData CSDL XML files.

    • The SAP Mobile Services OData CSDL modeler extension allows visualization of an OData CSDL XML file. Open it using the context menu (usually right mouse click), Open With... OData CSDL Modeler.

    • Once you have created the CSDL document you can use the project file creator.

  2. MBT: Create Mobile Backend Server Project

    • Command parameters:

      • Application Folder
      • Metadata File
      • Application Name
      • Database Type
      • Database Instance
      • Enable XSUAA (for security)
    • After entering the requested information, this command should display progress information in a Terminal window and eventually show "BUILD SUCCESS".

    • The generated project files include:

      • .vscode/tasks.json
      • Java source files which can be edited if customization is required.
      • Various .options files containing parameters and settings for the generated server.
    • Once you have created the project files, you can use Terminal > Run Task to invoke the service generator tool to build or deploy the OData service. You can make changes to the service metadata or customize previously source code or .options files, then run the same task again to rebuild or redeploy the service.

Visual Studio Code Tasks

Note

This section is also applicable to SAP Business Application Studio.

You can access the service generator tool through tasks.

By default, the generated project includes a tasks.json file which defines several tasks:

  • build-mobile-server - regenerates (as needed) and re-compiles the source files into a WAR file which can later be deployed into SAP Business Technology Platform Cloud Foundry.

  • deploy-mobile-server - regenerates (as needed) and re-compiles the source files into a WAR file, and deploys it into SAP Business Technology Platform Cloud Foundry.

  • preview-mobile-server - regenerates (as needed) and re-compiles the source files into a WAR file and deploys it into a local Apache Tomcat server.

The generated WAR file will be located in your project's deploy subfolder. (Maven builds typically use the target subfolder, but that is used by Visual Studio Code's auto-build features, so the deploy folder is used to avoid conflicts between auto-builds and task-initiated builds).

Generated Options Files

By default, the generated project includes several .options files, which you can customize as needed.

  • build-cloud.options - build options for Cloud Foundry.

  • build-local.options - build options for Local Preview.

  • deploy-cloud.options - deployment options for Cloud Foundry.

  • deploy-local.options - deployment options for Local Preview.

  • server-app.options - server name and version.

  • server-db.options - options for target database.

  • server-log.options - options for debug / trace logging.

Please refer to Service Generator Tool Options for information on the available generation options. Add any additional required options to whichever .options file(s) seem most appropriate.

Any line in an options file starting with a "#" sign is treated as a comment.


Last update: May 13, 2025