MCPInstall

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.

Installs
947
Last 24h
+8
Trending rank
#9703
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/secondsky/sap-skills --skill sap-abap-cds
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads sap-abap-cds automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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:

Feature7.40 SP87.507.517.55+
CDS View (DEFINE VIEW)xxxx
CDS associations, parameters, built-in functionsxxxx
CDS Table Functions (DEFINE TABLE FUNCTION)xxx
CDS Access Control (DEFINE ROLE / pfcg_auth)xxxx
CDS Access Control (implicit evaluation)xxx
Session variables ($session.user/client/system_language)xxxx
@Environment.systemField annotationxxx
UPPER/LOWER functionsxx
$session.system_datexx
CDS Metadata Extensions (ANNOTATE VIEW)xx
Cross Join in CDSxx
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

View Types

TypeSyntaxDatabase ViewSince
CDS ViewDEFINE VIEWYes7.4 SP8
CDS View EntityDEFINE VIEW ENTITYNo7.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

  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:

-- 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)

@UI.lineItem: [{ position: 10 }]
@UI.identification: [{ position: 10 }]
@UI.selectionField: [{ position: 10 }]
field1,

@UI.hidden: true
internal_field

Consumption Annotations (Value Help)

@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):

case status
  when 'A' then 'Active'
  when 'I' then 'Inactive'
  else 'Unknown'
end as StatusText

Searched CASE (multiple conditions):

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

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.

$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

-- 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 PreciseDivision

-- Date operations
dats_add_days(current_date, 7) as NextWeek,
dats_days_between(start_date, end_date) as Duration

-- Type conversion
cast(field as abap.char(10)) as TextField,
cast(amount as abap.curr(15,2)) as CurrencyField

**ABAP Types**: `abap.char()`, `abap.numc()`, `abap.int4`, `abap.dats`, `abap.tims`, `abap.curr()`, `abap.cuky`, `abap.quan()`, `abap.unit()`

---

## 5. Joins

