SAP ABAP CDS (Core Data Services)
Related Skills
- sap-abap: Use for ABAP programming patterns used with CDS or when implementing EML statements in ABAP
- sap-btp-cloud-platform: Use for CDS deployment scenarios on BTP or ABAP Environment configurations
- sap-fiori-tools: Use when building Fiori Elements applications that consume CDS views or working with UI annotations
- sap-cap-capire: Use for comparing CDS syntax between ABAP and CAP or when integrating ABAP CDS with CAP services
- sap-api-style: Use when documenting CDS-based OData services or following API documentation standards
When to Use This Skill
Use this skill when creating ABAP CDS views or view entities, defining associations and cardinalities, adding UI or semantic annotations, implementing DCL access control, handling currency/unit fields, troubleshooting CDS compiler errors, or comparing classic CDS views with newer view entities.
Quick Reference: https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/abencds.html | SAP Cheat Sheets: https://github.com/SAP-samples/abap-cheat-sheets/blob/main/15_CDS_View_Entities.md
Version Compatibility
This skill covers CDS features from 7.40 SP8 through ABAP Cloud. Key version boundaries:
On a 7.40 system: Use DEFINE VIEW (not DEFINE VIEW ENTITY). CDS table functions
are not available before 7.50. Basic DCL (DEFINE ROLE with pfcg_auth) is available
from 7.40 SP08, but implicit role evaluation in ABAP SQL requires 7.50+.
$session.user/client/system_language are available from 7.40 SP08.
The templates in templates/ include both classic CDS View and View Entity variants.
Table of Contents
- 1. CDS View Fundamentals
- 2. Essential Annotations
- 3. Expressions and Operations
- 4. Built-in Functions
- 5. Joins
- 6. Associations
- 7. Input Parameters
- 8. Aggregate Expressions
- 9. Access Control (DCL)
- 10. Data Retrieval from ABAP
- 11. Common Errors and Solutions
- 12. Useful Transactions and Tables
- Bundled Resources
- Source Documentation
1. CDS View Fundamentals
View Types
Recommendation: Use CDS View Entities for new development.
Basic CDS View Syntax
CDS View Entity Syntax (7.55+)
Key Difference: View entities omit @AbapCatalog.sqlViewName - no SQL view generated.
Eclipse ADT Setup
- File → New → Other → Core Data Services → Data Definition
- Enter name, description, and package
- Select template (view, view entity, etc.)
2. Essential Annotations
Core Annotations
Essential annotations for CDS development:
@AbapCatalog.sqlViewName- SQL view name (max 16 chars)@AbapCatalog.compiler.CompareFilter- Optimize WHERE clauses@AccessControl.authorizationCheck- Set to #NOT_REQUIRED, #CHECK, #MANDATORY, or #NOT_ALLOWED@EndUserText.label- User-facing description@Metadata.allowExtensions- Allow view extensions
Complete Reference: See references/annotations-reference.md for 50+ annotations with examples.
Semantics Annotations (Currency/Quantity)
Required for CURR and QUAN data types to avoid error SD_CDS_ENTITY105:
UI Annotations (Fiori Elements)
Consumption Annotations (Value Help)
For complete annotation reference, see references/annotations-reference.md.
3. Expressions and Operations
CASE Expressions
Simple CASE (single variable comparison):
Searched CASE (multiple conditions):
Comparison Operators
Standard operators: =, <>, <, >, <=, >=
Special operators: BETWEEN x AND y, LIKE, IS NULL, IS NOT NULL
Complete Reference: See references/expressions-reference.md for all operators and expressions.
Arithmetic Operations
Session Variables
Available system variables (SY fields equivalent):
$session.user(SY-UNAME) - Current user [7.40 SP08+]$session.client(SY-MANDT) - Client [7.40 SP08+]$session.system_language(SY-LANGU) - Language [7.40 SP08+]$session.system_date(SY-DATUM) - Current date [7.51+]
Note:
$session.user/client/system_languageare available from 7.40 SP08.$session.system_daterequires 7.51+.@Environment.systemFieldrequires 7.50+.
Complete Reference: See references/expressions-reference.md for all system variables.
4. Built-in Functions
CDS provides comprehensive built-in functions for string, numeric, and date operations.
Key Function Categories
- String Functions: concat(), length(), substring(), upper(), lower(), replace()
- Numeric Functions: abs(), ceil(), floor(), round(), division()
- Date Functions: dats_add_days(), dats_add_months(), dats_days_between()
- CAST Expression: Convert between ABAP data types
Note:
upper()andlower()in CDS require 7.51+. On 7.40/7.50, case conversion must be performed in ABAP after selecting (there is no CDS equivalent).
Complete Reference: See references/functions-reference.md for all 50+ functions with examples.
Quick Examples
6. Associations
Associations define relationships between entities (join-on-demand):
Defining Associations
Cardinality Notation
Syntax mapping:
[0..1]or[1]→association to one(LEFT OUTER MANY TO ONE)[1..1]→association to one(exact match)[0..*]or[*]→association to many(LEFT OUTER MANY TO MANY)[1..*]→association to many(one or more)
Complete Reference: See references/associations-reference.md for detailed cardinality guide.
New Cardinality Syntax (Release 2302+)
Using Associations
Path Expressions with Filter
For complete association reference, see references/associations-reference.md.
7. Input Parameters
Defining Parameters
Parameter Reference
Use colon notation :p_date_from or $parameters.p_date_from
Calling from ABAP:
8. Aggregate Expressions
Aggregate Functions
9. Access Control (DCL)
Basic DCL Structure
Authorization Check Options
Available values:
#NOT_REQUIRED- No authorization check#CHECK- Warning if no DCL exists#MANDATORY- Error if no DCL exists#NOT_ALLOWED- DCL ignored if exists
Complete Reference: See references/access-control-reference.md for detailed DCL patterns.
Condition Types
PFCG Authorization: where (field) = aspect pfcg_auth(AUTH_OBJECT, AUTH_FIELD, ACTVT = '03')
Literal Condition: where status <> 'DELETED'
User Aspect: where created_by ?= aspect user
Combined: where (bukrs) = aspect pfcg_auth(...) and status = 'ACTIVE'
For complete access control reference, see references/access-control-reference.md.
10. Data Retrieval from ABAP
Standard SELECT
SALV IDA (Integrated Data Access)
11. Common Errors and Solutions
SD_CDS_ENTITY105: Missing Reference Information
Problem: CURR/QUAN fields without reference
Solution: Add semantics annotations
Or import currency from related table:
Cardinality Warnings
Problem: Cardinality doesn't match actual data
Solution: Define cardinality matching data model
For complete troubleshooting guide, see references/troubleshooting.md.
12. Useful Transactions and Tables
Key Transactions
- SDDLAR - Display/repair DDL structures
- RSRTS_ODP_DIS - TransientProvider preview
- RSRTS_QUERY_CHECK - CDS query metadata validation
- SE63 - Translation (EndUserText)
- SE11 - ABAP Dictionary
- SU21 - Authorization objects
Important Tables
- DDHEADANNO - Header-level annotations
- CDSVIEWANNOPOS - CDS view header annotations
- CDS_FIELD_ANNOTATION - Field-level annotations
- ABDOC_CDS_ANNOS - SAP annotation definitions
API Class
CL_DD_DDL_ANNOTATION_SERVICE - Programmatic annotation access:
get_annos()- Get all annotationsget_label_4_element()- Get @EndUserText.label
Bundled Resources
Reference Documentation
For detailed guidance, see the reference files in references/:
annotations-reference.md- Complete annotation catalogfunctions-reference.md- All built-in functions with examplesassociations-reference.md- Associations and cardinality guideaccess-control-reference.md- DCL and authorization patternsexpressions-reference.md- Expressions and operatorstroubleshooting.md- Common errors and solutions
Templates
For templates, see templates/:
basic-view.md- Standard CDS view templateparameterized-view.md- View with input parametersdcl-template.md- Access control definition
Source Documentation
Update this skill by checking:
- https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/abencds.html (ABAP Cloud)
- https://help.sap.com/doc/abapdocu_740_index_htm/7.40/en-US/index.htm (7.40 Reference)
- https://help.sap.com/docs/SAP_NETWEAVER_AS_ABAP_752/f2e545608079437ab165c105649b89db/7c078765ec6d4e6b88b71bdaf8a2bd9f.html (NetWeaver 7.52 User Guide)
- https://github.com/SAP-samples/abap-cheat-sheets
- https://github.com/SAP-samples/abap-cheat-sheets/blob/main/33_ABAP_Release_News.md (Release News)
Last Verified: 2026-04-02


