Skip to content

Latest commit

 

History

History
134 lines (88 loc) · 5.71 KB

File metadata and controls

134 lines (88 loc) · 5.71 KB

In the following we describe how to get started with the Incidents Management application, which we use throughout the exercises.

Set Up SAP Business Application Studio (BAS)

  1. Start Google Chrome (BAS runs best with that browser)
  2. Open the URL of SAP Business Application Studio. We have prepared an account for you here -> open this page in a new browser tab
  3. 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 credentials button. Take a note of the credentials as you may need them later.
  4. Log in by copying the credentials from the previous step to the BAS logon screen
  5. Provide a name for your dev space, for example dev
  6. Create a dev space of type Full Stack Cloud Application (might take a few minutes).
  7. Enter the dev space by clicking on it's title → a page like this appears:

Welcome screen in SAP Business Application Studio

Clone and Open the Project

Open a terminal (press Control Shift ` , type > Create New Terminal in the search bar or use the main menu)

Open new Terminal SAP Business Application Studio

In the terminal, run:

cd projects
git clone --branch training https://github.com/SAP-samples/cap-sample-incidents-mgmt

If 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:

Open project in SAP Business Application Studio

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@6

If 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.

Inspect the Application

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

Domain model

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;
  };
}

Learn more about Domain Modeling in CAP

Now try the following:

  1. Find db/schema.cds in the file explorer
  2. Open it in CDS Text Editor.
  3. 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 Tasks

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

Run the Application

First things first, let's run the application. In the terminal, execute in the incidents folder:

cds watch

In the following exercises, always use the folder cap-sample-incidents-mgmt as working directory in the terminal (unless stated otherwise). If you get errors like no 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:

Open project in 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 watch again.

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:

Incidents UI

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.

Summary

Now that you have a first version of the application running, continue to the first exercise.