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 space with other variable

Former Member
0 Likes
834

Hi

I have a requirement, where I need to include space.

Eg, there is a field called 'name',whose content is ' 0123456abcd'.

In the output I have to get '0123 456 abcd'

I use below code

name(15) type c.

concatenate name+0(3)

space

name+4(3)

space

name+4(7)

into output.

But I am not getting required output.

I am geting output as 0123456abccd.

Please tell me how to get it

thanks

Rama.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
816

Add the keyword, RESPECTING BLANKS at the end of the concatenate statement.

Regards,

Lakshmi.

7 REPLIES 7
Read only

Former Member
0 Likes
817

Add the keyword, RESPECTING BLANKS at the end of the concatenate statement.

Regards,

Lakshmi.

Read only

GauthamV
Active Contributor
0 Likes
816

hi,

try like this.

concatenate name+0(3)

name+4(3)

name+4(7)

into output

seperated by space.

Read only

Former Member
0 Likes
816

Hi,

Try this,

concatenate name+0(3)

name+4(3)

name+4(7)

into output separated by space.

reward pts if usefull.

Rerads,

Dhan

Read only

Former Member
0 Likes
816

post deleted

Edited by: Arun R on Jun 20, 2008 5:37 PM

Read only

Former Member
0 Likes
816

data: test(20) value '0123456abcd' .

data:filler TYPE c VALUE cl_abap_char_utilities=>HORIZONTAL_TAB.

data: output(20) .

concatenate test+0(3)

filler

test+4(3)

filler

test+4(7)

into output.

write:/ output .

Read only

Former Member
0 Likes
816

Hi

go through this code.you wil get the correct output.

data:name(15) type c,

output(15) type c.

name = '0123456abcd'.

concatenate name+0(4)

name+4(3)

name+7(4)

into output

separated by space.

write:/ output.

Read only

Former Member
0 Likes
816

hi Rama Devi,

your question is interesting one.

The mistake what you did is very simple one.

Just look below report.

REPORT YTESTPGM.

data:

name3(4) TYPE c VALUE 'abcd',

name1(4) type c value '0123',

name2(3) TYPE c VALUE '456',

output(14) type c.

concatenate name1 name2 name3 into output separated by space.

WRITE output.

The output is like this

0123 456 abcd.

Just try like this surely it will give the best to you.

  • Reward me if its succeed. *