‎2005 Dec 08 12:21 PM
Hi All,
I want to concatenate two string as such that all the white spaces will be there in solution.
e.g. -
str = ' asd '.
str1 = ' ddd '.
output string should be -
' asd ddd '.
How can i do that?
Points will be rewarded.
Regards
Amit
‎2005 Dec 08 12:24 PM
Hi just use simple concatenate statement as
concatenate str str1 into str3 separated by space.
Hope this helps.
‎2005 Dec 08 12:25 PM
Hi Imtiaz,
I tried that but its removing the white spaces.
Regards
Amit
‎2005 Dec 08 12:33 PM
Try this it is working in my system.
data : str(10),str1(10),str3(10).
str = ' asd '.
str1 = ' ddd '.
concatenate str str1 into str3 separated by space.
write str3.
‎2005 Dec 08 12:25 PM
Hi,
You need to concatenate with the space in between,
like for ex,
concatenate 'str' ' ' 'str1' into str2.
Hope this helps,
Rgds,
‎2005 Dec 08 12:25 PM
Hi Amit,
Use 'Separated by SPACE' while concatenating string1, string2 to String3.
Regards,
Sudhakar.
‎2005 Dec 08 12:29 PM
Hi All,
I think you didnt got my requirement.
I dont want to put space in between instead i want to keep all the white spaces in tact if present in data.
like material description is of 40 char and i have a data of 22 char and i concatenate it with say, ernam field data then all the unfilled white spaces whould be there in the answer field.
Amit
‎2005 Dec 08 12:34 PM
Hi Amit,
You move to taking positions
like ex:
data : str(60).
str+0(40) = maktx.
str+41(20) = ernam.
Thanks,
siri.
‎2005 Dec 08 12:28 PM
Hi,
Try this.
Cancatenate str str1 into str2
separated by space.
Thanks,
Siri.
‎2005 Dec 08 12:28 PM
Hi Amit,
Just try like this,
DATA: C1(10) VALUE 'Sum',
C2(3) VALUE 'mer',
C3(5) VALUE 'holi ',
C4(10) VALUE 'day',
C5(30),
SEP(3) VALUE ''.
CONCATENATE C1 C2 C3 C4 INTO C5 SEPARATED BY SEP.
WRITE / C5.
Hope it helps u.
Thanks&Regards,
Ruthra.
‎2005 Dec 08 12:30 PM
‎2005 Dec 08 12:30 PM
Hi Amit,
Concatenate str1 str2 into str3 separated by space : should work. If not try this one.
data: str1(10),
str2(10),
str3(21).
str3+0(10) = str1.
str3+12(10) = str2.
Regards,
Sudhakar.
‎2005 Dec 08 12:34 PM
Hi Amit,
When we use CONCATENATE,the trailing blanks are ignored. <b>The addition SEPARATED BY <s> retains them.</b>
Hope u understood.
Thanks&Regards.
Ruthra.R
‎2005 Dec 08 12:35 PM
Hi Amit.
DAta: final_string(63)
final_string+0(40) = p_mat_desc.
final_string+41(12) = p_ernam.
You will have the required data in final_stirng.
Reward points if it helps you.
Regards,
Sudhakar.
‎2005 Dec 08 12:54 PM
Hi Amit,
1. If u see the documentation of concatenate,
it clearly specified the problem
related to white spaces.
2. Moreover it also tells something about STRING.
3. Use this code (Just copy paste)
There are different type of variables,
and notice how they behave differently.
REPORT zauth .
DATA : matnr TYPE STRING.
DATA : pernr LIKE pa0001-pernr.
DATA : ebeln LIKE ekko-ebeln.
DATA : ernam LIKE ekko-ernam.
DATA : ab(100) TYPE c.
DATA : cd(100) TYPE c.
DATA : ef TYPE STRING.
matnr = ' 001 '.
pernr = '776'.
EBELN = '25 '.
ernam = 'SAPUSER'.
CONCATENATE matnr ernam INTO ab .
CONCATENATE pernr ernam INTO cd .
CONCATENATE ebeln ernam INTO ef .
WRITE 😕 ab.
WRITE 😕 cd.
WRITE 😕 ef.
I hope it helps.
Regards,
Amit M.
‎2005 Dec 08 1:14 PM
Hi All,
Thanks for the suggetions .Problem is solved and points are awarded as promised.
Amit