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.
What this skill does
# 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
**Quick Reference**: [https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/abencds.html](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](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](#1-cds-view-fundamentals)
- [2. Essential Annotations](#2-essential-annotations)
- [3. Expressions and Operations](#3-expressions-and-operations)
- [4. Built-in Functions](#4-built-in-functions)
- [5. Joins](#5-joins)
- [6. Associations](#6-associations)
- [7. Input Parameters](#7-input-parameters)
- [8. Aggregate Expressions](#8-aggregate-expressions)
- [9. Access Control (DCL)](#9-access-control-dcl)
- [10. Data Retrieval from ABAP](#10-data-retrieval-from-abap)
- [11. Common Errors and Solutions](#11-common-errors-and-solutions)
- [12. Useful Transactions and Tables](#12-useful-transactions-and-tables)
- [Bundled Resources](#bundled-resources)
- [Source Documentation](#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
```sql
@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+)
```sql
@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
1. **File** → **New** → **Other** → **Core Data Services** → **Data Definition**
2. Enter name, description, and package
3. 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:
```sql
-- Currency fields
@Semantics.currencyCode: true
waers,
@Semantics.amount.currencyCode: 'waers'
amount,
-- Quantity fields
@Semantics.unitOfMeasure: true
meins,
@Semantics.quantity.unitOfMeasure: 'meins'
quantity
```
### UI Annotations (Fiori Elements)
```sql
@UI.lineItem: [{ position: 10 }]
@UI.identification: [{ position: 10 }]
@UI.selectionField: [{ position: 10 }]
field1,
@UI.hidden: true
internal_field
```
### Consumption Annotations (Value Help)
```sql
@Consumption.valueHelpDefinition: [{
entity: { name: 'I_Currency', element: 'Currency' }
}]
waers
```
For complete annotation reference, see `references/annotations-reference.md`.
---
## 3. Expressions and Operations
### CASE Expressions
**Simple CASE** (single variable comparison):
```sql
case status
when 'A' then 'Active'
when 'I' then 'Inactive'
else 'Unknown'
end as StatusText
```
**Searched CASE** (multiple conditions):
```sql
case
when amount > 1000 then 'High'
when amount > 100 then 'Medium'
else 'Low'
end as AmountCategory
```
### 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
```sql
quantity * price as TotalAmount,
amount / 100 as Percentage,
-amount as NegatedAmount
```
### 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_language` are available from 7.40 SP08.
> `$session.system_date` requires 7.51+. `@Environment.systemField` requires 7.50+.
**Complete Reference**: See `references/expressions-reference.md` for all system variables.
```sql
$session.user as CurrentUser,
$session.system_date as Today
```
---
## 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()` and `lower()` 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
```sql
-- String operations
concat(first_name, last_name) as FullName,
upper(name) as UpperName,
substring(description, 1, 10) as ShortDesc
-- Numeric operations
abs(amount) as AbsoluteAmount,
round(value, 2) as RoundedValue,
division(10, 3, 2) as PreciseDivisioRelated in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.