Create Core Data Services models and annotations for SAP
✓Works with OpenClaudeYou 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/cdsis installed:npm list @sap/cds - Check Node.js version supports CDS (v14+):
node --version - Confirm
db/andsrv/directories exist in your CAP project structure
Steps
- Define a CDS entity in
db/schema.cdswith namespacing usingnamespacekeyword - Add type definitions and elements with
type,String,Integer,Decimal,DateTime,UUIDtypes - Create associations using
association tosyntax to link entities together - Apply
@cds.persistence.nameannotation to customize database table names - Add UI annotations with
@UI.LineItemand@UI.FieldGroupfor Fiori UI generation - Define validation annotations using
@assert.format,@assert.range, and custom handlers - Create service definitions in
srv/that expose entities withservicekeyword - Apply authorization rules with
@requiresand 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
Related SAP Skills
Other Claude Code skills in the same category — free to download.
ABAP Developer
Write clean ABAP code with modern syntax, CDS views, and best practices
SAP Fiori App
Build SAP Fiori applications with SAPUI5 and Fiori Elements
SAP BTP Setup
Set up and deploy applications on SAP Business Technology Platform
SAP HANA Query
Write and optimize SAP HANA SQL queries and calculation views
SAP OData Service
Create and consume OData services in SAP (V2 and V4)
SAP RFC Connector
Connect to SAP via RFC/BAPI from external applications
SAP CAP App
Build full-stack applications with SAP Cloud Application Programming Model
SAPUI5 Component
Build reusable SAPUI5 components with MVC pattern
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.