- Adding two fields and one of the field comes from the association, for example: C=DatasourceA.FieldA+DatasourceB.FieldB. DatasourceB is the associated data source.
- If the value of the DatasourceB.FieldB is "0", no matter what DatasourceA.FieldA is, the calculated field value will be "0"
SAP S/4HANA Cloud
Reproducing the Issue
- Create an calculated field and one of the field comes from the association
- Preview the CDS view, if one of the field’s value is zero, then the result of calculated field is zero
The association could deliver an empty result set: e.g. if an object has an association to it's items, it could be that a specific object instance does not have any items and the association would return null. X + null is then null (0 is returned)
Use coalesce (expression1, expression2) function, if expression1 is not null, expression1 is returned, otherwise expression2 is returned.
For example: coalesce(DatasourceA.FieldA, 0) + coalesce(DatasourceB.FieldB, 0)
Custom CDS View, 0, calculated field , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem
SAP S/4HANA Cloud 1811