Hi, everyone. Recently I have started my learning journey about BTP CAPM. In this post, I’ll share my understanding of a core concept of Cloud Application Programming Model, i.e., projections. I hope this will better help newbies like myself to start learning about these concepts in an easier manner.
In this short post, let’s explore what a projection is, why it matters, and how to use it, with a simple real-world analogy and working example.
What is a projection?
A projection is like creating a filtered or simplified view of an existing data model (entity). We can choose only specific fields to expose, rename them, or selectively include associations. This is useful when we want to present limited information in our service — especially for performance, security, or clarity reasons.Â
Example:Imagine a backend system stores full employee records with sensitive fields like salary, address, and ID proof. But to the web service, we want to only expose the employee name & email fields. In this case, we can simply project these fields in the service.
Here is a simple schema.cds defining the relevant entities.
Now, we define a public employee in our odatav4 service to only expose Employee Name & Email.
Now, if we open our service via cds watch, we can see only the relevant data are exposed:-
If we click on “PublicEmp”,
As we can see, by using the simple projection, we are only exposing what we want. That is the core use of projection. These uses can be summarized as:
Security: Hide sensitive fields (like salary) from external consumers.
Performance: Reduce data size by limiting fields.
Maintainability: Expose only what is needed per use case.
Modularity: Present the same base entity in multiple ways.
I hope by reading this blog, you are familiar with the concept of projection. Happy learning!
Â
​ Hi, everyone. Recently I have started my learning journey about BTP CAPM. In this post, I’ll share my understanding of a core concept of Cloud Application Programming Model, i.e., projections. I hope this will better help newbies like myself to start learning about these concepts in an easier manner.In this short post, let’s explore what a projection is, why it matters, and how to use it, with a simple real-world analogy and working example.What is a projection?A projection is like creating a filtered or simplified view of an existing data model (entity). We can choose only specific fields to expose, rename them, or selectively include associations. This is useful when we want to present limited information in our service — especially for performance, security, or clarity reasons. Example:Imagine a backend system stores full employee records with sensitive fields like salary, address, and ID proof. But to the web service, we want to only expose the employee name & email fields. In this case, we can simply project these fields in the service.Here is a simple schema.cds defining the relevant entities.Now, we define a public employee in our odatav4 service to only expose Employee Name & Email.Now, if we open our service via cds watch, we can see only the relevant data are exposed:-If we click on “PublicEmp”,As we can see, by using the simple projection, we are only exposing what we want. That is the core use of projection. These uses can be summarized as:Security: Hide sensitive fields (like salary) from external consumers.Performance: Reduce data size by limiting fields.Maintainability: Expose only what is needed per use case.Modularity: Present the same base entity in multiple ways.I hope by reading this blog, you are familiar with the concept of projection. Happy learning!   Read More Technology Blog Posts by Members articlesÂ
#SAP
#SAPTechnologyblog