CDS Views Part 1: What CDS Is and Your First View Entity
Free sample lesson · open to everyone
Understand what Core Data Services (CDS) are, why SAP moved data modelling from SE11 into CDS, how to create a first CDS view entity in Eclipse ADT, and how a classic ABAP report reads from it like a normal table.
In this lessonShow sectionsHide sections
Visual overview
Expert visual walkthrough
What CDS Is and Your First View Entity
CDS Views · Chapter-specific technical teaching map
Architecture hierarchy
Physical data source
Interface view
Projection / metadata
Consumer
Tutor's chapter takeaway
Understand what Core Data Services (CDS) are, why SAP moved data modelling from SE11 into CDS, how to create a first CDS view entity in Eclipse ADT, and how a classic ABAP report reads from it like a normal table.
In a real project
On an S/4HANA conversion, a team kept building SE11 database views and ABAP joins for every new report. Each report re-implemented the same order-header logic with small differences, and totals did not match between reports…
Watch out for
• Trying to create or change CDS views in SE11/SE80 instead of ADT. • Using technical field names (VBELN, KUNNR) as aliases — consumers then cannot tell what the field means. • Forgetting the currency/unit reference for…
The situation: a real project scenario
On an S/4HANA conversion, a team kept building SE11 database views and ABAP joins for every new report. Each report re-implemented the same order-header logic with small differences, and totals did not match between reports.
The architect introduced one CDS view entity ZI_SalesOrderHeader with agreed field names and currency references. All new reports and a Fiori list app read from it. Differences between reports disappeared because the logic now existed in one place.
Explanation
CDS, Core Data Services, is SAP's language for defining data models in the database layer — views with joins, calculations, associations, annotations, and authorizations. CDS views are created in Eclipse ADT rather than SE11/SE80, as DDL sources, and the recommended type today is the CDS view entity, written with define view entity.
A classic ABAP report reads a CDS view with a perfectly normal SELECT — the view is just another data source as far as ABAP is concerned.
CDS matters because it's the foundation of S/4HANA: Fiori apps, analytics, RAP, and OData all sit on top of it, and an ABAP developer who can't read CDS can't really work on S/4HANA projects.
This series covers it across ten parts: what CDS is and your first view entity (this part), joins/expressions/CASE/CAST and built-in functions, aggregation and analytical annotations, CDS view entity versus classic DDIC-based CDS view, VDM layering across basic/composite/consumption views, associations and cardinality, annotations for semantics/texts/search/UI, DCL access control, parameters and filtering, and performance and troubleshooting.
CDS exists because SE11 database views only support inner joins and simple projections — no calculations, no unions, no aggregation, no reusable relations. On HANA, SAP wants logic pushed down to the database itself ("code pushdown"), and CDS lets you define that logic once, in the database, reusable by reports, Fiori apps, and APIs alike. S/4HANA itself is modeled in CDS — I_SalesOrder, I_Product, I_JournalEntry, and thousands more make up what's called the Virtual Data Model (VDM).
You create a CDS view in Eclipse with ABAP Development Tools (ADT): right-click the package, choose New → Other ABAP Repository Object → Core Data Services → Data Definition, and choose the template "Define View Entity." Activating with Ctrl+F3 stores the view in the ABAP repository and creates it in the database at that point — SE11/SE80 can display CDS names but can't edit them.
The anatomy of a view entity starts with header annotations such as @EndUserText.label and @AccessControl.authorizationCheck, followed by define view entity <name> as select from <data source>. The field list sits in curly brackets, with key fields marked with "key" and listed first. Aliases, written as "as SalesOrder," give business names in CamelCase instead of technical names like VBELN, and amount and quantity fields need a reference to their currency or unit field via @Semantics annotations — view entities actually enforce this requirement.
For naming, customer views start with Z or Y, with a common pattern being ZI_ for interface (basic/composite) views and ZC_ for consumption views (covered in Part 5); names are limited to 30 characters, and should use business names rather than table names.
Reading CDS from classic ABAP is as simple as SELECT ... FROM zi_salesorderheader, which works just like reading a table — you use the alias names (salesorder, creationdate) rather than the original table fields, and client handling is automatic, applied exactly as it would be for a normal table.
To put this into practice: open ADT and create a Data Definition ZI_SALESORDERHEADER with the "Define View Entity" template, select from VBAK and expose VBELN (as the key), ERDAT, AUART, VKORG, KUNNR, NETWR, and WAERK with business aliases, add @Semantics.amount.currencyCode on NetAmount and activate, press F8 in ADT for Data Preview to see the rows, and write a classic SE38 report that selects from the view with a date range and lists the result.
By the end you should be able to create a view entity, preview it, and read it from a classic ABAP report.
Code example
// ===== STEP 1: CDS view entity (ADT, DDL source ZI_SALESORDERHEADER) =====@AccessControl.authorizationCheck: #NOT_REQUIRED@EndUserText.label: 'Sales order header - basic'define view entity ZI_SalesOrderHeader as select from vbak{ key vbeln as SalesOrder, erdat as CreationDate, auart as SalesOrderType, vkorg as SalesOrganization, kunnr as SoldToParty, @Semantics.amount.currencyCode: 'TransactionCurrency' netwr as NetAmount, waerk as TransactionCurrency} * ===== STEP 2: classic ABAP report reading the view (SE38) =====REPORT zcds_read_so_header. TYPES: BEGIN OF ty_so, salesorder TYPE vbeln_va, creationdate TYPE erdat, soldtoparty TYPE kunnr, netamount TYPE netwr_ak, transactioncurrency TYPE waerk, END OF ty_so. DATA: lt_so TYPE STANDARD TABLE OF ty_so, ls_so TYPE ty_so, lv_lines TYPE i. SELECT-OPTIONS s_erdat FOR sy-datum. START-OF-SELECTION.* ===== STEP 3: select from the CDS view like a table ===== SELECT salesorder creationdate soldtoparty netamount transactioncurrency FROM zi_salesorderheader INTO TABLE lt_so WHERE creationdate IN s_erdat. DESCRIBE TABLE lt_so LINES lv_lines. WRITE: / 'Orders found:', lv_lines. * ===== STEP 4: output ===== LOOP AT lt_so INTO ls_so. WRITE: / ls_so-salesorder, ls_so-creationdate, ls_so-soldtoparty, ls_so-netamount CURRENCY ls_so-transactioncurrency, ls_so-transactioncurrency. ENDLOOP.Watch out
Common mistakes
- Trying to create or change CDS views in SE11/SE80 instead of ADT.
- Using technical field names (VBELN, KUNNR) as aliases — consumers then cannot tell what the field means.
- Forgetting the currency/unit reference for amount or quantity fields (activation error in view entities).
- Selecting with the original table field names from ABAP instead of the CDS alias names.
- Creating a new CDS view for every report instead of reusing an existing one.
Do this
Best practices
- Use define view entity for all new CDS development.
- Give every field a clear CamelCase business alias.
- Always add @EndUserText.label and a deliberate @AccessControl.authorizationCheck value.
- Check SAP's standard I_ views first (e.g. I_SalesOrder) before building your own.
- Test with ADT Data Preview (F8) before consuming in ABAP.
In the interview
Interview angle
Questions: "What is CDS and why did SAP introduce it?", "Where do you create CDS views?", "How do you read a CDS view in ABAP?"
Strong answer: CDS is a database-layer modelling language supporting joins, calculations, associations, annotations and DCL; it enables code pushdown on HANA and is the basis of the S/4 VDM, Fiori, analytics and RAP. Created in ADT as a data definition (define view entity). Consumed from ABAP with a normal SELECT using the alias names; client handling is automatic.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
What is the main purpose of CDS in S/4HANA?
Question 2 of 3
Which syntax starts a modern CDS view entity?
Question 3 of 3
How are key fields designated within the SELECT list of a CDS view entity definition?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1Five ABAP reports on your project each join VBAK, VBAP and KNA1 themselves, and their totals do not match. How would you use CDS to fix this?
2What is a CDS View in SAP ABAP?
Try a related Code Lab
This published exercise covers the same SAP topic. Apply the ideas in a hands-on scenario, then return to review your answers.
Open: Slow CDS View Due to Too Many Joins and No Filters →Was this lesson helpful?
Keep exploring
Interview questions on this topic
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.