Concatenate in ABAP

by | Jun 3, 2018 | ABAP Programs

Home » SAP » ABAP » ABAP Programs » Concatenate in ABAP

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.

Introduction

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.

Concatenate in ABAP

Concatenate in ABAP Image Illustration

ABAP Program

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'

Explanation

This is a very easy program and self explanatory. Still given points explain the same:

  1. 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.
  2. There after, we have defined a variable which will store the concatenated value.
  3. Now, we have done concatenation.
  4. Later, we have printed the concatenated output.

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Author