Defining Data Entities: What is CDS?

CAP CDS (Cloud Application Programming Model Core Data Services) is a key part of the SAP CAP (Cloud Application Programming Model) framework. Think of it as a simple, smart way to describe your data (like customers, orders, or products) in a format that is easy to understand and reuse across different apps. Instead of writing complex code for each service, CDS lets you define your data once, and then use it everywhere. This makes building apps faster and keeps everything consistent.
Integration with:
- SAP HANA Cloud
- PostgreSQL
- SQLite (local testing)
Example: Defining Entities with CDS
entity Authors {
name : String;
books : Association to many Books;
}
entity Books {
title : String;
author : Association to Authors;
genre : Association to Genres;
}
entity Genres {
name : String;
parent : Association to Genres;
}
What this example defines:
- Authors — stores author names and their associated books.
- Books — stores book titles and links each book to an author and a genre.
- Genres — stores genre names and supports hierarchical relationships through a parent genre.
- Associations — define relationships between entities, making it easier to navigate and work with related data.