
Business applications require an authorization concept for their data and for the operations on their data. Display and CRUD operations, and specific business-related activities, are, therefore, allowed for authorized users only.
In a transactional development scenario in RAP, you can add authorization checks to various components of an application. In this case, different mechanisms are used to implement the authorization concept.
- Authorization Checks for Read Operations
To protect data from unauthorized read access, the Core Data Services in ABAP provide their own authorization concept based on a data control language (DCL). To restrict read access to RAP business objects, it is sufficient to define CDS access controls for the CDS view entities used in RAP business object. The CDS access control objects contain conditions that are used to filter the data during any read access. In other words, access controls allow you to limit the results returned by a CDS view entity to those results you authorize a user to see.
- Authorization Checks for Modify Operations
In RAP business objects, modifying operations, such as standard operations (create, update, delete) and actions can be checked against unauthorized access during runtime. To retrieve user authorizations for incoming requests, authority checks are included in the behavior definition and implementation for your business object. In case of missing authorizations, the modification request is rejected.
Note
In UI scenarios, authority checks for modify operations are important, because the rejection of a modification request is visualized to the user (Consumer hints). For example, an action button is disabled for line items for which the user lacks execution authority.
- Authorizations for OData Services Consumption
SAP Gateway provides predefined roles as templates for developers, administrators, end users of the content scenarios, and support colleagues. SAP customers configure the roles based on these templates and assign users to the roles.
For you, as a service developer, there are no further steps required for the service to be consumed externally within the customer's landscape. In particular, you don't need to provide any authorization default values of the authorization objects and specific role templates required for execution of your service. SAP Gateway already provides predefined roles as templates for accessing SAP Fiori apps.

To establish authorization checks for read operations, corresponding CDS roles are defined in CDS access controls, using the data control language (DCL). A CDS role specifies access rules. Each access rule defines access to the CDS view that the role is assigned to. Individual access controls are needed for the different CDS view levels, like data model (BO definition), BO interfaces, and BO projections. While the access rules on data model level are based on ABAP authorization objects, access controls on interface or projection level often inherit the access rules from the underlying entities.
The behavior definition on data model level, contains the authorization definition. It specifies for which entities of the RAP BO individual authority checks are applied and which of the checks are performed for individual instances. The handler classes in the behavior pool then provide appropriate code exits for implementing the authorization checks, for example with the AUTHORITY-CHECK statement.






