Symptom
Your requirement is to fetch the Business Partner Address information like Street, Postal Code etc. Upon executing the CDS view I_ADDRESS_2 using the app Custom CDS View, you are unable to see any data regarding the Street and so on.
Environment
SAP S/4HANA Cloud
Reproducing the Issue
- Go to the app Custom CDS Views.
- Select Create button.
- On the Create Custom CDS View dialog box, provide the below:
Label:
Name:
Scenario: Standard CDS View. - Select Create.
- In the Select: Primary Data Source screen, search for I_ADDRESS_2.
- Primary Datasource is released with access Protection: Privileged Only.
- Execute the CDS View I_ADDRESS_2 and you are unable to see the complete Address information.
Cause
You may refer the documentation available in SAP Help Portal regarding the Access Protection in Custom CDS Views.
- If a CDS view has the status privileged only, the data contained cannot be accessed directly and is not exposed in an OData Service. The data can only be accessed via an association in a protected CDS view.
- If you build a custom CDS view on top of a CDS view with the status privileged only, your custom CDS view inherits the privileged only status of its parent CDS View. The same rules apply concerning data access.
- If a CDS view has the status protected, it can only be accessed if the corresponding business roles are assigned to a user. Otherwise, the data contained cannot be accessed or exposed in an OData Service.
Resolution
Use the CDS View: I_ADDRESS_2 which is released for the customers.
I_Address_2 and I_Address both have DCL authorizations built on them, which means to view the data, we need to add ‘With privileged access’ in the SQL statement which is generated in ADT on executing the view. It is not possible to preview the data in the Custom CDS view app.
You should login to the ADT tool (ABAP Development Tools) to execute the CDS view I_ADDRESS_2
- Open the ABAP Development Tools app
- File->New->ABAP Project
- Currently logged into XYZ (XYZ represents the SAP internal test system)
- Select the icon Open ABAP Development Object
- Select the Data Definition for I_ADDRESS_2
- Observe the below:
========================
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@Analytics : {
dataCategory: #DIMENSION,
dataExtraction: {
enabled: true }
}
@AccessControl.privilegedAssociations: ['_OrganizationAddress', '_PersonAddress', '_EmailAddress', '_CurrentDfltEmailAddress', '_PhoneNumber', '_CurrentDfltLandlinePhoneNmbr', '_CurrentDfltMobilePhoneNumber', '_FaxNumber', '_CurrentDfltFaxNumber', '_UniformResourceIdentifier', '_MainWebsiteURL']
@EndUserText.label: 'Address of an Organization or a Person'
======================== - Select F8
- On the right side, click on the tab SQL Console
- Scroll down to the bottom of the code lines, make the required changes as below
FROM
I_ADDRESS_2
WITH PRIVILEGED ACCESS
- Select the button Run
- Check the Data Preview on the right side
- Able to see the data available in the street fields for the Business Partner
I_ADDRESS_2~STREETNAME,
I_ADDRESS_2~STREETPREFIXNAME1,
I_ADDRESS_2~STREETPREFIXNAME2,
I_ADDRESS_2~STREETSUFFIXNAME1,
I_ADDRESS_2~STREETSUFFIXNAME2
See Also
Keywords
S4_PC, S4_1C, S/4HANA Cloud, Access Protection, Custom CDS Views, ADT, ABAP Development Tools, Privileged Only, Privileged, I_ADDRESS_2, Address, Street, Business Partner, BP. , KBA , LO-MD-BP , Business Partners , Problem