ERPClimb logoERPClimb
SAP technical topicObjectCDS vs Open SQL vs AMDP: Choosing the Right ABAP Data LogicModuleRAP_CDS_ODATA

CDS vs Open SQL vs AMDP: Choosing the Right ABAP Data Logic

Open SQL is the default imperative database-access language inside ABAP code; CDS models reusable semantic data views with associations, annotations and authorization/analytics metadata; AMDP executes SQLScript methods directly in HANA for logic that genuinely needs database-specific procedural capability. Start with Open SQL or CDS, use CDS when the model should be reusable/semantic, and choose AMDP only when plain Open SQL/CDS cannot express the required pushdown cleanly.

Practitioner guide to CDS vs Open SQL vs AMDP: Choosing the Right ABAP Data Logic, with architecture, use cases, worked example, decision criteria, pitfalls, S/4HANA context, ownership and production verification guidance.

Reviewed by an ERPClimb SAP consultant on 20 Sept 2026· 705 words

What it is

Open SQL is embedded in ABAP and ideal for a program/service that needs a query close to its application logic. CDS entities are repository data models consumed by multiple programs, RAP/OData, analytics and authorization frameworks; annotations and associations give them semantics beyond SQL text. AMDP methods are ABAP class methods whose implementation runs as SQLScript in HANA, enabling procedural/database-specific operations and serving as implementations for CDS table functions. Each moves more logic toward the database but increases coupling/reuse complexity differently.

When to use it

Use Open SQL for straightforward program-specific reads/writes and set-based calculations. Use CDS when data shape is a reusable business model, needs associations/text/authorization/analytics annotations, or is a RAP/service projection. Use AMDP when a proven calculation cannot be expressed adequately in Open SQL/CDS and benefits materially from HANA SQLScript—complex procedural set processing, specialized HANA functions or table-function logic. Do not use AMDP just to make code look 'HANA optimized'.

How it fits the stack

Open SQL can select from tables and CDS entities. CDS can layer on other CDS sources and expose services/analytics. CDS table functions delegate implementation to AMDP. HANA optimizer sees generated SQL from all these layers, but AMDP/table functions can create optimization boundaries and are HANA-specific. ABAP Unit/testing and authorization patterns differ: CDS DCL works with CDS access; AMDP logic may require explicit attention to semantics.

A worked example

A report needs one aggregation with two joins: modern Open SQL is sufficient. Several apps need a consistent 'Sales Order Analytical Cube' with texts, units, measures and access control: CDS is the better reusable model. A specialized allocation algorithm requires procedural SQL over large datasets and cannot be expressed cleanly in CDS; after trace/prototype evidence, an AMDP/table function is justified. The team avoids moving ordinary SELECT logic into SQLScript.

How to choose

  • Program-local straightforward query: Open SQL first.
  • Reusable semantic/API/analytics model: CDS.
  • Database-specific procedural algorithm with proven need: AMDP.
  • Avoid deep CDS layering when a simpler model/query is clearer and faster.
  • Measure HANA plan/runtime before assuming more pushdown equals better performance.

Common pitfalls

  • Using AMDP for ordinary joins/aggregations supported by Open SQL/CDS.
  • Building one giant CDS stack for logic used by only one small program.
  • Ignoring DCL/authorization when exposing a reusable CDS model.
  • Putting application side effects/transaction control inside data-read AMDP logic.
  • Choosing based on developer preference rather than reuse, semantics and measured performance.

ECC, S/4HANA and clean core

CDS and modern Open SQL are primary S/4HANA/ABAP Cloud data access tools. AMDP remains available for HANA-specific pushdown in permitted environments, but ABAP Cloud/released API restrictions apply to consumed data objects. New clean-core development should prefer released CDS entities/APIs and use AMDP only within supported extension boundaries.

Whose problem this is

ABAP developers own Open SQL; data/RAP architects own reusable CDS models; HANA specialists may support AMDP/plan analysis. Functional owners define grain, joins and measures. Architecture review should justify HANA-specific coupling.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-technical-topics/cds-vs-open-sql-vs-amdpERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.