sapui5tutors SAPUI5 • Fiori • SAP BTP Step-by-step tutorials Real project examples Interview Q&A
Practical SAPUI5 • Fiori • SAP BTP tutorials and interview prep

CAPM Common Pitfalls: 15 Mistakes Beginners Make

Learn from everyone else's mistakes

CAP is deceptively easy to start and surprisingly easy to misuse. These are the fifteen mistakes that show up again and again — in tutorials, in projects, in code reviews.

Almost every item below has the same root cause: fighting the framework instead of using it.


Modeling mistakes

  1. Exposing database entities directly — no service layer, no projections; the API becomes an accident of the schema.
  2. Association vs composition confusion — using associations for owned children, losing cascade delete and draft support.
  3. Hand-rolled keys everywhere — ignoring cuid and managed aspects, reinventing audit fields per entity.
  4. Missing on conditions — unmanaged associations without explicit join conditions fail at runtime.
  5. God entities — one entity with 80 fields instead of a composed structure; unmaintainable in UI and code.

Handler mistakes

  1. Writing on handlers for everything — replacing the default implementation when a before/after hook would do.
  2. Validation in the wrong phase — blocking draft saves with strict validation instead of validating on SAVE/activation.
  3. Raising exceptions in validations — use req.error()/req.reject(); thrown errors bypass proper error formatting.
  4. Ignoring req.query forwarding — reimplementing $filter/$top for external services instead of passing the query through.
  5. Business logic in the UI — duplicating validations in Fiori that belong in service handlers; they drift apart within months.

If you remember one thing: before validates, on implements (rarely), after enriches. Most handler bugs are phase bugs.


Operations mistakes

  1. Developing against SQLite-isms — using features HANA doesn't support, discovering it at deploy time.
  2. Credentials in code — hardcoding destinations and secrets instead of using BTP destination services.
  3. No tests — "the framework handles it" is true for generic CRUD, not for your custom logic.
  4. Manual deployments — SSH-style deploy habits on a platform built for pipelines; every deploy a snowflake.
  5. Skipping authorization until "later" — bolting on @restrict after go-live means re-testing every query path.

The meta-lesson

Notice the pattern across all fifteen: every mistake is someone reimplementing what CAP already does — hand-rolled keys, manual CRUD, custom auth, DIY deployments. The framework is opinionated because those opinions are earned from thousands of projects.

You don't have to agree with every opinion. But disagree deliberately, after understanding what the default gives you — not by accident, because you didn't know the default existed.


The checklist version

Before any CAP project ships: service layer over projections, compositions for owned data, validations in the right phase, tests for custom logic, auth from day one, pipeline deploys. Pin this list.

Which of these bit you? Confess in the comments.