Symptom
The User is previewing a Custom Analytical Query but is getting the following error:
"The result set does not contain any relevant data. Database returned the SQL code 304. Error text: division by zero undefined: search table error: [6859] AttributeEngine: divide by zero;exception..."
or
When previewing a Custom CDS View the following error is raised:
"HTTP Request Failed. StatusCode: 400. Bad Request."
Environment
SAP S/4HANA Cloud Public Edition
Cause
This error is normally due to a calculated field in the data source of the query that is causing a divide by zero issue.
Resolution
- The user must edit the Custom CDS View in the Custom CDS Views app.
- In the Selected Fields section check each of the calculated fields.
- If there is a division that is being done in any of the calculated fields then a check must be done first to ensure that the bottom will not equate to a 0.
- Example of calculated field that is not correct
<DataSource>.<FieldName> / <DataSource>.<FieldName2> - Example of a better way to do this calculation
case
when <DataSource>.<FieldName2> = 0
then
0
else
<DataSource>.<FieldName> / <DataSource>.<FieldName2>
end
This is only an example, and should be thoroughly tested before use.
Keywords
divide by 0, multidimensional report, Calculated Field, Custom CDS Views, query, http request failed, calculation6859, AttributeEngine, Database returned the SQL code 304 , KBA , BC-SRV-APS-GKE , Generic CDS Key User Editor , BC-SRV-APS-EXT-AQD , Fiori based Query Designer , BW-RUI-FPM , FPM Analytical GUIBB , Problem