Symptom
Error "The association _I_XXX cannot be used locally in the view (SDDL_PARSER_MSG/061)" occurs, while publishing Custom CDS View.
Environment
SAP S/4HANA Cloud
Reproducing the Issue
[CASE 1]
- Create a CDS view in the Custom CDS View app.
- Associate several data source to the primary data source. For example, the primary data source is A and the associated data source are B, C.
- When define the "ON" condition for data source D, the field of data source B is used instead of the field of data source A.
- Publish the Custom CDS View.
- Error message is triggered: "The association _I_XXX cannot be used locally in the view".
[CASE 2]
- Create a CDS view in the Custom CDS View app.
- Associate another data source to the primary data source. For example, the primary data source is A and the associated data source are B.
- When define the "ON" condition for data source B, you are using a path expression as in A.Field is alias of A._Association.Field.
- Expose any field from custom CDS view B.
- Publish the Custom CDS View.
- Error message is triggered: "The association _I_XXX cannot be used locally in the view".
Cause
When performing the association, the field of the primary data source should be used in the right-hand side of the join condition.
However, path expressions from the primary data source are not allowed in ON condition.
Resolution
[CASE 1]
- Edit the Custom CDS view.
- Change the right-hand side of the join condition to the field of the primary data source.
[CASE 2]
- Edit the Custom CDS view A.
- Expose the field from the association of the primary data source, A._Association.Field as Field1.
- Publish custom CDS view A.
- Create a new custom CDS view B and make A as primary data source.
- Add the association to the data sources to C and use A.Field1 in the ON condition.
- Expose field C.Field.
Keywords
The association cannot be used locally in the view, Custom CDS View, join condition, locally defined association, the ON condition of the association is applied directly to the join ON condition, the join ON condition may contain invalid clauses, clauses of this type cannot be used in ON conditions of joins, Message no. SDDL_PARSER_MSG061, SDDL_PARSER_MSG/061 , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem