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

Conactenating with diffrent spaces

Former Member
0 Likes
828

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
Read only

Former Member
0 Likes
791

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

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
Read only

Former Member
0 Likes
791

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.

Read only

ThomasZloch
Active Contributor
0 Likes
791

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

Then TRANSLATE the result USING '§ '.

Thomas

Read only

Former Member
0 Likes
792

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

Read only

Former Member
0 Likes
791

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.

Read only

Former Member
0 Likes
791

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