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: 

adding space between two strings

Former Member
0 Kudos

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

Vinod_Chandran
Active Contributor
0 Kudos

Use the addition SEPARATED BY SPACE.

6 REPLIES 6

Vinod_Chandran
Active Contributor
0 Kudos

Use the addition SEPARATED BY SPACE.

0 Kudos

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

0 Kudos

concatenate str1 str2 into str3 separated by space.

0 Kudos

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

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

0 Kudos

Thanks a tone guys..

Former Member
0 Kudos

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.