abap concatenate

To concatenate strings in ABAP, you can use the CONCATENATE statement. The CONCATENATE statement allows you to combine multiple strings into a single string.

Here's the syntax for the CONCATENATE statement in ABAP:

CONCATENATE string1 string2 ... INTO target_string [SEPARATED BY separator].
  • string1, string2, etc.: These are the strings that you want to concatenate.
  • target_string: This is the variable where the concatenated string will be stored.
  • separator (optional): This is the character or string that will be inserted between the concatenated strings. If you don't specify a separator, the strings will be concatenated without any separator.

Here's an example of how to use the CONCATENATE statement:

DATA: lv_name TYPE string,
      lv_age TYPE i,
      lv_result TYPE string.

lv_name = 'John'.
lv_age = 30.

CONCATENATE 'My name is' lv_name 'and I am' lv_age 'years old.' INTO lv_result.

WRITE lv_result.

In this example, the CONCATENATE statement is used to concatenate the values of lv_name and lv_age into the lv_result variable. The resulting string will be "My name is John and I am 30 years old." This string is then displayed using the WRITE statement.

That's how you can concatenate strings in ABAP using the CONCATENATE statement.