Preface – This post is part of the ABAP Programs series.
Concatenate in ABAP is used to join two different strings together. It can be used to join any two string, number, special character or all together. In this article we will learn about the keyword CONCATENATE and its implementation in an example program.
Table of Contents
Sometime we need to join two string, special character or numeric value in our code. In this case we can use ABAP keyword CONCATENATE and achieve our goal.
Following program has implemented the same:
PARAMETERS: lv_data1 type string, "VALUE 'BARRY' lv_data2 type string, "VALUE 'ALLEN' Data: lv_data type string. CONCATENATE lv_data1 lv_data2 into lv_data. WRITE: lv_data. "Output is 'BARRY ALLEN'
This is a very easy program and self explanatory. Still given points explain the same:
- Initially, we have defined two parameters to take two different inputs: lv_data1 and lv_data2. We have given initial value to them too in comment.
- There after, we have defined a variable which will store the concatenated value.
- Now, we have done concatenation.
- Later, we have printed the concatenated output.