Application Development and Automation 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: 
Read only

Splitting string

Former Member
0 Likes
527

Hi experts,

I want split the string.

String is like abcd | xyz | nhyu | adfsfs | fslfs | fjsflsfl |.

how can i split without knowing the number of substring.

is there any function module ..?

Pls help me.

Regards,

Murugan Arumugam.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
505

Hi,

DATA: lt_string_data TYPE TABLE OF string,

wa_string TYPE string,

Use SPLIT <input> AT ' ' INTO TABLE lt_string_data.

LOOP AT lt_string_data INTO wa_string.

ls_output = wa_string.

APPEND ls_output TO <outputstiring>.

ENDLOOP.

4 REPLIES 4
Read only

Former Member
0 Likes
505

Hi,

if you dont know the number of occurrences of the delimeter you can use the following code.

data: source type string ,

target type standard table of string .

source = 'This is for test.' .

split source at ' ' into table target .

regards,

Omkar.

Read only

Former Member
0 Likes
506

Hi,

DATA: lt_string_data TYPE TABLE OF string,

wa_string TYPE string,

Use SPLIT <input> AT ' ' INTO TABLE lt_string_data.

LOOP AT lt_string_data INTO wa_string.

ls_output = wa_string.

APPEND ls_output TO <outputstiring>.

ENDLOOP.

Read only

Former Member
0 Likes
505

data: begin of wa,

ch(30) type c,

end of wa.

data: itab like table of wa.

data: text type string value 'abcd | xyz | nhyu | adfsfs | fslfs | fjsflsfl |'.

SPLIT text AT '|' INTO TABLE itab.

loop at itab into wa.

write:/ wa-ch.

endloop.

Read only

Former Member
0 Likes
505

Thanks to all