Search

Choose Your Preferred Tools

Use CAP with the development tool of your choice.

SAP Business Application Studio

Set Up Application Studio

Log on to SAP Cloud Platform Cockpit

  1. Enter the SAP Cloud Platform Trial cockpit.

  2. Choose Enter Your Trial Account to access the Cloud Foundry environment.

SAP Business Application Studio is also available in productive accounts.

Adding SAP Business Application Studio Subscription to Your Subaccount

  1. In the Subaccount overview, select the tile of the subaccount in which you want to enable the SAP Business Application Studio subscription.

    For the trial environment, SAP Business Application Studio is only available on Amazon Web Services (AWS) - Frankfurt and US East (VA) regions, see Working with Trial.

  2. From the navigation area on the left side, choose Subscriptions.

  3. On the Subscriptions page, search for studio.

  4. Choose SAP Business Application Studio.

  5. Choose Subscribe.

Assigning Permissions

  1. Navigate back to your subaccount.

  2. From the navigation area, choose Security > Trust Configuration.

  3. Select the relevant Identity Provider (IdP).

  4. Enter the E-Mail address of the user to whom you want to give permissions, and choose Show Assignments.

  5. Choose Assign Role Collection.

  6. From the Role Collection dropdown list, select the Business_Application_Studio_Developer role collection, and choose Assign Role Collection.

    See Assigning Permissions and Manage Authorizations in the SAP Business Application Studio documentation for more details.

Launch Application Studio

  1. Navigate back to your subaccount.

  2. From the navigation area on the left side, choose Subscriptions.

  3. On the Subscriptions page, search for studio.

  4. Choose SAP Business Application Studio.

  5. On the SAP Business Application Studio tile, select Go to Application.

Set Up Your Dev Space

  1. Choose Create Dev Space.

  2. In SAP Business Application Studio, provide a name for your dev space.

  3. Choose SAP Cloud Business Application as the application type.

    By selecting SAP Cloud Business Application, your dev space comes with several extensions out of the box that you need to develop SAP Cloud Business Applications. For example, CDS tools, Java Tools, and MTA Tools are built in. This saves setup time. See Developer Guide for SAP Business Application Studio for more details.

  4. Choose Create Dev Space.

    The creation of the dev space takes a while. You see that the status for your dev space will change from STARTING to RUNNING. See Managing Your Dev Spaces for more details.

  5. Once the dev space is running, choose the dev space by clicking on the dev space name.

Features in App Studio

Starting a New Project from Template

  1. From the Welcome tab, select New project from template.

    This starts the project wizard in a new tab.

  2. Select the template CAP Project and choose Next.

  3. Enter a project name and choose Next.

    You can add features now or later to your project.

  4. Choose to open your application in a new workspace and start working.

Running the Service

  1. Open the Run Configurations view from the activity bar.

  2. Select Create Configuration, the small [+] at the top of the RUN CONFIGURATIONS view.

  3. Select your project from the command palette.

    When your application is running, the Debug view and Debug Console open. If you’re prompted to expose a port, do that and open the application afterwards.

See SAP Business Application Studio documentation for more details, like binding services using the run configuration.

Using the SQL Tools

  1. Open the SQLTools view from the activity bar.

    If you’ve bound the service in your run configuration, the connection is already established.

  2. Select Add New Connection, the small database symbol at the top of the CONNECTIONS view.

  3. Select your database, for example, SQLite (Node Native).

  4. Enter a name for the connection.

  5. Enter the path to your database file, for example sqlite.db, and choose SAVE CONNECTION.

You might be prompted to install SQLite. Just confirm. Then your connection works.

Using the REST Client

  1. Create an *.http file in your project, for example, test.http.

    In the samples bookshop application, go to test/request.http. You can use this request together with a running bookshop application.

  2. Add a request to this file, for example:
     GET http://localhost:4004/browse/Books?
    
  3. Choose Send Request in the test.http file. You can see the response side by side in editor groups.

Restarting the Server

Restart the server when you did changes to your code using the Debug view restart button.

Samples

Develop a business application using CAP for Java. Start with the SAP Business Application Studio and deploy to SAP Cloud Platform in the mission Build a Business Application Using CAP for Java.

Visual Studio Code

Install Visual Studio Code

  1. Install Visual Studio Code and launch it.
  2. Only for macOS: Install the code shell command.

Add CDS Editor

  1. Go to Visual Studio Marketplace.
  2. Choose Install and VS Code opens the details page for the extension.
  3. In VS Code choose Install to enable the extension.

Run Services

To run services, just open the Integrated Terminal in VSCode and use one of the cds serve variants, for example, use cds watch to automatically react on changes.

Alternatively, you can use the preconfigured tasks or launch configurations you get when creating a project with cds init. For example, in the Debug view launch cds run with the green arrow button:

Debug Services

You can add and stop at breakpoints in your service implementations. For example, add one to line 10 of our srv/cat-service.js by clicking in the gutter as shown below:

… then send the …/Books request again to stop there.

Restart the Server

Restart the server when you did changes to your code using the Debug views restart button:

Eclipse

You Need To:

Using Docker

Prerequisites

Build an Image

Create a file called Dockerfile and add this content for a quick setup:

FROM node:lts-alpine

RUN apk add python

USER node
ENV NPM_CONFIG_PREFIX=/home/node/.npm
ENV PATH=$NPM_CONFIG_PREFIX/bin:$PATH

RUN npm i -g @sap/cds-dk

Build your first image:

docker build -t cds .

If you experience issues building that image, replace the first line FROM node:lts-alpine with FROM node:12.13.1-alpine3.10 as this version has been successfully tested.

Run a Service in a Container

  1. Run a container that is based on the image:
    docker run --publish 4004:4004 -it cds sh
    

    You’ll see a $ command prompt from inside the container.

  2. Write a simple cds file:
    echo 'service CatalogService { entity Books { key ID: UUID; } }' \
     > services.cds
    
  3. Run the service:
    cds watch
    
  4. Open http://localhost:4004 in a browser to test the application. You forwarded the port 4004 when running the container, which allows you to access the application as if it would run locally.