SAP Knowledge Base Article - Public

3597869 - SAP Datasphere View displays empty values for columns using LAG function due to data type mismatch

Symptom

SAP Datasphere View displays empty cells for certain computed fields, even though the backend service returns valid values for these fields. This behavior may be caused by data type mismatches during modeling which lead to incompatible datatype when using specific functions such as LAG(). Other functions may also be affected. 

  • The LAG function in SAP Datasphere returns NULL when used without any SQL view.
  • The same function works fine in SAP Hana database Explorer.
  • The issue is specifically observed in SAP Datasphere > Data Builder > Views.

Environment

  • SAP Datasphere

Reproducing the Issue

  1. Use the LAG function without any SQL view in SAP Datasphere.
  2. Observe that it returns NULL.

A typical query may look like the following:

SELECT <Key_Fields>,
       <Decimal_Column>,
       LAG(<Decimal_Column>, 1)  AS <Computed_Column>
FROM <Source_View>

Cause

This issue is caused by a data type mismatch between the computed column's metadata and its actual runtime value.

  1. A field is computed using the LAG () function (or similar window functions) on a decimal-based source column (e.g., DECIMAL (15,2))
  2. But the resulting computed column is incorrectly inferred as an INTEGER in the system metadata
  3. During runtime, the service may return the value as a string-formatted decimal (e.g., "123.45"),
  4. The frontend uses the metadata to interpret the value as an integer, and fails to parse the actual string, resulting in the field being shown as blank.

Resolution

Workaround:

Ensure the computed column explicitly uses the correct data type by casting the result of the LAG () (or similar) function (For the example in Reproduce part, you need to align (using Datapshere UI) the data types of <Computed_Column> with <Decimal_Column>). This guarantees that the metadata accurately reflects the actual value format returned at runtime. 

Additionally, use “Validation” and check if the data types of Design Time and Runtime matches.

Resolution:

The development team is investigating potential data type and display handling issues that may cause values to appear blank in the UI.

Keywords

SAP Datasphere, Data Builder, Views, LAG function, NULL result, SQL view, SAP Hana database Explorer, datatype mismatch, data preview Null Value , KBA , DS-MD-VIW , Views , Problem

Product

SAP Datasphere all versions