Concatenate strings

There are multiple way to concatenate string in ABAP. Below you’ll find all ways from best to worst in order.

Concatenate with string templates

lv_string = |The result is: { lv_result }.|.
"result: The result is: 100. 

String templates are the most flexible and allow whitespace as well as variables. If you system supports it, you should use them. For more information about string templates check this snippet.

Concatenate without spaces

lv_string = 'The result is: ' && lv_result && '.'.
"result: The result is:100. 

Using && is another way to concatenate strings, but it doesn’t support whitespace. To artificially get whitespace into the string you could use an invisible Character (ALT+255), but that is discouraged.

Classic

CONCATENATE 'The result is:' lv_result '.' INTO lv_string SEPARATED BY SPACE.
"result: The result is: 100 . 

As a last resort, there is the old way by using CONCATENATE. It’s not recommended anymore and string templates offer way more features.