Skip to main content
SAP BTP

Introducing Core Data Services (CDS) in the SAP Cloud Application Programming Model (CAPM) – Part 1

Ravi Krishna Thota Ravi Krishna Thota, Ravi Krishna Thota is a Developer based out of Mindset’s Hyderabad office 3 min read

There are 5 types of languages & notations in Core Data Services (CDS). Before I dive into the definitions it’s important to touch on the importance of CDS in the SAP ecosystem. You will learn ‘what’ & ‘how’ CDS commands a position of importance.

What is SAP CAPM?

SAP Cloud Application Programming Model (CAPM) is a framework of languages, libraries, and tools for building enterprise-grade services and applications. It guides developers along a golden path of proven best practices and offers a wealth of out-of-the-box solutions for recurring tasks. The main compounds of CAPM is

  1. Core Data Services(CDS)
  2. Service SDK’s

What Exactly is Core Data Services?

CDS is the backbone of the SAP CAPM. It is a collection of domain-specific languages that help you focus on your specific business domain model during development.

Diagram: CDS, JSON, YAML and CODE boxes on the left connect to a central cube labeled CNS, which links to OData, Open API, Async API, JSON/YAML, SQL DDL and HANA DDL

Primarily, it provides the means to declaratively capture service definitions and data models, queries, and expressions in plain (JavaScript) object notations. CDS features parse from a variety of source languages and to compile them into various target languages.

CDS models are plain JavaScript objects complying to the Core Schema Notation (CSN), an open specification derived from JSON Schema. You can easily create or interpret these models, which foster extensions by 3rd-party contributions. Models are processed dynamically at runtime and can also be created dynamically.

CDS is our universal modeling language for both domain models and service definitions.

CDS have different types of Languages and Notations: Now we come to the parts & preludes of the CDS model. They also comply better with different databases.

  1. Definition Language(CDL)
  2. Schema Notation(CSN)
  3. Query Language(CQL)
  4. Query Notation(CQN)
  5. Expression Notation(CXN)

CDS and Types diagram: CDL, CQL and CQN all lead to CSN, which feeds OData, API and other targets

Definition Language(CDL):

Let’s go through one of the languages from the domain the Definition language(CDL).

CDL is a human readable syntax for defining your models. Let’s see some of the available definitions of the language:

  • Entities
  • Views
  • Associations
  • Aspects
  • Types
  • Service definitions and more

Table of CDL definitions for Entities, Views and Association, each with a short explanation and CDS code example

Table continued: CDL Aspects and Types, with an aspect managed example and predefined vs structure types

Table continued: custom type examples and Service Definitions with CatelogService code samples

Core Schema Notation (CSN)

CSN is pronounced as ‘Season’ too. It is a notation for compact representation of data and service models (Json or CDS model). It’s developed to understand, share and interpret models with minimal dependencies.

It is similar to JSON schema but goes beyond the ability to capture full-blown entity-relationship models and extensions. However, the CSN models are more concise and secure.

The CSNs’ models are examples of the perfect source to generate target models such as OData/EDM or OpenAPI interfaces & persistence models for SQL or NoSQL databases.

JSON file icon

Example for convert to CDL entity/service into CSN:

Two panels showing a CDL entity and a CDL service next to their CSN JSON equivalents

Different types of CSN Models:

CSN Models and Types: one model written in JSON, in YAML and as a plain JavaScript object

In the next part of this series, I will discuss CDS in SAP programming, talking specifically about Query Language(CQL), Query Notation(CQN), Expression Notation(CXN), and Demo Project.

If you are interested in viewing similar articles, visit our blog, here.

View our LinkedIn, here.

Share