In SAP ABAP, you can concatenate strings using different methods depending on your ABAP version and requirements. Here are the common ways:


1. Using CONCATENATE Statement

DATA: lv_str1 TYPE string VALUE 'Hello',
lv_str2 TYPE string VALUE 'ABAP',
lv_result TYPE string.
CONCATENATE lv_str1 lv_str2 INTO lv_result SEPARATED BY space.
WRITE: lv_result. " Output: Hello ABAP

2. Using && Operator (ABAP 7.40+)

DATA: lv_result TYPE string.
lv_result = 'Hello' && ' ' && 'ABAP'.
WRITE: lv_result. " Output: Hello ABAP

3. Using STRING_CONCATENATE (ABAP 7.50+)

DATA: lv_result TYPE string.
lv_result = STRING_CONCATENATE( val1 = 'Hello' val2 = 'ABAP' separator = ' ' ).
WRITE: lv_result. " Output: Hello ABAP

4. Concatenating into an Internal Table (APPEND LINES OF + CONCATENATE LINES OF)

DATA: lt_table TYPE TABLE OF string,
lv_result TYPE string.
APPEND 'Hello' TO lt_table.
APPEND 'ABAP' TO lt_table.
CONCATENATE LINES OF lt_table INTO lv_result SEPARATED BY space.
WRITE: lv_result. " Output: Hello ABAP

Each method has its own use case. If you’re on a modern ABAP version, the && operator is the simplest and cleanest way! 🚀