Sap Abap Cds
Comprehensive SAP ABAP CDS (Core Data Services) reference for data modeling, view development, and semantic enrichment. Use when creating CDS views or view entities, defining data models with annotations, working with associations and cardinality, implementing input parameters, using built-in functions, writing CASE expressions, implementing access control with DCL, handling CURR/QUAN data types, troubleshooting CDS errors, querying CDS views from ABAP, or displaying data with SALV IDA. Covers ABAP 7.4+ through ABAP Cloud.
- Skill ID
- secondsky/sap-skills/sap-abap-cds
- Publisher
- secondsky
- Repository
- sap-skills
- Installs
- 0
- Files
- 12
- License
- GPL-3.0
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
secondsky/sap-skills/sap-abap-cdsInstalls these files- README.md
- SKILL.md
- agents/openai.yaml
- references/access-control-reference.md
- references/annotations-reference.md
- references/associations-reference.md
- references/expressions-reference.md
- references/functions-reference.md
- references/troubleshooting.md
- templates/basic-view.md
- templates/dcl-template.md
- templates/parameterized-view.md
What this skill tells the agent
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:
| Feature | 7.40 SP8 | 7.50 | 7.51 | 7.55+ |
|---|---|---|---|---|
CDS View (DEFINE VIEW) | x | x | x | x |
| CDS associations, parameters, built-in functions | x | x | x | x |
CDS Table Functions (DEFINE TABLE FUNCTION) | x | x | x | |
| CDS Access Control (DEFINE ROLE / pfcg_auth) | x | x | x | x |
| CDS Access Control (implicit evaluation) | x | x | x | |
Session variables ($session.user/client/system_language) | x | x | x | x |
@Environment.systemField annotation | x | x | x | |
UPPER/LOWER functions | x | x | ||
$session.system_date | x | x | ||
CDS Metadata Extensions (ANNOTATE VIEW) | x | x | ||
| Cross Join in CDS | x | x | ||
| CDS View Entity (`DEFINE VIEW ENTITY`) | x | |||
New cardinality syntax (to one/to many) | 7.57+ |
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
| Type | Syntax | Database View | Since |
|---|---|---|---|
| CDS View | DEFINE VIEW | Yes | 7.4 SP8 |
| CDS View Entity | DEFINE VIEW ENTITY | No | 7.55 |
Recommendation: Use CDS View Entities for new development.
Basic CDS View Syntax
@AbapCatalog.sqlViewName: 'ZCDS_EXAMPLE_V'
@AbapCatalog.compiler.CompareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Example CDS View'
define view ZCDS_EXAMPLE
as select from db_table as t
{
key t.field1,
t.field2,
t.field3 as AliasName
}CDS View Entity Syntax (7.55+)
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Example View Entity'
define view entity Z_CDS_EXAMPLE
as select from db_table as t
{
key t.field1,
t.field2,
t.field3 as AliasName
}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:
-- Currency fields
@Semantics.currencyCode: true
waers,
@Semantics.amount.currencyCode: 'waers'
amount,
-- Quantity fields
@Semantics.unitOfMeasure: true
meins,
@Semantics.quantity.unitOfMeasure: 'meins'
quantityUI Annotations (Fiori Elements)
@UI.lineItem: [{ position: 10 }]
@UI.identification: [{ position: 10 }]
@UI.selectionField: [{ position: 10 }]
field1,
@UI.hidden: true
internal_fieldConsumption Annotations (Value Help)
@Consumption.valueHelpDefinition: [{
entity: { name: 'I_Currency', element: 'Currency' }
}]
waersFor complete annotation reference, see references/annotations-reference.md.
3. Expressions and Operations
CASE Expressions
Simple CASE (single variable comparison):
case status
when 'A' then 'Active'
when 'I' then 'Inactive'
else 'Unknown'
end as StatusTextSearched CASE (multiple conditions):
case
when amount > 1000 then 'High'
when amount > 100 then 'Medium'
else 'Low'
end as AmountCategoryComparison 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
quantity * price as TotalAmount,
amount / 100 as Percentage,
-amount as NegatedAmountSession 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.
$session.user as CurrentUser,
$session.system_date as Today4. 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).
More from secondsky
Use this skill in a project
Open any RiverX project, search the Skills panel for secondsky/sap-skills/sap-abap-cds, and install it in one click.
