Symptom
When trying to preview data from a custom analytical query it is throwing error message "Database returned the SQL code 339" & "Cannot convert string to int".
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Open the application 'Custom Analytical Queries'.
- Search for the custom query and attempt to preview the data.
- The error message "Database returned the SQL code 339" occurs.
Cause
A value in the dataset was read as a string when the expected value is integer.
Resolution
- Check the calculations and measures defined within the Custom CDS View that is being consumed by the analytical query.
- Identify and correct any values recorded as strings where integers are expected. For example:
-
- Replace '1.' with '1' or '1.0' to ensure proper data type conversion.
Keywords
custom analytical query, sql code 339, conversion, error, string, integer, empty dataset, custom cds view, business catalog, sql, query, s/4hana, measures, calculations, 339 , KBA , BC-SRV-APS-EXT-AQD , Fiori based Query Designer , Problem
Product
SAP S/4HANA Cloud Public Edition all versions
SAP Knowledge Base Article - Public