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: 

at new line command

Former Member
0 Kudos
143

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
108

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.

9 REPLIES 9

Former Member
0 Kudos
108

Hello,

Just split the string up at ',' into an internal table and then loop over the table and write each line.

Regards,

John.

suresh_datti
Active Contributor
0 Kudos
108

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

Former Member
0 Kudos
109

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.

0 Kudos
108

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

0 Kudos
108

Hi

in the text element insert program lines

and copy paste the above code

rahulkavuri
Active Contributor
0 Kudos
108

use offset to identify each character and whenever the character is ',' use "write:/"

Simha_
Advisor
Advisor
0 Kudos
108

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>

Former Member
0 Kudos
108
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.

Former Member
0 Kudos
108

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