Hi, my name is Denys van Kempen, SAP HANA Academy.
You are watching a video tutorial that is part of a series about the SAP Business Technology
Platform, SAP Extension Suite certification.
The topic of this tutorial is CAP.
This video was recorded in June 2022.
For the latest tutorials on the topic, please check the playlist.
SAP’s Cloud Application Programming model, CAP in short, is listed with a weight of 24%,
about 20 questions, one in four, that is, clearly a mayor topic.
Unlike the other topic areas, there is no unit dedicated to CAP in the Learning Journey.
Instead a business case is presented with one or more exercises in each unit, showing
you how to build an extension app for SAP S/4HANA Cloud hosted in the Cloud Foundry
environment of the SAP Business Technology Platform, BTP, using CAP as progamming model
with SAP Business Application Studio as development tool.
In this series, we will go through these steps, highlighting the main points, but of course,
doing the exercises yourself is definitely recommended to get a good grip on CAP.
What’s CAP?
A framework of languages, libraries, and tools for building enterprise-grade services and
applications.
The concepts are explained here, on the cap.cloud.sap website,
the design principles, CDS, core data services as modeling language
for both domain models, think the database schema,
and service definitions, which cover how data is made accessible.
Service SDKs and runtime for Node.js (JavaScript) and Java.
Agnostic design, not hardwired to any specific technology.
Open and opinionated, you can use any development tool you like but CAP recommends SAP Business
Application Studio, Fiori for the user interface, and HANA for the database.
Main objective is to enable the developer to focus on the domain, on the business case
to solve, and not on the infrastructure: what, not how.
The anatomy of a typical application with the UI, service, and domain models, as we
will see in a minute, here the concepts are explained.
A getting started with Hello World, a Cookbook, all highly recommended reading should you
wish to learn more about CAP.
However, you might want to delay this until after the exam, as most of this will be out
of scope.
You are expected to be familiar with CAP, not to have completely mastered it.
CAP is featured as topic on the SAP Community.
Here you can find a link to the openSAP training, for example.
There are several tutorials on the SAP Developer Center, YouTube videos, code samples, and
so on.
CAP, by the way, was introduced back in 2018, about 3 years ago, here we have the blog post.
Covering the golden path: define your data model, define your services, add custom logic,
add Fiori UIs, reuse existing services, exactly as we will be doing as well for the business
case of this course For now, let’s focus on the case.
CAP is opioniated, as metioned, which we are going take into consideration by using the
Business Application Studio as development tool.
You can use a local development environment, Visual Studio, Eclipse, but then you will
need to install and maintain the required components, the software, yourself.
Let’s create a new dev space.
There are different types.
Full stack is to build business servcies and applications, extend S/4HANA using CAP, Fiori,
and Node, with predefined extensions, exactly what what we need.
For the trial environment, you are allowed two dev spaces with only 1 running at a time.
Takes a minute or so.
Powers up a Kubernetes pod for us in the background.
The welcome page, accessible from the Help menu.
We can start a new project from a template, opens a new tab, and select either CAP, Fiori,
or MTA, multi-target application.
There is some overlap.
We will be using MTA later on, to bundle the different software modules for deployment.
For the UI we are also going to use Fiori but with this template you can create an SAPUI5
ap without using CDS and the Cloud SDKs.
To start a CAP project, we simply run the command cds init with the name of the app,
of the project, and this will then scaffold the application with a folder, directory,
for the UI (app), for the service model (srv) and the data model (db), with a package.json
file.
Open as folder.
There is no code yet, the folders are empty, a readme with instructions,
pointing to the CAP website with the instructions how to get started with
a local setup: install Node, SQLite, and CDS.
We find these as dependencies in the package.json file
and use the node package manager, npm, to install.
This is all classic Node.js.
For the extension suite certification some familiarity is assumed, although there are
no questions testing your JavaScript or Java knowledge.
When CDS is installed, we can run the cds command, which returns usage information.
The full documentation, as mentioned, can be found on the capire website: cap.cloud.sap
For this business case, we are going clone from Git.
A starter template for the learning journey, from the SAP-samples repository on Github.com.
Open in a new workspace.
Pretty much the same as the result of cds init with the app, db, and service folders,
some sample data has been added to db as CSV file plus an EDMX for the SAP S/4HANA Cloud
Business Partner OData API, available for download from the API Business Hub, which
we covered in a previous video, an XML file.
Package.JSON defining our Node.js application with dependencies, which we can install with
the npm command, takes a minute or so.
Again, this is pure Node; nothing to do with CAP or SAP software.
When we close and open package.json, the red curls are gone, all is well.
To start with our project, we can run the cds watch command, which will monitor our
project space and compile on-the-fly.
No data or service models are found in db, srv, and elsewhere, waiting for some to arrive.
The business case, the tutorial, follows the same approach as described in getting started.
Start with a sample or with cds init, launch cds watch, define the data model, define the
service model, adding the UI, we will be using Fiori, custom logic, and so on, this is known
as the golden path.
That’s it for step one.
We will cover the data and service model in the next video.
You can find the links to the resources mentioned in the description of this video below.
This video tutorial was recorded by Denys van Kempen, SAP HANA Academy.
Any good?
Give us a like, and for updates, don’t forget to subscribe.
Thanks for watching.