2007 Jul 11 8:41 AM
Hi Friends,
Suppose if i have 2 strings which is concatenate into another variable.
data : a(10) type c value 'INDIA',
b(20) type c value 'HELLO',
c(40) type c.
concatenate a b into c seperated by space.
write c.
result will be = INDIA HELLO.
result will have only single space, if i need to increase the space what should i do.
good answer can be awarded.
Good luck all.
2007 Jul 11 8:44 AM
concatenate a space space b into c seperated by space.
output - INDIA HELLO i.e 3 blank spaces.
Reward points if helpful
2007 Jul 11 8:46 AM
data : a(10) type c value 'INDIA',
b(20) type c value 'HELLO',
c(40) type c,
sp(4) value ' '.
concatenate a b into c seperated by sp.
write c.
regards
shiba dutta
2007 Jul 11 8:55 AM
hi,
gud..
SEPARATED not seperated..kindly do the changes
thnaks
jaideep
2007 Jul 11 8:46 AM
Hello,
Do like this.
data : a(10) type c value 'INDIA',
b(20) type c value 'HELLO',
c(40) type c,
blank(6) value ' '." CHeck here
concatenate a b into c seperated by blank." CHeck here
write c.
Vasanth
2007 Jul 11 8:47 AM
Check if it works
concatenate a ' ' b into c seperated by space.
Regards,
Atish
2007 Jul 11 8:47 AM
The CONCATENATE statement combines two or more separate strings into one.
CONCATENATE c1 ... cn INTO c [SEPARATED BY s].
This statement concatenates the character fields c1 to cn and assigns the result to c. The system ignores spaces at the end of the individual source strings.
The addition SEPARATED BY s allows you to specify a character field s which is placed in its defined length between the individual fields.
If the result fits into c, sy-subrc is set to 0. However, if the result has to be truncated, sy-subrc is set to 4.
DATA: c1(10) TYPE c VALUE 'Sum',
c2(3) TYPE c VALUE 'mer',
c3(5) TYPE c VALUE 'holi ',
c4(10) TYPE c VALUE 'day',
c1 (30) TYPE c,
sep(3) TYPE c VALUE ' - '.
CONCATENATE c1 c2 c3 c4 INTO c5.
WRITE c5.
CONCATENATE c1 c2 c3 c4 INTO c5 SEPARATED BY sep.
WRITE / c5.
The output looks like this:
Summerholiday
Sum - mer - holi - day
In c1 to c5, the trailing blanks are ignored. The separator sep retains them.
Rewards point if helpful.....
Thanks.
Abhay.
2007 Jul 11 8:49 AM
data : a(10) type c value 'INDIA',
b(20) type c value 'HELLO',
c(40),
sep(4) value ' '.
concatenate a b into c sep<b>a</b>rated by sep.
write c.
<b>first declare the seperator and then check the spelling of separated..</b>
2007 Jul 11 8:50 AM
hi
try this.
data : a(10) type c value 'INDIA ',
b(20) type c value ' HELLO',
c(40) type c.
concatenate a b into c separated by space.
write c.
reward if useful.
2007 Jul 11 9:12 AM
<b>Corrected !!</b>
data : a type string,
b type string,
c type string.
a = 'INDIA'.
b = 'HELLO'.
concatenate a ' ' b into c respecting blanks.
write c.
Reward if useful..
2007 Jul 11 10:28 AM
hi purna
Try out the following which will really help out....
<b>data : a(10) type c value 'INDIA',
b(20) type c value 'HELLO',
c(40) type c,
sp(4) value ' '.// make sure that you count the length according to the spaces
concatenate a b into c seperated by sp .
write c.</b>
reward if useful....