ERPClimb logoERPClimb

SAP BTP Integration CAP Interview Questions

CAP is a standard block in SAP BTP Integration interviews. It is rarely asked as a definition; it is asked as a situation you have to talk your way through.

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.

This page carries 12 reviewed SAP BTP Integration cap interview questions, each with a complete written answer and no sign-in required. The set breaks down into 2 foundational, 7 mid-level and 3 advanced questions, so you can start at the top for a first interview or skip ahead to the scenario-based items for a senior round.

Treat the answers as a starting structure, not a script. Interviewers in SAP BTP Integration rounds follow up on whatever you sound least certain about, so the value is in being able to keep going after the first answer.

12 CAP questions with answers

easyCAP

1. What are the core concepts of CAP, and how would you explain them clearly in an SAP interview?

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. Key lesson areas: Building and Exposing Services with CDS: Data Modeling to Runtime; CAP Domain Modeling: CDS Entities, Associations, Compositions and Aspects; CAP Multitenancy, Extensibility and Production Deployment; CAP OData Services, Actions, Functions and Draft; CAP Service Handlers: Before, On, After and Transactions; Securing CAP Services with XSUAA Role-Based Authorization; What CAP Is and Why It Matters on SAP BTP A practical walkthrough of designing CDS data models, defining services with projections and annotations, and understanding how CAP turns these declarations into a running OData/REST API with authorization enforcement. An introduction to the SAP Cloud Application Programming Model: what problem it solves, its core building blocks, and where it fits in the SAP BTP application development landscape. Design SaaS CAP applications for tenant isolation, tenant-aware persistence, subscription lifecycle, extensibility and production operations instead of treating multitenancy as a deployment flag. Expose CAP domain services through OData with explicit actions and functions and use draft-enabled entities when long-running Fiori editing requires persisted intermediate state. Learn how CAP services enforce authentication and authorization using the XSUAA service, restrict-based annotations, and scopes, and how this model differs from classic ABAP authorization objects. Model CAP services around business domains using CDS entities, associations, compositions and reusable aspects rather than designing persistence tables first. Use CAP event handlers deliberately: before for validation/defaulting, on for custom operation handling, after for result enrichment, while respecting CAP request transactions.
easyCAP

2. A retail customer wants a custom store-audit app on BTP. Explain why you'd use CAP and how you'd start.

CAP lets you model data and services in CDS and get OData services and persistence from generic providers, writing code only for business logic. Start with cds init, model entities in db/ (using cuid, managed), expose services in srv/, run cds watch locally with SQLite and CSV mock data, add a Fiori elements UI in app/, then cds add hana, xsuaa and mta for BTP and deploy with cf deploy via a pipeline.
mediumCAP

3. How would you apply CAP in a real SAP project? Walk through the design or implementation approach.

A consulting team built a CAP-based order exception management extension for an S/4HANA Cloud public edition customer. During UAT, warehouse staff reported they could see orders but could not correct exception flags, while a supervisor could not see any data at all despite being assigned the admin role. Investigation revealed two issues: the supervisor's role collection had been created in the wrong subaccount (a common mistake when multiple subaccounts exist for dev/test/prod), and the warehouse role template's scope name in xs-security.json had been renamed during a refactor without redeploying the security configuration, so the deployed XSUAA instance still had the old scope name while the CDS model referenced the new one. Resolving it required redeploying the security artifacts, recreating the role collection in the correct subaccount, and re-testing token contents using a JWT decoder before declaring the fix verified. A Fiori app needed multi-step editing, while an external integration required immediate stateless updates. The project exposed separate service projections: draft-enabled for UI and non-draft for integration, reusing the same domain model. A logistics company builds a CAP application to manage delivery orders. Internal dispatchers need full read/write access through an AdminService, while external carrier partners should only see order items and delivery addresses, never internal cost fields or the ability to change order status. The team models Orders and OrderItems once in the shared domain model, then defines two separate services - AdminService with @requires('OrderAdmin') and PartnerService with @restrict annotations limiting partners to READ on a filtered projection. A custom before-CREATE handler validates that every new order references a valid customer before it reaches the database, preventing orphaned records that previously caused reconciliation issues in a legacy system. A retail customer wants a lightweight BTP application that lets store managers check book stock levels and request replenishment, without touching their S/4HANA core system directly. The project team chooses CAP for a side-by-side extension: the domain model captures Books and StockRequests, the service layer exposes a read-only catalog API and a write API for replenishment requests, and a scheduled job later synchronizes confirmed requests back into S/4HANA via OData API calls. Because CAP generated the OData service and enforced role-based access automatically, the team delivered a working proof of concept within the first sprint and spent the remaining
mediumCAP

4. Suppose you inherit an existing CAP solution. How would you review it before making a change?

