Application Development 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: 

Conactenating with diffrent spaces

Former Member
0 Kudos

I have a req. of conactenating vaiables with diffrent space values.

E.g. Var1, Var2 ,Var3............Var n need to be seperated by diffrent space values.

Like Var1 Var2 Var3.. .. Varn

or Var1 Var2 Var3.. ... Varn

or Var1 Var2 Var3.. ... Varn etc.

The spaces are not unique but having diffrent lengths.

The Concatenate option with diffrent spaces doesn't work. I have checked it.

Any Ideas.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

data: lstr type string,

c_5(5) value space,

c_10(10) value space.

CONCATENATE 'This' c_5 'Will' into lstr RESPECTING BLANKS.

CONCATENATE lstr c_5 'Work' c_10 '- Try.' into lstr RESPECTING BLANKS.

write:/ lstr.

Regards

Raghu

5 REPLIES 5

Former Member
0 Kudos

Hi,

Try with the below options.

1. Include the spaces in the symbol ~. i.e. ~ ~. Now I have included two spaces in the tild symbol.

2. Declare the variables of those many characters with default space.

Regards,

Santhosh.

ThomasZloch
Active Contributor
0 Kudos

concatenate the values separated by characters that do not appear otherwise in the data, e.g. '§'.

Then TRANSLATE the result USING '§ '.

Thomas

Former Member
0 Kudos

data: lstr type string,

c_5(5) value space,

c_10(10) value space.

CONCATENATE 'This' c_5 'Will' into lstr RESPECTING BLANKS.

CONCATENATE lstr c_5 'Work' c_10 '- Try.' into lstr RESPECTING BLANKS.

write:/ lstr.

Regards

Raghu

Former Member
0 Kudos

In that case, check this example, here you can use spaces length dynamically..


DATA : l_space(255) TYPE c VALUE space.
DATA : varn TYPE i.
DATA : var3(200) TYPE c.

varn = '6'.  "Any  dynamic value

CONCATENATE 'VAR1' 'VAR2' 'VAR3' INTO var3
SEPARATED BY l_space+0(varn).

WRITE var3.

Former Member
0 Kudos

Hi,

Check the below code.

data: v_space1(1),

v_space2(2),

v_space3(3).

data: v_text1(10),

v_text2(10),

v_text3(10).

concatenate 'Hello' v_space1 '1' into v_text1

respecting blanks.

concatenate 'Hello' v_space2 '2' into v_text2

respecting blanks.

concatenate 'Hello' v_space3 '3' into v_text3

respecting blanks.

write:/ v_text1.

write:/ v_text2.

write:/ v_text3.

Regards,

Kumar Bandanadham