CDS Language Components: Understanding DDL, QL, and DCL

12 min read

Understanding DDL, QL, and DCL

Core Data Services (CDS) is often described as an extension of SQL.

While this description is technically correct, CDS provides much more than traditional SQL.

CDS introduces a collection of domain-specific languages that allow developers to define data models, query data, and control data access within a single framework.

These language components work together to create secure, reusable, and semantically rich business models.

The three primary CDS language categories are:

  • Data Definition Language (DDL)
  • Query Language (QL)
  • Data Control Language (DCL)

Understanding these components is important because they form the foundation of modern SAP application development.

CDS Language Components
DDL, QL, and DCL work together to create secure and reusable business models.
Click image to enlarge

Data Definition Language (DDL)

Data Definition Language (DDL) is used to create and define CDS entities.

Whenever developers create a CDS View Entity, they are working with DDL.

DDL is responsible for describing:

  • Business Entities
  • Fields
  • Associations
  • Compositions
  • Calculated Elements
  • Annotations
  • Semantic Relationships

Rather than thinking in terms of database tables, DDL encourages developers to model business objects.

Real Project Example: Sales Order Business Object

Consider a Sales Order business object.

Using DDL, a developer can define:

  • Sales Order Header
  • Sales Order Items
  • Customer Information
  • Product Information

along with the relationships between these entities.

The resulting CDS model becomes the foundation for reports, APIs, RAP applications, and Fiori applications.

Why DDL Matters

DDL allows SAP developers to build a reusable semantic layer above database tables.

Instead of repeatedly implementing joins and calculations, business structures are modeled once and reused throughout the system.

Query Language (QL)

Query Language (QL) is responsible for retrieving and processing data from CDS entities.

It provides SQL-like capabilities while taking advantage of SAP HANA's processing engine.

QL supports:

  • Filtering
  • Sorting
  • Aggregations
  • Grouping
  • Calculated Fields
  • Expressions

Although developers may not directly interact with QL every day, it powers the execution of CDS queries behind the scenes.

Real Project Example: Revenue Analytics Application

A finance application may need to retrieve:

  • Total Revenue
  • Total Tax Amount
  • Monthly Sales Figures

Instead of processing this data on the application server, QL allows SAP HANA to perform these calculations directly within the database.

The application receives only the final result.

Why QL Matters

QL is one of the key enablers of the Code Pushdown paradigm.

It allows business calculations to execute where the data resides rather than transferring large datasets to ABAP programs.

Data Control Language (DCL)

Data Control Language (DCL) provides authorization and security capabilities for CDS models.

While DDL defines what data exists and QL retrieves the data, DCL determines who can access the data.

DCL allows developers to implement row-level security directly at the CDS layer.

This means access restrictions are enforced regardless of the consuming application.

Real Project Example: Purchase Register Authorization

Consider a Purchase Register application.

A purchasing manager may be allowed to view purchase orders belonging only to a specific purchasing organization.

Instead of implementing authorization checks separately in every report, API, or application, DCL can enforce the restriction centrally.

Any application consuming the CDS entity automatically inherits the same security rules.

Why DCL Matters

Security implemented at the CDS layer provides:

  • Consistent Authorization Behavior
  • Reduced Development Effort
  • Improved Maintainability
  • Better Compliance

This is one of the major advantages of CDS compared to traditional database views.

How DDL, QL, and DCL Work Together

The three language components are designed to complement each other.

DDL

Defines the business data model.

QL

Retrieves and processes the data.

DCL

Controls who can access the data.

Together they provide a complete framework for modern enterprise application development.

Instead of treating data modeling, querying, and security as separate concerns, CDS brings them together within a unified architecture.

CDS Beyond Traditional SQL

Traditional SQL focuses primarily on data retrieval.

CDS extends this concept by adding:

  • Business Semantics
  • Associations
  • Compositions
  • Annotations
  • Metadata
  • Security
  • Service Consumption Capabilities

This is one of the reasons why CDS has become the strategic foundation for SAP S/4HANA, RAP, Embedded Analytics, and SAP Fiori.

Understanding CDS Language Components

LanguagePurposeExample
DDLDefine business entities and relationshipsSales Order CDS View Entity
QLRetrieve and process business dataRevenue Aggregation Query
DCLControl access to dataPurchase Organization Authorization

Architect Perspective

Architect Insight

Many developers initially think CDS is simply a modern replacement for database views.

In reality, CDS combines data modeling, data processing, and security within a single framework.

This is why CDS serves as the foundation for RAP Business Objects, Fiori applications, OData services, Embedded Analytics, and SAP APIs.

Interview Questions

BeginnerInterview Question

What are the three primary language components of CDS?

Answer: The three primary CDS language components are Data Definition Language (DDL), Query Language (QL), and Data Control Language (DCL).

ExperiencedInterview Question

What is the role of DCL in CDS?

Answer: DCL provides authorization and security capabilities. It allows developers to implement row-level security directly at the CDS layer so that access restrictions are consistently enforced across all consuming applications.

ArchitectInterview Question

Why is CDS considered more than just a replacement for database views?

Answer: CDS combines semantic data modeling, business relationships, query capabilities, metadata annotations, security, service exposure, analytics, and RAP integration within a single framework. Traditional database views primarily focus on data retrieval.

💡 Key Takeaway

CDS consists of three major language components:

  • DDL for defining business entities and data models.
  • QL for querying and processing data.
  • DCL for implementing security and access control.

Together they create a complete framework for building reusable, secure, and high-performance business applications in SAP S/4HANA and RAP.