Post

Why Do We Need Projection in ABAP RAP?

Learn why ABAP RAP projection BDEFs are essential for controlling field behavior, actions, and capabilities for different consumers like UI and API.

Recently, I was talking with a fresher who had just started working on an ABAP RAP object. When I looked at his project structure, I noticed this flow:

Root Entity (With some annotations) → BDEF → Service Definition → Service Binding

It works, but there was no Projection View or Projection BDEF. This is something I see quite often. Many developers are not sure why projections matter, and some assume they are only needed for RAP app development. But projections are useful for much more than that.

Example 1 — UI and API from the same business object:

Imagine the same RAP business object needs to serve both a UI application and an API. With projections, you can control what each consumer can access:

  1. An action available only in the UI
  2. An action available only through the API
  3. Field behavior per consumer — mandatory, read-only, hidden, etc.
  4. Draft enabled for the UI, but not for the API
  5. Different fields or capabilities exposed for each consumer

Example 2 — Two apps, one business object:

Say you need to build two apps:

  • Employee — to create a leave request
  • Manager — to approve or reject a leave request

Instead of building two separate business objects, keep the common logic in one BDEF and create separate Projection BDEFs for each app. Each projection exposes only what that application needs.

There are many more use cases like this. Projection is not just another RAP artifact. It helps you control how the same business object is exposed and consumed by different applications and APIs.

🔗 Business Object Projection — SAP Help

Why Do We Need Projection in ABAP RAP?

This post is licensed under CC BY 4.0 by the author.