In the following we describe how to get started with the Incidents Management application, which we use throughout the exercises.
- Start Google Chrome (BAS runs best with that browser)
- Open the URL of SAP Business Application Studio. We have prepared an account for you here -> open this page in a new browser tab
- Get your user credentials - We have prepared test users for you here. -> open this page in a new browser tab. Retrieve a user by clicking the
Get fresh credentialsbutton. Take a note of the credentials as you may need them later. - Log in by copying the credentials from the previous step to the BAS logon screen
- Provide a name for your dev space, for example
dev - Create a dev space of type Full Stack Cloud Application (might take a few minutes).
- Enter the dev space by clicking on it's title → a page like this appears:
Open a terminal (press Control Shift ` , type > Create New Terminal in the search bar or use the main menu)
In the terminal, run:
cd projects
git clone --branch training https://github.com/SAP-samples/cap-sample-incidents-mgmtIf you are using the SAP-internal version of BAS, checkout branch
training-int, which is already on @sap/cds^7.
Then open the project using the Open Folder command (F1 > Open folder). Select the cloned project folder projects > cap-sample-incidents-mgmt like this and press OK:
In the new workspace, again open a terminal, and run
npm i
npm add @sap-cloud-sdk/http-client
npm i -g @sap/cds-dk@6If you are using the SAP-internal version of BAS, install the latest version of @sap/cds-dk via
npm i -g @sap/cds-dk.
This installs the necessary modules for the incidents application plus the SAP Cloud SDK HTTP Client, which helps with remote communication.
The cds command line tool is updated as well to the latest version.
Let's see what we got in the project. The conceptual domain model for this Incidents Management application is as follows:
- Customers can create Incidents (either directly or via agents)
- Incidents have a title and a Conversation of several Messages
A condensed version in the CDS language is as follows:
entity Customers {
key ID : UUID;
name : String;
}
entity Incidents {
key ID : UUID;
title : String;
customer : Association to Customers;
conversation : Composition of many {
timestamp : DateTime;
author : String;
message : String;
};
}Now try the following:
- Find
db/schema.cdsin the file explorer - Open it in CDS Text Editor.
- Alternatively, use Open with... > CDS Graphical Modeller in SAP Business Application Studio
Which entity is missing?
The Customers entity is missing at the moment.
Your task in the following exercises is to
- Define Customers
- Not as a 'normal' local entity, though
- But as a projection on a remote entity of an SAP S/4HANA system
- So that at runtime the customer data comes from the remote system
- With as minimal load as possible to the remote system
- Integrate it nicely into the rest of the data model
First things first, let's run the application. In the terminal, execute in the incidents folder:
cds watchIn the following exercises, always use the folder
cap-sample-incidents-mgmtas working directory in the terminal (unless stated otherwise). If you get errors likeno model found, this usually means you are in the wrong folder.
In SAP Business Application Studio, wait for the little popup in the bottom right corner to appear. Click Open in a New Tab:
It might be that the new browser tab is blocked. If this happens, no worries:
- Unblock future popups from this host. See the address bar for the little popup manager icon.
- Press Ctrl+C in the terminal, and run
cds watchagain.
Tip: You can always open a running application's tab using the Ports Preview command. Use F1 and type Ports to find the command.
The application should have come up with an address like https://port4004-workspaces-ws-...applicationstudio.cloud.sap/.
On the application's index page, go to Incidents → Fiori preview, which opens an SAP Fiori elements list page for the Incidents entity. It should look like this:
With regards to the UI screens that you see here: this is not a tutorial on SAP Fiori. Instead, we use the minimal screens necessary to illustrate the relevant points. For a full-fledged SAP Fiori Elements application using CAP, see the SFlight application.
Now that you have a first version of the application running, continue to the first exercise.




