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

adding space between two strings

Former Member
0 Likes
3,356

friends,

i want to add a space between two string like for example

i have str1 = "SSC" and str2= "00095" and now i want the result to be like "SSC 00095".

following statements are giving me the required results,

try1 : concatenate str1 ' ' str2 into str3

try2 : concatenate str1 space str2 into str3

try3 : concatenate 'SSC ' str2 into str3 etc..

after getting this result basically i have to read a internal table as below,

read table gt_hierstruct with key nodename = str3

hieid = lv_hierid

and i also tried like "SSC*000095" but in read statement instead of key nodename = str3 i need something like key nodename LIKE str3...

could some body help me and this code will be diployed in SAP BW update rules.

Message was edited by: Shashi

1 ACCEPTED SOLUTION
Read only

Vinod_Chandran
Active Contributor
0 Likes
1,206

Use the addition SEPARATED BY SPACE.

6 REPLIES 6
Read only

Vinod_Chandran
Active Contributor
0 Likes
1,207

Use the addition SEPARATED BY SPACE.

Read only

0 Likes
1,206

could u please give me the syntax, does this addition is for concetinate ?

Read only

0 Likes
1,206

concatenate str1 str2 into str3 separated by space.

Read only

0 Likes
1,206

CONCATENATE <FLD1> <FLD2> INTO <FLD3> SEPARATED BY SPACE.

You can check the help of CONCATENATE. Press F1 on the text CONCATENATE.

Read only

0 Likes
1,206

Thanks a tone guys..

Read only

Former Member
0 Likes
1,206

Hi shashi,

Try this code

data :str1(5) type c,

str2 type string,

str3(15) type c.

data : begin of itab occurs 0,

name(5) type c,

empno type i,

empid(15) type c,

end of itab.

itab-name = 'vijay'.

itab-empno = '009'.

itab-empid = 'vijay 009'.

append itab.

str1 = 'vijay'.

str2 = '009'.

concatenate str1 str2 into str3 separated by space.

loop at itab.

read table itab with key empid = str3.

if sy-subrc = 0.

write 😕 itab-empid.

endif.

endloop.

Regards,

vijay.