CDS TUTORIAL 5 : SAP HANA ABAP MADE EASY

Share

Please check Tutorial 1ÔÇŽ

CDS Access Control

Access control creates a check on top of CDS view by using authorization object.

Will create a CDS view later create an access control for the CDS view, we will also cover steps to create an authorization object and role.

  1. Create a CDS view 
  1. Create access control go to Core Data Services­čí¬Select Access Control and click on Next
  1. Give the access control name and its description and click on Next
  1. Select Define Role with PFCG Aspect and click on Finish
  1. LetÔÇÖs understand the generated code
  1. CDS view name zcds_eg30 field mtart authorization object­čí¬zmtart
  1. Annotation­čí¬ @AccessControl.authorizationCheck: #NOT_ALLOWED used to disable the access control
  2. Annotation­čí¬ @AccessControl.authorizationCheck: #CHECK it will display the data if user is authorized

Steps to create authorization object

  1. Create an authorization object TCODE SU21
  1. Provide the field for validation
  1. Create a role TCODE PFCG and click on single role
  1. Go to User tab and assign user
  1. Go to authorization tab and click on change authorization data
  1. Click on Do not select templates
  1. In the next screen click on Manually and assign authorization object and continue
  1. Expand the authorization node give the value for the object and SAVE
  1. Once clicking on SAVE it will create a profile click on Execute
  1. Click on Generate
  1. Go to Tcode SU01 and check the role was assigned there if it is in error click on user master record it will turn to green and save it
  1. Now you can use it.