SAP Knowledge Base Article - Public

3102263 - Get the error "Only Associations with cardinality "Zero or One [0..1]" shall be used." when publishing a CDS View

Symptom

Get the error "Only Associations with cardinality "Zero or One [0..1]" shall be used." when publishing a CDS View

Environment

SAP S/4HANA Cloud

Reproducing the Issue

  1. Create a CDS View in the app "Custom CDS View"
  2. Perform association from Primary data source to a associated data source. For the join condition, do not contain all the key fields of the associated data source
  3. Publish the CDS view

Cause

If the key fields do not contain n the join condition, then the result from the associated data source will not be unique, one entry from primary data source will map to multiple entries of the associated data source. For example, if there are 3 entries in the primary data source and 5 entries in the associated data source, the results of this newly created CDS will contain 5 entries. So, there will be 2 more duplicated entries of the primary data source. Then if you are using a field in the primary CDS where an aggregation takes place, due to the aggregation, it will results in a "multiplied" result. However, if you only perform aggregation for the associated data source, then the result will be correct.

 

Resolution

If you fully understand the risk, but still want to use it, please create a Custom CDS View with scenario "Standard CDS View" where you can define association to use cardinality 0..*. And then based on this view you can create a cube.

Keywords

Only Associations with cardinality, "Zero or One [0..1]", shall be used, CDS View , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem

Product

SAP S/4HANA Cloud 2108