‎2006 May 30 1:52 PM
Hi,
I have a string like below...
abcdef,12345,ghvbth,kjuytg
and i want it to appear like this
abcdef,
12345,
ghvbth,
kjuytg
Any syntax help to get this..
Regards
Praneeth
‎2006 May 30 1:56 PM
Hi praneeth,
1. Simple
2. we have to use SPLIT
3. just copy paste in new program.
4. it will output
abcdef
12345
ghvbth
kjuytg
5.
report abc.
*----
data : mystr(100) type c.
data : begin of itab occurs 0,
str(25) type c,
end of itab.
*----
mystr = 'abcdef,12345,ghvbth,kjuytg'.
split mystr at ',' into table itab.
*----
loop at itab.
write 😕 itab-str.
endloop.
6.*----
If u want the COMMA also,
then use like this (just copy paste)
7.
report abc.
*----
data : mystr(100) type c.
data : begin of itab occurs 0,
str(25) type c,
end of itab.
*----
mystr = 'abcdef,12345,ghvbth,kjuytg'.
replace all occurrences of ',' in mystr with ',@'.
split mystr at '@' into table itab.
*----
loop at itab.
write 😕 itab-str.
endloop.
regards,
amit m.
‎2006 May 30 1:55 PM
Hello,
Just split the string up at ',' into an internal table and then loop over the table and write each line.
Regards,
John.
‎2006 May 30 1:55 PM
try this..
data: w_str type string value 'abcdef,12345,ghvbth,kjuytg',
w_str1 type string,w_str2 type string,
w_Str3 type string,w_str4 type string.
split w_str at ',' into w_str1,w_str2,w_str3,w_str4.
write: / w_str1,w_str2,w_str3,w_str4.
regards,
Suresh Datti
‎2006 May 30 1:56 PM
Hi praneeth,
1. Simple
2. we have to use SPLIT
3. just copy paste in new program.
4. it will output
abcdef
12345
ghvbth
kjuytg
5.
report abc.
*----
data : mystr(100) type c.
data : begin of itab occurs 0,
str(25) type c,
end of itab.
*----
mystr = 'abcdef,12345,ghvbth,kjuytg'.
split mystr at ',' into table itab.
*----
loop at itab.
write 😕 itab-str.
endloop.
6.*----
If u want the COMMA also,
then use like this (just copy paste)
7.
report abc.
*----
data : mystr(100) type c.
data : begin of itab occurs 0,
str(25) type c,
end of itab.
*----
mystr = 'abcdef,12345,ghvbth,kjuytg'.
replace all occurrences of ',' in mystr with ',@'.
split mystr at '@' into table itab.
*----
loop at itab.
write 😕 itab-str.
endloop.
regards,
amit m.
‎2006 May 30 2:04 PM
Hi All,
Thanks for the reply..
Now i hav to assign this to a text element in a smartform where i want these to appear in multiple lines.
Any suggestions..
The text element is presently taking it in asingle line,i want to appear them in multiple lines.
Regards
Praneeth
‎2006 May 30 2:19 PM
Hi
in the text element insert program lines
and copy paste the above code
‎2006 May 30 1:57 PM
use offset to identify each character and whenever the character is ',' use "write:/"
‎2006 May 30 1:58 PM
Hi,
Take the string ina imnternal table.
Use Split command to split the string where ever comma occurs intop another internal table.
data: begin of it1 occurs 0,
str type string,
end of it1.
data: begin of it2 occurs 0,
str1 type string,
end of it2.
<b> SPLIT it1-str AT ',' INTO TABLE it2.</b>
this solves ur problem.
Cheers
Simha,.
<b>Reward If it is needful</b>
‎2006 May 30 1:58 PM
data : begin of itab occurs 0,
names(100),
end of itab.
split string at ',' into table itab.
loop at itab.
concatenate itab-name ',' into itab-name.
modify itab index sy-tabix.
endloop.
‎2006 May 30 2:18 PM
Hii
insert program lines in the page & write ur code in that .
goto the required window right click on it & then goto
create flow logic in that u hav program line click on it & insert ur if condition in that as per ur req.
or else if u are using any text element to display the sum then u can insert a condition
Regards
Naresh