SAP Knowledge Base Article - Public

3742719 - "Please use a typed literal instead of 0" error message in Custom Analytical Queries and Services app

Symptom

Error message "Please use a typed literal instead of 0" is displayed in the logs of a Custom Analytical Query when adding a Calculated Measure and trying to publish it. 

Environment

SAP S/4HANA Cloud Public Edition

Reproducing the Issue

  1. Go to Custom Analytical Queries and Services app
  2. Open or create a Query
  3. On "Model" tab click on "Add" > Calculated Measure
  4. Write your formula and try to publish the Query

Cause

Typed literals should be used instead of untyped literals. They offer many advantages, such as more flexibility with regard to the data type they can have, explicit type declaration, and checking type compatibility of the value specified.

Example of typed literals: 

abap.int1'...'
abap.int2'...'
abap.int4'...'
abap.int8'...'

Resolution

Check the documentation CDS DDL - CDS View Entity, Typed Literals to find the Typed Literal for your scenario.

Example:

Instead of using the formula

"CASE WHEN element > 0 THEN 1 ELSE 0 END"

use the formula

"CASE WHEN element > abap.int4'0' THEN abap.int4'1' ELSE abap.int4'0' END". 

See Also

Refer to ABAP SQL - Typed Literals.

Keywords

abap, literal, typed literal, custom analytical query, service, queries, calculated measure, calculation, formula, 0, integer , KBA , BC-SRV-APS-EXT-AQD , Fiori based Query Designer , Problem

Product

SAP S/4HANA Cloud Public Edition all versions