SAP Knowledge Base Article - Public

3398420 - SELECT statement WITH PRIVILEGED ACCESS cannot be specified together with a path expression - SAP S/4HANA Cloud

Symptom

A custom logic implementation with a SELECT statement WITH PRIVILEGED ACCESS to a Custom Business Object does not work with a path expression to the Custom Business Object child association.

Environment

SAP S/4HANA Cloud

Reproducing the Issue

1. Creating a custom logic that is called with a technical user or communication user.

2. Using WITH PRIVILEGED ACCESS in a SELECT statement to access a Custom Business Object.

SELECT * FROM YY1_TESTABC WITH PRIVILEGED ACCESS INTO TABLE @DATA(lt_data).

3. Adding an expression path to the select statement to access the Custom Business Object child association.

SELECT * FROM YY1_TESTABC  WITH PRIVILEGED ACCESS
\_testabcchild[ childID = '01' ] as child
INTO TABLE @DATA(lt_data).

4. Issue: "\_TESTABCCHILD" is invalid here (due to grammar).

Cause

The addition WITH PRIVILEGED ACCESS cannot be specified together with a path expression sql_path. It affects only the CDS entity for which it is specified. It does not affect the CDS entities exposed using CDS associations of the specified CDS entity.

For more information, please refer to ABAP Keyword Documentation - SELECT, FROM data_source.

Resolution

It is possible to access the child node CDS view separately.

SELECT * FROM YY1_TESTABC WITH PRIVILEGED ACCESS
INTO TABLE @DATA(lt_data).

SELECT * FROM YY1_TESTABCCHILD_TESTABC WITH PRIVILEGED ACCESS
INTO TABLE @DATA(lt_data2).

In order to find the child node CDS view:

[1] For 3-System Landscape, it is possible to check the data definition of the Custom Business Object YY1_TESTABC by accessing the development system in the ABAP Environment.

define view YY1_TESTABC as select from YY1_A12345BC6D7E as Node
  association [0..*] to YY1_TESTABCCHILD_TESTABC as _TESTABCCHILD
    on _TESTABCCHILD.SAP_PARENT_UUID = $projection.SAP_UUID

[2] It also possible to use the code completion feature(CTRL+Space) of the code editor in the Custom Logic app. The data definition name for a CBO child node should follow the pattern YY1_{ <Child Node Identifier> }_{ <CBO Name> }. Truncated to at most 30 characters.

I.e. writing "YY1_TESTABC" and pressing CTRL+Space will show the child node CDS view in the suggestion box.

See Also

ABAP Keyword Documentation - SELECT, FROM data_source

Keywords

custom logic, WITH PRIVILEGED ACCESS, path expression, custom business object, child node , KBA , BC-SRV-APS-EXT-BO , Custom Tables and Nodes , Problem

Product

SAP S/4HANA Cloud Public Edition all versions