CDS, Open SQL, and AMDP: The Three Pillars of Code Pushdown

15 min read

CDS, Open SQL, and AMDP

The introduction of SAP HANA fundamentally changed how ABAP applications are developed.

In traditional ABAP systems, most calculations, aggregations, and business processing were executed on the application server. SAP HANA introduced the ability to execute these operations directly at the database layer through the Code Pushdown paradigm.

To enable this approach, SAP provides three primary technologies:

  • Core Data Services (CDS)
  • Enhanced Open SQL
  • ABAP Managed Database Procedures (AMDP)

Together, these technologies form the foundation of modern SAP application development.

Each technology serves a different purpose and should be used in the appropriate scenario.

CDS Open SQL and AMDP
CDS, Open SQL, and AMDP form the three primary technologies that enable Code Pushdown in SAP HANA.
Click image to enlarge

Understanding the Code Pushdown Toolbox

Think of CDS, Open SQL, and AMDP as three tools available to an ABAP developer.

Just as a carpenter uses different tools for different tasks, SAP developers choose between CDS, Open SQL, and AMDP depending on the complexity and requirements of the solution.

The goal is not to use the most powerful tool.

The goal is to use the simplest tool that solves the problem efficiently.

Core Data Services (CDS)

CDS is SAP's strategic data modeling framework.

It is the preferred technology whenever business data needs to be modeled, reused, secured, exposed, or consumed by applications.

CDS is commonly used for:

  • RAP Business Objects
  • Fiori Elements Applications
  • OData Services
  • Embedded Analytics
  • Reporting Applications
  • APIs

CDS allows developers to define:

  • Business Entities
  • Associations
  • Compositions
  • Calculated Fields
  • Aggregations
  • Access Controls
  • Metadata Annotations

all within a single semantic data model.

Because CDS is reusable, multiple applications can consume the same CDS entity without duplicating logic.

Real Project Example: Sales Order Business Object

Consider a Sales Order business object.

Instead of repeatedly joining VBAK, VBAP, KNA1, and other related tables in multiple programs, a CDS View Entity can model the complete Sales Order structure once.

The same CDS entity can then be reused by:

  • RAP Applications
  • Fiori Apps
  • OData Services
  • Reports
  • APIs

This promotes consistency and reduces maintenance effort.

Enhanced Open SQL

Open SQL is the standard database access layer used within ABAP programs.

Over the years SAP significantly enhanced Open SQL to support many database-side operations that previously required ABAP processing.

Modern Open SQL supports:

  • SQL Expressions
  • CASE Statements
  • Aggregations
  • Joins
  • Subqueries
  • UNION Operations

This allows developers to push more processing to the database while remaining entirely within ABAP code.

When Should You Use Open SQL?

Open SQL is ideal when:

  • Logic is specific to a single ABAP program.
  • Reusability is not required.
  • A full CDS model would be unnecessary.
  • Database access is relatively simple.

Real Project Example: Custom Purchase Order Report

A custom report may need to calculate open purchase orders for a specific business process.

If the logic is only required in that report and will not be reused elsewhere, Open SQL may be sufficient.

Creating a dedicated CDS entity could introduce unnecessary complexity.

ABAP Managed Database Procedures (AMDP)

AMDP is the most powerful Code Pushdown technology available to ABAP developers.

AMDP allows developers to write database procedures directly using SAP HANA SQLScript while integrating them seamlessly into ABAP applications.

AMDP is typically used when requirements exceed the capabilities of CDS and Open SQL.

Examples include:

  • Complex Calculations
  • Advanced Algorithms
  • Predictive Logic
  • Specialized SAP HANA Functions
  • High-Performance Data Transformations

Because AMDP is database-specific, it should generally be considered the last option after evaluating CDS and Open SQL.

Real Project Example: Financial Forecasting Application

A financial forecasting application may require advanced statistical calculations that cannot be expressed efficiently using CDS or Open SQL.

In such cases, AMDP allows developers to execute the logic directly inside SAP HANA using SQLScript.

Choosing the Right Technology

A common mistake among developers is assuming that AMDP should always be used because it provides the highest level of control.

SAP recommends the opposite approach.

Start with the simplest option and move to more advanced technologies only when necessary.

The general recommendation is:

  1. CDS
  2. Open SQL
  3. AMDP

If a requirement can be solved using CDS, use CDS.

If CDS is not sufficient, consider Open SQL.

Only use AMDP when neither CDS nor Open SQL can efficiently solve the problem.

Why CDS Is SAP's Strategic Choice

Although all three technologies support Code Pushdown, CDS has become SAP's preferred development model.

This is because CDS provides far more than database access.

CDS combines:

  • Data Modeling
  • Business Semantics
  • Security
  • Metadata
  • Service Consumption
  • RAP Integration

into a single framework.

This makes CDS the foundation of modern SAP application development.

Most new SAP innovations, including RAP and Fiori Elements, are built on top of CDS.

CDS vs Open SQL vs AMDP

FeatureCDSOpen SQLAMDP
Primary PurposeData ModelingProgram Database AccessAdvanced Database Logic
ReusableYesNoLimited
AnnotationsYesNoNo
RAP CompatibleYesIndirectNo
OData ExposureYesNoNo
Complex AlgorithmsLimitedLimitedExcellent
Recommended Priority1st Choice2nd ChoiceLast Choice

Architect Perspective

Architect Insight

A common misconception is that AMDP is always the fastest option.

In reality, SAP recommends using the highest-level abstraction possible.

CDS should be your first choice because it provides semantic modeling, security, annotations, service consumption, and RAP integration in addition to database access.

AMDP should be used only when CDS and Open SQL cannot efficiently express the required logic.

Interview Questions

BeginnerInterview Question

What are the three primary technologies used for Code Pushdown in SAP HANA?

Answer: The three primary Code Pushdown technologies are Core Data Services (CDS), Enhanced Open SQL, and ABAP Managed Database Procedures (AMDP).

ExperiencedInterview Question

When should Open SQL be preferred over CDS?

Answer: Open SQL is ideal when the logic is specific to a single ABAP program, does not require reuse, and does not justify creating a dedicated CDS model.

ArchitectInterview Question

When should you choose AMDP over CDS?

Answer: AMDP should only be used when the requirement cannot be efficiently implemented using CDS or Open SQL. Examples include advanced SAP HANA SQLScript functionality, complex calculations, predictive algorithms, or specialized performance-critical processing.

💡 Key Takeaway

CDS, Open SQL, and AMDP are complementary technologies that enable Code Pushdown in SAP HANA.

CDS should be the default choice for data modeling and application development because it provides business semantics, security, annotations, service consumption, and RAP integration.

Open SQL is ideal for program-specific database operations, while AMDP should be reserved for advanced scenarios that require direct access to SAP HANA SQLScript capabilities.

Choosing the simplest technology that efficiently solves the problem is one of the most important design principles for SAP developers and architects.