### Join Types
```sql
-- INNER JOIN (matching rows only)
inner join makt as t on m.matnr = t.matnr

-- LEFT OUTER JOIN (all from left, matching from right)
left outer join marc as c on m.matnr = c.matnr

-- RIGHT OUTER JOIN (all from right, matching from left)  -- [7.51+]
right outer join mvke as v on m.matnr = v.matnr

-- CROSS JOIN (cartesian product)                         -- [7.51+]
cross join t001 as co

6. Associations

Associations define relationships between entities (join-on-demand):

Defining Associations

define view Z_ASSOC_EXAMPLE as select from scarr as c
  association [1..*] to spfli as _Flights
    on $projection.carrid = _Flights.carrid
  association [0..1] to sairport as _Airport
    on $projection.hub = _Airport.id
{
  key c.carrid,
      c.carrname,
      c.hub,

      // Expose associations
      _Flights,
      _Airport
}

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+)

association to one _Customer on ...   -- [0..1]
association to many _Items on ...      -- [0..*]

Using Associations

-- Expose for consumer use
_Customer,

-- Ad-hoc field access (triggers join)
_Customer.name as CustomerName

Path Expressions with Filter

-- Filter with cardinality indicator
_Items[1: Status = 'A'].ItemNo

For complete association reference, see references/associations-reference.md.


7. Input Parameters

Defining Parameters

define view Z_PARAM_EXAMPLE
  with parameters
    p_date_from : dats,
    p_date_to   : dats,
    @Environment.systemField: #SYSTEM_LANGUAGE
    p_langu     : spras
  as select from vbak as v
{
  key v.vbeln,
      v.erdat,
      v.erzet
}
where v.erdat between :p_date_from and :p_date_to

Parameter Reference

Use colon notation :p_date_from or $parameters.p_date_from

Calling from ABAP:

SELECT * FROM z_param_example(
  p_date_from = '20240101',
  p_date_to   = '20241231',
  p_langu     = @sy-langu
) INTO TABLE @DATA(lt_result).

8. Aggregate Expressions

Aggregate Functions

define view Z_AGG_EXAMPLE as select from vbap as i
{
  i.vbeln,
  sum(i.netwr) as TotalAmount,
  avg(i.netwr) as AvgAmount,
  max(i.netwr) as MaxAmount,
  min(i.netwr) as MinAmount,
  count(*) as ItemCount
}
group by i.vbeln
having sum(i.netwr) > 1000

9. Access Control (DCL)

Basic DCL Structure

@MappingRole: true
define role Z_CDS_EXAMPLE_DCL {
  grant select on Z_CDS_EXAMPLE
    where (bukrs) = aspect pfcg_auth(F_BKPF_BUK, BUKRS, ACTVT = '03');
}

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

SELECT * FROM zcds_example
  WHERE field1 = @lv_value
  INTO TABLE @DATA(lt_result).

SALV IDA (Integrated Data Access)

cl_salv_gui_table_ida=>create_for_cds_view(
  CONV #( 'ZCDS_EXAMPLE' )
)->fullscreen( )->display( ).

11. Common Errors and Solutions

SD_CDS_ENTITY105: Missing Reference Information

Problem: CURR/QUAN fields without reference

Solution: Add semantics annotations

@Semantics.currencyCode: true
waers,
@Semantics.amount.currencyCode: 'waers'
netwr

Or import currency from related table:

inner join t001 as c on ...
{
  c.waers,
  @Semantics.amount.currencyCode: 'waers'
  v.amount
}

Cardinality Warnings

Problem: Cardinality doesn't match actual data

Solution: Define cardinality matching data model

association [0..1] to ...  -- Use for optional relationships
association [1..*] to ...  -- Use for required one-to-many

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 annotations
  • get_label_4_element() - Get @EndUserText.label

Bundled Resources

Reference Documentation

For detailed guidance, see the reference files in references/:

  • annotations-reference.md - Complete annotation catalog
  • functions-reference.md - All built-in functions with examples
  • associations-reference.md - Associations and cardinality guide
  • access-control-reference.md - DCL and authorization patterns
  • expressions-reference.md - Expressions and operators
  • troubleshooting.md - Common errors and solutions

Templates

For templates, see templates/:

  • basic-view.md - Standard CDS view template
  • parameterized-view.md - View with input parameters
  • dcl-template.md - Access control definition

Source Documentation

Update this skill by checking:

Last Verified: 2026-04-02

FAQ

What does the sap-abap-cds skill do?

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.

How do I install sap-abap-cds?

Run npx skills add https://github.com/secondsky/sap-skills --skill sap-abap-cds in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/sap-abap-cds/ (personal) or .claude/skills/sap-abap-cds/ (project).

Which AI agents can use sap-abap-cds?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is sap-abap-cds safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains sap-abap-cds?

It is published by secondsky in secondsky/sap-skills. It has 947 recorded installs.

More from secondsky/sap-skills

View all →

sap-abap

secondsky/sap-skills

Comprehensive ABAP development skill for SAP systems. Use when writing ABAP code, working with internal tables, structures, ABAP SQL, object-oriented programming, RAP (RESTful Application Programming Model), CDS views, EML statements, ABAP Cloud development, string processing, dynamic programming, RTTI/RTTC, field symbols, data references, exception handling, or ABAP unit testing. Covers both classic ABAP and modern ABAP for Cloud Development patterns.

Data & Databases1.3K installs

sap-fiori-tools

secondsky/sap-skills

Develops SAP Fiori applications using SAP Fiori tools extensions for VS Code and SAP Business Application Studio. Use when: generating Fiori Elements or Freestyle SAPUI5 applications, configuring Page Editor for List Report or Object Page, working with annotations and Service Modeler, setting up deployment to ABAP or Cloud Foundry, creating adaptation projects, using Guided Development, previewing with mock data or live data, configuring SAP Fiori launchpad, or using AI-powered generation with Project Accelerator/Joule. Technologies: SAP Fiori Elements, SAPUI5, OData V2/V4, CAP, SAP BTP, ABAP, Cloud Foundry, fiori-mcp-server (MCP tools for AI-assisted generation).

AI & Agents1.2K installs

sap-cap-capire

secondsky/sap-skills

SAP Cloud Application Programming Model (CAP) development skill using Capire documentation. Use when: building CAP applications, defining CDS models, implementing services, working with SAP HANA/SQLite/PostgreSQL databases, deploying to SAP BTP Cloud Foundry or Kyma, implementing Fiori UIs, handling authorization, multitenancy, or messaging. Covers CDL/CQL/CSN syntax, Node.js and Java runtimes, event handlers, OData services, and CAP plugins.

Backend & APIs1.2K installs

sap-btp-developer-guide

secondsky/sap-skills

Develops business applications on SAP Business Technology Platform (BTP) using CAP (Node.js/Java) or ABAP Cloud. Use when: building cloud applications on SAP BTP, deploying to Cloud Foundry or Kyma runtimes, integrating with SAP HANA Cloud, implementing SAP Fiori UIs, connecting to remote SAP systems, building multitenant SaaS applications, extending SAP S/4HANA or SuccessFactors, setting up CI/CD pipelines, implementing observability, or following SAP development best practices. Keywords: SAP BTP, Business Technology Platform, CAP, Cloud Application Programming Model, ABAP Cloud, Cloud Foundry, Kyma, SAP HANA Cloud, SAP Fiori, SAPUI5, CI/CD, observability, multitenant, SaaS, SAP BTP ABAP environment, SAP Business Application Studio, SAP Cloud SDK, SAP Integration Suite, SAP Event Mesh, SAP Connectivity Service, SAP Destination Service, XSUAA, OAuth, OpenID Connect, OData, CDS, Core Data Services, ABAP CDS, ABAP RESTful Application Programming Model, RAP, ABAP development, SAP BTP deve

DevOps & Cloud1.1K installs

sap-btp-best-practices

secondsky/sap-skills

SAP BTP best practices for enterprise architecture, account management, security, and operations, with verification evidence tracked in the repository ledger. Use when planning BTP implementations, setting up account hierarchies, configuring environments, implementing authentication, designing CI/CD pipelines, establishing governance, building Platform Engineering teams, implementing failover strategies, or managing application lifecycle on SAP BTP. Keywords: SAP BTP, account hierarchy, global account, directory, subaccount, Cloud Foundry, Kyma, ABAP, SAP Identity Authentication, CI/CD, governance, Platform Engineering, failover, multi-region, SAP BTP best practices

sap-btp-connectivity

secondsky/sap-skills

SAP BTP Connectivity skill covering Destination Service, Connectivity Service, Cloud Connector, Connectivity Proxy, and Transparent Proxy for Kubernetes. Use when configuring destinations (HTTP, RFC, LDAP, MAIL, TCP), setting up cloud-to-on-premise connectivity, implementing OAuth and principal propagation, deploying connectivity proxies in Kubernetes/Kyma, troubleshooting connectivity errors (405, 407, 503), or configuring multitenancy.

DevOps & Cloud950 installs

Popular docs & writing skills

View category →

grill-with-docs

mattpocock/skills

A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.

Docs & Writing1.2M installs

lark-markdown

open.feishu.cn

飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。

Docs & Writing778.7K installs

writing-beats

mattpocock/skills

Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.

Docs & Writing490.7K installs

writing-shape

mattpocock/skills

Writing, exploit: shape raw material into an article, paragraph by paragraph.

Docs & Writing490.2K installs

writing-fragments

mattpocock/skills

Writing, explore: mine raw fragments, no structure yet.

Docs & Writing489.6K installs

writing-for-agents

mattpocock/skills

Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

Docs & Writing479.3K installs