SAP Knowledge Base Article - Public

3387665 - CDS View I_ADDRESS_2 Does Not Display the Data of the Business Partner

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

  1. Go to the app Custom CDS Views.
  2. Select Create button.
  3. On the Create Custom CDS View dialog box, provide the below:
    Label:
    Name:
    Scenario: Standard CDS View.
  4. Select Create.
  5. In the Select: Primary Data Source screen, search for I_ADDRESS_2.
  6. Primary Datasource is released with access Protection: Privileged Only.
  7. 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.

  1. 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.
  2. 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.
  3. 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 

  1. Open the ABAP Development Tools app
  2. File->New->ABAP Project
  3. Currently logged into XYZ (XYZ represents the SAP internal test system)
  4. Select the icon Open ABAP Development Object
  5. Select the Data Definition for I_ADDRESS_2
  6. 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'

    ========================

  7. Select F8
  8. On the right side, click on the tab SQL Console
  9. Scroll down to the bottom of the code lines, make the required changes as below

    FROM
      I_ADDRESS_2
      WITH PRIVILEGED ACCESS
     
  10. Select the button Run
  11. Check the Data Preview on the right side
  12. 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

Product

SAP S/4HANA Cloud Public Edition all versions