What is SAP Cloud Application Programming Model (CAP)?

 In this tutorial series, we will focus on learning SAP Cloud Application Programming Model (CAP).

CAP is a framework, that would not only guide developers, but also take away some of the more technical or foundational tasks to help them focus on their business logic. Business logic is the key differentiator for what you are developing.

SAP CAP is both open and opinionated. The programming model is a combination of tools, languages, and libraries that will help you build enterprise-grade services and applications.

The goal is to guide developers and minimize boilerplate content, so they can focus on what's important the business logic.

As you can see in this graphic, we support both open-source and SAP tools and technologies.

Components of CAP

    1) Core Data Services (CDS) is the data modelling infrastructure. CDS is known as the backbone of the programming model, as it provides the means to capture service definitions and data models, queries, and expressions in plain object notations.

    2) Service SDKs - It supports libraries available for both Java and Node.js, which can be used to provide and consume services through synchronous and asynchronous APIs. The SDKs include out-of-the-box integration to lower-level platform services, such as authentication and credential-flows or on and off-boarding of SaaS tenants.

    3) SAP BAS, Fiori Elements, SAP HANA - SAP BAS is the IDE of choice, there is Support for SAP HANA and SAP Fiori Elements.


Design Principles

When it comes to design principles, there is open and opinionated concept.

It's open because it gives you choice. You can choose which technology to use, you can select your architecture pattern, you can pick and choose the parts of the programming model that suit your development needs best. But it's also opinionated, because we provide but it's also opinionated, because we provide for you to follow SAP’s recommended approach.

Zero Lock-In

You can choose any technology of your choice, that there is no locked-in, mandatory path with this programming model. To build your UI, you can use SAP Fiori Elements, or you can use any other alternative technology as well.


The programming model is non-intrusive, i.e. it is completely free of assumptions. Here the main goal here is to reduce boilerplate code, which would be the same regardless of the architecture or methodology you choose.


You can build applications in a way that is independent from the underlying cloud infrastructure. To achieve this by using an API-first approach that avoids hard wiring to any given technology.


Let’s understand with an example Hello World application using CDS and node.js using SAP BAS as IDE.

I hope you are well versed with the basics of SAP BAS. If you aren’t, please check my previous blog on introduction to SAP BAS and setting up.

Introduction to SAP BAS

Setting up SAP BAS

This is the home page of SAP BAS.

Go To terminal and enter cd projects

CDS Init helloworld create a new project template and you can search the project in the projects directory.

As you can see, by using cds init, the project structure was already created with a folder for the services, for the database, and for the UI.
Now lets define a service in the srv folder and name it as say.cds

Now, we need to implement the service. To do so, we create another file say.js.

Now, go to the terminal and we can run our little hello world application.

So using cds run, we should get a running service.

We can edit the url to run our hello world request. 


And we'll see the value returned as "Hello world".So I hope you learned how to build a small HelloWorld application using CDS and node.js on SAP BAS. In the coming blogs, we will explore more about CDS and SAP CAP.
Next Post »