First understand the current business requirement, dependencies, configuration or code path, integrations, production usage, and known pain points. Do not redesign before establishing the existing behavior. Lesson areas to review: Building and Exposing Services with CDS: Data Modeling to Runtime; CAP Domain Modeling: CDS Entities, Associations, Compositions and Aspects; CAP Multitenancy, Extensibility and Production Deployment; CAP OData Services, Actions, Functions and Draft; CAP Service Handlers: Before, On, After and Transactions; Securing CAP Services with XSUAA Role-Based Authorization; What CAP Is and Why It Matters on SAP BTP Known mistakes: • Assuming a correctly written @restrict annotation is enough without creating and assigning the corresponding role collection in the BTP cockpit • Relying on mocked authentication users during development and never validating real XSUAA token behavior before go-live • Renaming scopes in xs-security.json without redeploying the security configuration, causing mismatches between deployed XSUAA scopes and CDS annotations • Conflating CAP-level XSUAA authorization with backend S/4HANA authorization, leaving business data checks unimplemented • Forgetting that scope names must be prefixed correctly to match $XSAPPNAME conventions, causing silent authorization failures • Not testing role collection assignment across all relevant subaccounts (dev, test, prod) separately • Assuming multitenancy is only subscription setup. • Sharing caches without tenant context. • Ignoring tenant-specific upgrade/migration. • Having no noisy-neighbor monitoring. • Testing authorization but not tenant isolation. • Duplicating entity definitions inside service files instead of using projections on the shared domain model, causing schema drift between services over time. • Relying only on UI-level hiding of fields instead of using @restrict/@readonly annotations, leaving sensitive fields accessible via direct API calls even when a UI does not display them. • Forgetting that compositions cascade deletes, and modeling a relationship as Composition when Association was intended, causing unintended data loss. • Testing authorization only with the local mock user and never validating actual XSUAA role/scope mapping in a deployed subaccount, leading to production access issues discovered late. • Writing custom handler logic for functionality (basic validation, default values) that CDS annotations could already express declaratively, increasing code to maintain unnecessarily. • Enabling draft on every service. • Modeling commands as arbitrar
mediumCAP

5. A Fiori elements app on CAP needs approval actions and multi-step editing. How do you design the OData service?

Add a bound action (e.g. approve on Orders) for state changes and functions for side-effect-free calculations. Enable draft on the root entity (@odata.draft.enabled) so users edit in steps; implement validations in before SAVE (activation) handlers, not on every PATCH, and remember draft events/entities differ from active ones. Add annotations for value helps and side effects; test in the Fiori elements preview and via REST calls.
mediumCAP

6. Secure a CAP app so viewers read only their country's data and admins manage everything.

Use @requires on AdminService ('Admin') and @restrict on CatalogService entities: grant READ to 'Viewer' with where: 'country = $user.country', and READ/WRITE to 'Editor' if needed. Test locally with mocked users and attributes in package.json. Generate xs-security.json (cds add xsuaa) including the country attribute; in BTP, fill the attribute via role/role collection configuration or IdP attributes, map collections to groups, and test with real tokens.
mediumCAP

7. Design CAP services for a catalog app used by end users and administrators.

Keep one domain model in db/ and create consumer-specific services: CatalogService with @readonly projections excluding internal fields, AdminService with full access. Add annotations for UI and value helps. Provide CSV mock data for local tests; use cds bind to test against HANA Cloud and XSUAA in hybrid mode; deploy the schema with cds deploy/HDI via MTA.
mediumCAP

8. An order-management CAP model causes accidental data loss and complex services. How do you improve the domain model?

Review relationships: use compositions only for contained children (Order → Items) so deep insert/cascade delete are correct, and associations for independent entities (Customer, Address, Product). Use common aspects (cuid, managed, Currency, CodeList) and localized texts; keep the model consumer-independent and expose consumers via projections. Migrate schema changes carefully in HANA (HDI handles most) and avoid late renames.
mediumCAP

9. Custom CAP handlers broke Fiori paging and filtering, and a remote call per row made reads slow. How do you restructure the logic?

Use before handlers for validation/defaults (req.error/req.reject), keep the generic on-READ, and enrich results in after-READ handlers. Implement on handlers only for actions or genuine replacements. Batch remote calls (collect keys, one query via cds.connect.to) or cache results; use CQL instead of raw SQL; rely on the request transaction and use cds.tx for background jobs. Add tests for $filter, $top and $expand.
hardCAP

10. A production issue is reported in CAP. What would you check first, and how would you troubleshoot it systematically?

