Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

concatenate

Former Member
0 Likes
1,159

give me a small example to how concanenate works

give me a small example to how concanenate works

10 REPLIES 10
Read only

Former Member
0 Likes
1,141

Hi,

check this out

REPORT ZSUDHA_SCREEN MESSAGE-ID ZZ.

data : v_s type string value 'SAP',

v_s1 type string value 'ABAP',

v_s2 type string.

concatenate v_s v_s1 into v_s2.

write:/ v_s2.

Read only

Former Member
0 Likes
1,141

CONCATENATE var1 var2 ... INTO v_result

[IN { BYTE | CHARACTER } MODE]

[SEPARATED BY sep].

It concatenates given variables into result ..

DATA: t1(10) TYPE c VALUE 'We',

t2(10) TYPE c VALUE 'have',

t3(10) TYPE c VALUE 'all',

t4(10) TYPE c VALUE 'the',

t5(10) TYPE c VALUE 'time',

t6(10) TYPE c VALUE 'in',

t7(10) TYPE c VALUE 'the',

t8(10) TYPE c VALUE 'world',

result TYPE string.

CONCATENATE t1 t2 t3 t4 t5 t6 t7 t8

INTO result SEPARATED BY space.

now result has ... "We have all the time in the world"

Read only

Former Member
0 Likes
1,141

concatenate 'Welcome' 'to' 'SDN ' into a separated by space.

write 😕 a.

Thanks

Ravi

Read only

Former Member
0 Likes
1,141

data: v_1 type c length 10 value 'PRAS'.

data: v_2 type c length 10 value 'HANT'.

data: v_3 type c length 20.

concatenate v_1 v_2 into v_3.

so v_3 will have PRASHANT.

Hope dis helps..

Reward if it does

Read only

Former Member
0 Likes
1,141

Hi,

Suppose i have ABAP in one variable v1 and SAP in second variable v2.

we will transfer this into another variable by using Concatenate as:

CONCATENATE v2 v1 into v3 separated by space.

We will get the output as SAP ABAP.

Regards

Kannaiah

Read only

Former Member
0 Likes
1,141

Hi,

Examples

DATA: ONE(10) VALUE 'John',

TWO(3) VALUE 'F.',

THREE(10) VALUE 'Kennedy',

NAME(20).

CONCATENATE ONE TWO THREE INTO NAME SEPARATED BY SPACE.

reward if useful.

Read only

Former Member
0 Likes
1,141

Hi,

DATA: ONE(10) VALUE ' John ',

TWO(3) VALUE 'F.',

THREE(10) VALUE ' Kennedy',

NAME(20).

CONCATENATE ONE TWO THREE INTO NAME SEPARATED BY SPACE.

Try this,

KC

Read only

Former Member
0 Likes
1,141

Let's have a simple example:

DATA: string1(30) TYPE c VALUE 'I am Alex and i am',

string2(30) TYPE c VALUE '23 years old',

string_concatenation(60) TYPE c.

CONCATENATE string1 string2 INTO string_concatenation SEPARATED by SPACE

.

WRITE: / string_concatenation.

The result will be:

<b>I am Alex and i am 23 years old</b>

where string1 is your first string, string2 the second string and the addition SEPARATED by SPACE.

If you enter the debug mode (and i advice you to do this) you can watch the sy-subrc and its return code.

The return code is set as follows:

SY-SUBRC = 0:

The result fitted into <b>string_concatenation.</b>

SY-SUBRC = 4:

The result was too long for <b>string_concatenation</b> and could only be transferred in the defined length of g.

You can try to giving the <b>string_concatenation</b> the value 22 and watch the sy-subrc.

Reward is useful,

Thanks.<u></u>

Read only

Former Member
0 Likes
1,141

Hi,

Chk this code.

DATA : A(10) VALUE 'APPLE',

B(10) VALUE 'ORANGE',

C(10) VALUE 'BANANA',

D(40).

CONCATENATE A B C INTO D.

WRITE:/' Before Concatenate', /.

WRITE:/ D,/.

CONCATENATE A B C INTO D SEPARATED BY ' / '.

WRITE:/' After Concatenate',/.

WRITE:/ D.

Reward for helpful.

Regards,

Harini.S

Read only

Former Member
0 Likes
1,141

hi guys

thank u so much u guys have given a very clear picture

all the best