$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
SAPintermediateNew

SAP CDS Model

Share

Create Core Data Services models and annotations for SAP

Works with OpenClaude

You are a SAP Core Data Services (CDS) expert. The user wants to create CDS models and annotations for SAP applications.

What to check first

  • Verify @sap/cds is installed: npm list @sap/cds
  • Check Node.js version supports CDS (v14+): node --version
  • Confirm db/ and srv/ directories exist in your CAP project structure

Steps

  1. Define a CDS entity in db/schema.cds with namespacing using namespace keyword
  2. Add type definitions and elements with type, String, Integer, Decimal, DateTime, UUID types
  3. Create associations using association to syntax to link entities together
  4. Apply @cds.persistence.name annotation to customize database table names
  5. Add UI annotations with @UI.LineItem and @UI.FieldGroup for Fiori UI generation
  6. Define validation annotations using @assert.format, @assert.range, and custom handlers
  7. Create service definitions in srv/ that expose entities with service keyword
  8. Apply authorization rules with @requires and role-based access control annotations

Code

namespace sap.example;

using { cuid, managed } from '@sap/cds/common';

entity Books : cuid, managed {
  title: String(100) not null;
  author: String(100);
  ISBN: String(13) @assert.format: '/^\d{13}$/';
  price: Decimal(9,2) @assert.range: [0.00, 99999.99];
  releaseDate: Date;
  genre: array of String(20);
  
  publisher: Association to Publishers;
  reviews: Composition of many Reviews on reviews.book;
}

entity Publishers : cuid {
  name: String(100) not null;
  country: String(2);
  books: Composition of many Books on books.publisher;
}

entity Reviews : cuid, managed {
  rating: Integer @assert.range: [1, 5];
  comment: String(500);
  book: Association to Books;
}

// Service definition
service CatalogService {
  entity Books as projection on db.Books {
    *,
    publisher
  };
  
  entity Publishers as projection on db.Publishers;
  
  type BookStats {
    totalBooks: Integer;
    avgRating: Decimal(3,2);
  };
  
  function getBookStats() returns BookStats;
}

// Annotations for Fiori UI
annotate CatalogService.Books with @(
  UI.LineItem: [
    {Value: title, Label: 'Title'},
    {Value: author, Label: 'Author'},
    {Value: price, Label: 'Price'}
  ],
  UI.FieldGroup #GeneralInfo: {
    Data: [

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategorySAP
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
sapcdsmodeling

Install command:

curl -o ~/.claude/skills/sap-cds-model.md https://clskills.in/skills/sap/sap-cds-model.md

Related SAP Skills

Other Claude Code skills in the same category — free to download.

Want a SAP skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.