Start by reproducing and scoping the issue, then validate the relevant master/configuration/runtime data and isolate the failing step before changing anything. Common failure patterns from the lesson set: • Assuming a correctly written @restrict annotation is enough without creating and assigning the corresponding role collection in the BTP cockpit • Relying on mocked authentication users during development and never validating real XSUAA token behavior before go-live • Renaming scopes in xs-security.json without redeploying the security configuration, causing mismatches between deployed XSUAA scopes and CDS annotations • Conflating CAP-level XSUAA authorization with backend S/4HANA authorization, leaving business data checks unimplemented • Forgetting that scope names must be prefixed correctly to match $XSAPPNAME conventions, causing silent authorization failures • Not testing role collection assignment across all relevant subaccounts (dev, test, prod) separately • Assuming multitenancy is only subscription setup. • Sharing caches without tenant context. • Ignoring tenant-specific upgrade/migration. • Having no noisy-neighbor monitoring. • Testing authorization but not tenant isolation. • Duplicating entity definitions inside service files instead of using projections on the shared domain model, causing schema drift between services over time. • Relying only on UI-level hiding of fields instead of using @restrict/@readonly annotations, leaving sensitive fields accessible via direct API calls even when a UI does not display them. • Forgetting that compositions cascade deletes, and modeling a relationship as Composition when Association was intended, causing unintended data loss. • Testing authorization only with the local mock user and never validating actual XSUAA role/scope mapping in a deployed subaccount, leading to production access issues discovered late. • Writing custom handler logic for functionality (basic validation, default values) that CDS annotations could already express declaratively, increasing code to maintain unnecessarily. • Enabling draft on every service. • Modeling commands as arbitrary CRUD field changes. • Treating functions as side-effecting actions. • Allowing unbounded OData reads. • Sharing one contract across incompatible consumers. • Overriding generic CRUD without need. • Performing irreversible remote calls inside a local transaction with no recovery design. • Putting blocking validation in after handlers. • Trusting client-side authorization. • Ignoring query/pagination semantics. • Treating CAP as just "a Node.js fram
hardCAP

11. What are the most important design decisions, trade-offs, and best practices in CAP?

• Keep every stateful component tenant-aware. • Automate subscribe/unsubscribe. • Test cross-tenant isolation. • Version extensions. • Monitor per-tenant resource patterns. • Keep handlers minimal. • Use framework transaction context. • Isolate remote side effects. • Preserve generic query semantics. • Add tests for validation and authorization. • Keep xs-security.json scopes and CDS @restrict annotations in sync and redeploy security configuration whenever scope names change • Use distinct role templates for read versus write access rather than a single broad admin scope • Test authorization with real XSUAA tokens in a dev subaccount before relying on mocked users for sign-off • Document which role collections must be created in which subaccounts as part of deployment runbooks • Treat CAP authorization as protecting the extension surface only, and explicitly verify how backend system data authorization is handled • Log authorization failures with enough context (user, requested scope, entity) to speed up production troubleshooting without exposing sensitive token content • Model lifecycle ownership explicitly. • Keep service projections narrow. • Reuse aspects for cross-cutting fields. • Test deep operations. • Hide persistence details. • Model relationships deliberately: use Composition only when child records should not outlive the parent, and Association otherwise. • Keep authorization declarative wherever possible using @requires and @restrict, reserving custom handler code for logic that cannot be expressed declaratively. • Expose multiple purpose-specific services (admin, partner, public) as projections over one shared domain model rather than duplicating entities. • Always validate CDS models and queries against SAP HANA Cloud before go-live, since SQLite (used for local development) does not perfectly replicate all HANA SQL behaviors. • Use before-phase handlers for validation and on-phase handlers for overriding default persistence logic, keeping event-handler responsibilities clear and testable. • Start every CAP project with a clear, minimal domain model before writing any service or handler code. • Use `cds watch` and SQLite for fast local iteration, but validate against SAP HANA Cloud before considering a feature done. • Keep domain models (db/) and service exposure (srv/) conceptually separate so the same data model can back multiple services with different views and access rules. • Document early which BTP extensibility pattern (side-by-side vs in-app) was chosen and why, since this decision has long-term architectural consequences. • Use
hardCAP

12. You are turning a CAP app into a multitenant SaaS offering. What do you design?

Add multitenancy (cds add multitenancy) to get MTX services (@sap/cds-mtxs), SaaS registry integration and tenant onboarding; each subscriber gets its own HDI container. Ensure tenant isolation in code: use cds.context.tenant for caches, logs and background jobs. Plan upgrades so tenant databases are updated with each release, decide on extensibility and feature toggles, and test with at least two tenants. Deploy via MTA and CI/CD with tenant upgrade steps.

Related lesson

BTP CAP Part 5: Domain Modeling with Entities, Associations, Compositions and Aspects

Related topics

Next practice step

Go deeper on this topic