Ansicht
Dokumentation

ABENEML_AUTH_CHECK_DISABLE_ABEXA - EML AUTH CHECK DISABLE ABEXA

ABENEML_AUTH_CHECK_DISABLE_ABEXA - EML AUTH CHECK DISABLE ABEXA

rdisp/max_wprun_time - Maximum work process run time   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

- AUTHORITY-CHECK DISABLE

This example demonstrates the statement AUTHORITY-CHECK DISABLE BEGIN CONTEXT ... AUTHORITY-CHECK DISABLE END. with an unmanaged RAP business object.

Data model

The CDS data model consists of the root entity DEMO_UNMANAGED_AUTH:

Behavior definition

The CDS behavior definition DEMO_UNMANAGED_AUTH is defined in CDS BDL as follows:

Behavior implementation

For the above BDEF, one behavior pool is created. The global class of the behavior pool is BP_DEMO_UNMANAGED_AUTH. The actual behavior implementation takes place in local classes that are defined and implemented in the BP_DEMO_UNMANAGED_AUTH========CCIMP of the behavior pool. The handler methods do not contain any implementations. To demonstrate the statement AUTHORITY-CHECK DISABLE, multiple AUTHORITY-CHECK OBJECT statements are included in the read method that check the authorization. One of these statements is inside an AUTHORITY-CHECK DISABLE statement. An internal table that is declared in the global class is filled to log sy-subrc values that are returned by the individual AUTHORITY-CHECK OBJECT statements.

Source Code

Execute

Description

Access with ABAP using EML

The above source code uses EML to access the RAP business object from an ABAP program:

A RAP read operation is carried out.

As shown above, the BDEF defines two RAP authorization contexts using the three demo authorization objects AUTHOBJ1 and AUTHOBJ2. For AUTHOBJ2, an authority check is disabled for read.

The output shows the entries of an internal which demonstrates the effect of the AUTHORITY-CHECK DISABLE statements that are implemented in the local class of the behavior pool. When an AUTHORITY-CHECK DISABLE BEGIN CONTEXT ... AUTHORITY-CHECK DISABLE END statement is used, the field EML_STMNT_USED is flagged. When an authorization context is activated, authority checks for the associated authorization objects are always successful and the returned value for sy-subrc is 0. See more information on the sy-subrc values returned by AUTHORITY-CHECK OBJECT statements in the ABAP Keyword Documentation.

Table entries:

  • The first two entries show the sy-subrc values returned by AUTHORITY-CHECK OBJECT statements that are used with the respective authorization objects. sy-subrc is only 0 for AUTHOBJ2 because the authorization context is defined with the addition ... for disable ( read ) in the BDEF which shows that the AUTHORITY-CHECK DISABLE BEGIN CONTEXT ... AUTHORITY-CHECK DISABLE END is implicitly wrapped around this authorization context. This is not true for the authorization context ac1.
  • The third entry shows the effect of AUTHORITY-CHECK DISABLE BEGIN CONTEXT ... AUTHORITY-CHECK DISABLE END statement which is used for the authorization context ac1. An AUTHORITY-CHECK OBJECT statement that is used within AUTHORITY-CHECK DISABLE BEGIN CONTEXT ... AUTHORITY-CHECK DISABLE END statement has the effect that the sy-subrc value shows 0 indicating that the authorization context is disabled.
  • Note that putting the authorization context ac2 inside an AUTHORITY-CHECK DISABLE BEGIN CONTEXT ... AUTHORITY-CHECK DISABLE END statement is irrelevant because it is implicitly there due to the BDEF specification.





General Data in Customer Master   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 5609 Date: 20240512 Time: 012802     sap01-206 ( 88 ms )