Skip to Content
Technical Articles
Author's profile photo Andrea Schlotthauer

Release News: ABAP SQL now offers typed literals

Since ABAP release 7.80, ABAP SQL offers typed literals. Typed literals cover far more data types than untyped literals, they clearly define their data type and type compatibility is checked in your IDE during design time. Overall, typed literals reduce the complexity of your coding. Start using them now!


A typed literal is a literal whose data type is defined by specifying an ABAP Dictionary type explicitly.

Syntax: datatype`<literal>`

datatype specifies the required data type. Almost all built-in ABAP Dictionary types are possible: INT1, INT2, INT4, INT8, DEC, DECFLOAT16, DF16_DEC, DF16_RAW, DECFLOAT34, DF34_DEC, DF34_RAW, FLTP, CHAR, SSTRING, STRING, RAW, RAWSTRING, DATN, DATS, TIMN, TIMS, UTCLONG, NUMC, CLNT, LANG, CURR, CUKY, QUAN, UNIT.

<literal> specifies the value in single backquotes. The value must match the data type specified under datatype. Otherwise, a syntax check error occurs.

The maximum length of the content of a typed literal is 255 and this can be achieved only by using the literal operator &. This literal operator can be used in typed literals of all categories and data types to concatenate two literals of the same type.

Example: int8`123` & `456`.


The following example uses typed literals of types UTCLONG, DATN, and INT8 in different operand positions.

       FROM demo_expressions 
         utcl_add_seconds( utclong`2020-04-01T12:01:01,2`,50 ) AS utcl, 
         datn_add_months( datn`17890101`,15 ) AS add_months, 
         int8`9999999999999999` AS int8
INTO @DATA(result).

Without typed literals, there would be the following problems:

  • Untyped literals are available only as character literals of type c or string, or as numeric literals of type i or p. The data types UTCLONG and DATN are not available as untyped literals. The ABAP SQL cast expression is also not possible in the shown example, because UTCLONG and DATN are no valid target types.
  • There are no numeric untyped literals of type INT8. Without a typed literal, 9999999999999999 would be interpreted as packed number.

With typed literals, you can specify type-compatible literals. This makes literals available in more operand positions than before, with fewer type conversions being required.


Hopefully, this blog post could demonstrate how typed literals can reduce the complexity of your coding and make your code simpler, shorter, and more precise. Typed literals cover almost all built-in ABAP Dictionary data types and therefore, can be used in far more operand positions. They explicitly and unequivocally define their data type and thus reduce ambiguity. Finally, they reduce the risk of runtime errors since type compatibility is checked during design time.

Currently, typed literals are available only in ABAP SQL, not in the ABAP Programming Language.

Further Details

For further details, see the ABAP Keyword Documentation, topic ABAP SQL – Typed Literals.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Santhosh Kumar Cheekoti
      Santhosh Kumar Cheekoti


      1. Can we also use CONV #() constructor function to add type to literals? if yes how is it different from the above syntax?


      Author's profile photo Kilian Kilger
      Kilian Kilger

      Hi Santosh,

      1. there is a fundamental difference between the CONV #( ) - Operator and typed literals: the CONV - Operator does a conversion at runtime, while the typed literal creates the literal as this type. So the typed literal will be faster and should be preferred.
      2. You cannot use the CONV - Operator directly in ABAP SQL. You must then use @( ) - ABAP expression escape inside ABAP SQL, i.e.
        @( CONV int8( '9999' ) )​

        and the like. Not however, that this does not work for dynamic SQL, as there is no dynamic version of ABAP expressions. Typed literals work all the time.


      Author's profile photo Santhosh Kumar Cheekoti
      Santhosh Kumar Cheekoti

      Hello Kilian,

      Thank you for your reply

      Author's profile photo Jacques Nomssi Nzali
      Jacques Nomssi Nzali

      Hello Andrea,

      thanks for the heads up.

      I can see typed literals are listed as changes  ABAP SQL in Release 7.55 but I could not get it to work on the developer edition. So which release is ABAP 7.80 part of?

      best regards,


      Author's profile photo Andrea Schlotthauer
      Andrea Schlotthauer
      Blog Post Author

      Hi JNN,

      typed literals are available from ABAP Platform Cloud 2005 / ABAP Platform 2020.

      Hope this answers your question.