Wednesday, February 10, 2021

SAP CDS Views: Creating a CDS View with an Authorization Check

In this post I am going to demonstrate the creation of a CDS view with an authorization check. Implementing  authorization checks hand in hand with the CDS view is a great way to achieve even more code pushdown.

The example in this post is from the RE-FX module but it can be applied in every module.

I am going to redesign a common report in the real estate, for example the occupation and pull some contract and partner data.

The Data Definition Language (DDL) part looks like this:



In the annotation part it is very important to activate the authorization check.

The authorization check will be executed for the company code (BUKRS).

For this purpose we need to define an access control, the so called Data Control Language (DCL) part.


Usually, we want to integrate the standard SAP authorization checks as they are defined in PFCG.
For the company code we would refer to the dedicated authorization object F_BKPF_BUK.

The DCL grants access to the previously defined DDL zlo_demo. 

The user can see only the company codes for which they are authorized through the authorization object F_BKPF_BUK.














No comments:

Post a Comment