All skills
secondsky avatar

/sap-abap-cds

@620a19a
by Eddiesecondsky/sap-skills456 stars
120

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.

Use this Skill: https://skilld.dev/gh/secondsky/sap-skills/sap-abap-cds

This session only. Nothing lands on disk.

templatesbasic-view.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Basic CDS View Template

Standard template for creating a basic ABAP CDS view.


CDS View Template

@AbapCatalog.sqlViewName: 'Z<SHORT_NAME>_V'
@AbapCatalog.compiler.CompareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: '<View Description>'

define view Z<VIEW_NAME>
  as select from <source_table> as s
    left outer join <text_table> as t
      on s.<key_field> = t.<key_field>
     and t.spras = $session.system_language
{
      // Key fields
  key s.<key_field>,

      // Data fields
      s.<field1>,
      s.<field2>,

      // Text from joined table
      t.<text_field> as Description,

      // Calculated fields
      case s.<status_field>
        when 'A' then 'Active'
        when 'I' then 'Inactive'
        else 'Unknown'
      end as StatusText,

      // Currency handling
      @Semantics.currencyCode: true
      s.<currency_field>,
      @Semantics.amount.currencyCode: '<currency_field>'
      s.<amount_field>,

      // Quantity handling
      @Semantics.unitOfMeasure: true
      s.<unit_field>,
      @Semantics.quantity.unitOfMeasure: '<unit_field>'
      s.<quantity_field>,

      // Administrative fields
      @Semantics.user.createdBy: true
      s.<created_by>,
      @Semantics.systemDateTime.createdAt: true
      s.<created_at>,
      @Semantics.user.lastChangedBy: true
      s.<changed_by>,
      @Semantics.systemDateTime.lastChangedAt: true
      s.<changed_at>
}

CDS View Entity Template (7.55+)

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: '<View Description>'

define view entity Z<VIEW_NAME>
  as select from <source_table> as s
    left outer join <text_table> as t
      on s.<key_field> = t.<key_field>
     and t.spras = $session.system_language
{
      // Key fields
  key s.<key_field>,

      // Data fields
      s.<field1>,
      s.<field2>,

      // Text from joined table
      t.<text_field> as Description,

      // Calculated fields
      case s.<status_field>
        when 'A' then 'Active'
        when 'I' then 'Inactive'
        else 'Unknown'
      end as StatusText,

      // Currency handling
      @Semantics.currencyCode: true
      s.<currency_field>,
      @Semantics.amount.currencyCode: '<currency_field>'
      s.<amount_field>,

      // Quantity handling
      @Semantics.unitOfMeasure: true
      s.<unit_field>,
      @Semantics.quantity.unitOfMeasure: '<unit_field>'
      s.<quantity_field>
}

Example: Material Master View

@AbapCatalog.sqlViewName: 'ZMAT_BASIC_V'
@AbapCatalog.compiler.CompareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Basic Material View'

define view Z_MATERIAL_BASIC
  as select from mara as m
    left outer join makt as t
      on m.matnr = t.matnr
     and t.spras = $session.system_language
{
  key m.matnr as Material,

      m.mtart as MaterialType,
      m.matkl as MaterialGroup,
      m.meins as BaseUnit,
      m.ersda as CreatedDate,
      m.ernam as CreatedBy,
      m.laeda as ChangedDate,
      m.aenam as ChangedBy,

      t.maktx as MaterialDescription,

      case m.lvorm
        when 'X' then 'Marked for Deletion'
        else 'Active'
      end as DeletionStatus,

      @Semantics.unitOfMeasure: true
      m.meins as UnitOfMeasure,
      @Semantics.quantity.unitOfMeasure: 'meins'
      m.ntgew as NetWeight
}

Checklist

  • SQL view name ≤ 16 characters (for CDS View)
  • Unique SQL view name
  • Authorization check configured
  • EndUserText.label provided
  • Key fields marked with key
  • CURR/QUAN fields have semantic annotations
  • Text join uses $session.system_language
  • Aliases provided for calculated fields

ABAP Access

" Direct SELECT
SELECT * FROM z_material_basic
  WHERE MaterialType = 'FERT'
  INTO TABLE @DATA(lt_materials).

" SALV IDA Display
cl_salv_gui_table_ida=>create_for_cds_view(
  CONV #( 'Z_MATERIAL_BASIC' )
)->fullscreen( )->display( ).

Source: SKILL.md on GitHub

1 warning15d4 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    The skill provides comprehensive reference material, templates, and troubleshooting guides for SAP ABAP CDS development. It consists entirely of documentation and static templates without executable code. All external references point to official SAP resources and well-known community repositories.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

  • Runlayer6mo

    5/12 files flagged

Signed by skilld at 620a19a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 months ago
Other metadata
metadata
{
  "maintainer": "Eduard Jiglau",
  "maintainer_email": "hello@sap-ai-skills.com",
  "website": "https://sap-ai-skills.com",
  "version": "2.4.1",
  "last_verified": "2026-04-02",
  "abap_release": "7.4 SP8+ / 7.50+ / ABAP Cloud",
  "sources": [
    "https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/abencds.html",
    "https://github.com/SAP-samples/abap-cheat-sheets"
  ],
  "keywords": [
    "ABAP CDS",
    "Core Data Services",
    "CDS view",
    "CDS view entity",
    "define view",
    "DDL",
    "DCL",
    "annotations",
    "@AbapCatalog",
    "@AccessControl",
    "@EndUserText",
    "@Semantics",
    "@UI",
    "@Consumption",
    "@ObjectModel",
    "associations",
    "cardinality",
    "path expressions",
    "input parameters",
    "WITH PARAMETERS",
    "built-in functions",
    "CASE expression",
    "CAST",
    "session variables",
    "GROUP BY",
    "HAVING",
    "joins",
    "access control",
    "DEFINE ROLE",
    "pfcg_auth",
    "SALV IDA",
    "Eclipse ADT",
    "CDS annotations",
    "Fiori Elements",
    "OData",
    "RAP",
    "currencyCode",
    "unitOfMeasure",
    "SD_CDS_ENTITY105"
  ]
}

README badge

README badge for secondsky/sap-skills/sap-abap-cds