Get Example source ABAP code based on a different SAP table
• ASPECT user ABAP_CDS_GRANT_SELECT
ABAP_CDS_DCL - DEFINE ROLE>, user_condition>
ABAP_SYNTAX ...$[ALL$|EXISTS$] element =$| <>$|?=> ASPECT user ...>
ABAP_VARIANTS: 1 ... ( element ) = ASPECT user_alias ...> 2 ... ( element ) = ASPECT user_business_partner_number ...>
ABAP Addition ... ALL$|EXISTS>
What does it do? User condition as part of an access condition> cds_cond>> in an access rule> of the statement DEFINE ROLE>> in CDS DCL>. In a user condition, the predefined aspect> user> is specified on the right side introduced with ASPECT>. The left side is compared with the user name > of the user currently logged on to AS ABAP by using one of the three operators =>>, <>>>, ?=>>, as in a literal condition>. The behavior when element is declared as optional element and missing at runtime is the same as for literal conditions.
Latest notes:
User conditions can be combined within an access rule using literal conditions> and PFCG conditions>, and inheritance conditions>.
A user condition acts like a comparison with the session variable $session.user>> in the CDS DDL>. It is not currently possible to use session variables on the right side of conditions in DCL.
The behavior when an element is declared as optional element and is missing at runtime matches the one for literal conditions. NON_V5_HINTS ABAP_HINT_END
ABAP_VARIANT_1 ... ( element ) = ASPECT user_alias ...>
What does it do? The value of the alias can be checked instead of the user name. If the user does not have an alias, the condition behaves like the Boolean predicate FALSE>.
ABAP_VARIANT_2 ... ( element ) = ASPECT user_business_partner_number ...>
What does it do? The number of the business partner assigned to the user can be checked instead of the user name. If the user does not have an assigned business partner, the condition behaves like the Boolean predicate FALSE>.
ABAP Addition
What does it do? The ALL> or EXISTS> quantifiers can be specified for user conditions and behave as for literal conditions.
ABAP_EXAMPLE_VX5 The following CDS view entity contains an element uname>, which contains a user name: DDLS DEMO_CDS_AUTH_USER The following role can be defined for the view: DCLS DEMO_CDS_ROLE_USER The role grants a user AS ABAP access to his or her own entries in the DDIC database table ABDOCMODE>, as well as to entries in which the UNAME> column is initial or contains a null value>. ABAP_EXAMPLE_END