ABAP Strings String templates


Example

String templates are a convenient way of mixing literal strings with values from variables:

WRITE |Hello, { lv_name }, nice to meet you!|.

It can also format things like dates. To use the logged on user's date format:

WRITE |The order was completed on { lv_date DATE = USER } and can not be changed|.

Functional method calls and expressions are supported:

WRITE |Your token is { to_upper( lv_token ) }|.
WRITE |Version is: { cond #( when lv_date < sy-datum then 'out of date' else 'up to date' ) }|.

Attention! Directly implementing temporary results (like method-calls) inside of string templates can lead to massive performance problems (read more about it here). While using it inside of rarely executed statements is okay, it causes your program to rapidly slow down in loops.