All topics
BTP_INTEGRATIONbeginner

CAP

The SAP Cloud Application Programming Model (CAP) is a framework and toolset for building enterprise-grade services and applications on SAP BTP. This topic covers CAP's core concepts (CDS data modeling, service definitions, and the CAP runtime), how projects are structured and deployed to Cloud Foundry or Kyma, how CAP applications integrate with SAP systems and BTP services (HANA, XSUAA, destinations, event mesh), and the operational, security, and troubleshooting considerations consultants and architects need for production-grade CAP-based solutions.

Overview

The SAP Cloud Application Programming Model (CAP) is a framework and toolset for building enterprise-grade services and applications on SAP BTP. This topic covers CAP's core concepts (CDS data modeling, service definitions, and the CAP runtime), how projects are structured and deployed to Cloud Foundry or Kyma, how CAP applications integrate with SAP systems and BTP services (HANA, XSUAA, destinations, event mesh), and the operational, security, and troubleshooting considerations consultants and architects need for production-grade CAP-based solutions.

Lessons in this topic

  • BTP CAP Part 1: What CAP Is and Why It Matters on SAP BTPThe SAP Cloud Application Programming Model (CAP) is SAP's framework for building enterprise services and apps on BTP with Node.js or Java. Learn its idea — model with CDS, get services and persistence generated, add custom logic only where needed — the project structure, local development with cds watch, and how it deploys to BTP.
  • BTP CAP Part 2: Building and Exposing Services with CDSDesign CAP services: projections on domain entities, service-level exposure choices (read-only, restricted fields), annotations for OData and UI, mock data, hybrid testing against real BTP services with cds bind, and database deployment with cds deploy.
  • BTP CAP Part 3: Securing CAP Services with XSUAA Role-Based AuthorizationSecure CAP declaratively: @requires and @restrict annotations for roles and instance-based conditions, generating xs-security.json with cds compile, mocked users for local testing, XSUAA in production, and testing authorization in hybrid mode.
  • BTP CAP Part 4: Multitenancy, Extensibility and Production DeploymentBuild SaaS with CAP: multitenancy with the MTX services (@sap/cds-mtxs), tenant subscription via SaaS registry, tenant-specific HDI containers, tenant-aware caching, extensibility for customers, and production deployment practices (MTA, profiles, CI/CD).
  • BTP CAP Part 5: Domain Modeling with Entities, Associations, Compositions and AspectsModel the domain well in CDS: entities with keys (cuid), reusable aspects (managed, temporal), types and code lists, associations (references) vs compositions (contained children with deep insert/delete), and modeling patterns that keep services and UIs simple.
  • BTP CAP Part 6: Service Handlers — Before, On, After and TransactionsAdd business logic the CAP way: event handlers in before, on and after phases, validations with req.error/req.reject, enriching results, calling other services and remote APIs, transaction handling with cds.tx, and avoiding the anti-pattern of replacing generic handlers.
  • BTP CAP Part 7: OData Services, Actions, Functions and DraftExpose rich OData V4 services with CAP: bound and unbound actions and functions, draft-enabled entities for Fiori elements editing (@odata.draft.enabled), side effects and value helps via annotations, and pitfalls with draft (validation timing, handlers on drafts).

Interview questions covered

  • What are the core concepts of CAP, and how would you explain them clearly in an SAP interview?
  • How would you apply CAP in a real SAP project? Walk through the design or implementation approach.
  • A production issue is reported in CAP. What would you check first, and how would you troubleshoot it systematically?
  • What are the most important design decisions, trade-offs, and best practices in CAP?
  • Suppose you inherit an existing CAP solution. How would you review it before making a change?
  • A Fiori elements app on CAP needs approval actions and multi-step editing. How do you design the OData service?
  • Secure a CAP app so viewers read only their country's data and admins manage everything.
  • A retail customer wants a custom store-audit app on BTP. Explain why you'd use CAP and how you'd start.
  • Design CAP services for a catalog app used by end users and administrators.
  • An order-management CAP model causes accidental data loss and complex services. How do you improve the domain model?
  • Custom CAP handlers broke Fiori paging and filtering, and a remote call per row made reads slow. How do you restructure the logic?
  • You are turning a CAP app into a multitenant SaaS offering. What do you design?

Related topics

Interview questions on this topic