Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

String templates

I just played around with the string tempülates now available in one of our updated systems. So i tried

  type_descr = cl_abap_typedescr=>describe_by_data( s ).

  CASE type_descr->type_kind.

    WHEN cl_abap_typedescr=>typekind_time.
      r = |{ s time = user }|.

Where s is an importing parameter of a method having type CLIKE

but i got the error "Format directive TIME cannot be used on the embedded expression".

Inserting a helping variable

ltime type t



r = |{ ltime time = user }|.

solves this, but thats exactly what i want to avoid: a helping variable just for type casting

Is there no way to solve this without a helping variable?

Please don't give hints to use concatenate or write into, i know these and i know how to use this. My intention is to get experience with string templates.

Former Member

Quote from F1 help:

This formatting option defines the format of a time. You can declare the option TIME only if the embedded expression has the data type t.

So you can not use it without putting type t there

Maybe it could be done with inline data/variable declaration. But i can't try it, since its not available in my ABAP version...

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question