‎2006 Aug 10 7:56 AM
Hi.
i have string in import parameter like..
STRING = 'A,B,C,D,...'
now i want it to convert like..
STRING1 = 'A','B','C','D',....
how can i do it.
‎2006 Aug 10 8:04 AM
Hi purushottam,
A,B,C,D,E
'A','B','C','D','E'
1. just copy paste
2.
report abc.
data : abc(200) type c.
data : def(200) type c.
abc = 'A,B,C,D,E'.
def = abc.
replace all occurrences of ',' in def with ''',''' .
concatenate '''' def into def.
concatenate def '''' into def.
write : / abc.
write : / def.
*STRING1 = 'A','B','C','D',....
regards,
amit m.
‎2006 Aug 10 7:59 AM
Hi,
You can use split at , into various fields
and then
use concatenate ' var1 ' into new_var.
Rgds,
HR
‎2006 Aug 10 8:04 AM
Hi ,
there is one simpler way . Try to use REPLACE .here is an example
DATA: myText type string.
myText = 'abcabcabcabcabc'.
REPLACE ALL OCCURRENCES OF 'abc' IN myText WITH 'XYZ'.
returns: myText = 'XYZXYZXYZXYZXYZ', sy-subrc = 0
Hope this helps .
Regards ,
Shounak M.
‎2006 Aug 10 8:04 AM
Hi purushottam,
A,B,C,D,E
'A','B','C','D','E'
1. just copy paste
2.
report abc.
data : abc(200) type c.
data : def(200) type c.
abc = 'A,B,C,D,E'.
def = abc.
replace all occurrences of ',' in def with ''',''' .
concatenate '''' def into def.
concatenate def '''' into def.
write : / abc.
write : / def.
*STRING1 = 'A','B','C','D',....
regards,
amit m.
‎2006 Aug 10 8:12 AM
HI,
check this code.
<b>REPORT zwa_test1 line-size 132 line-count 60.
data: string(20) value 'A,B,C,D'.
data: string1(30).
data: len type i.
data: index type i.
data: ind type i.
len = strlen( string ).
index = 1.
ind = 0.
string1(1) = ''''.
DO LEN times.
string1+index(1) = string+ind(1).
index = index + 1.
string1+index(1) = ''''.
index = index + 1.
ind = ind + 1.
ENDDO.
write:/ string1.</b>Regards,
HRA