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

Text Splitting

Former Member
0 Likes
781

hi i am getting some text like " abc defg ijkl njhuk "

in this text i have to split the words like

"abc" "defg" "ijkl " "njhuk" with space as seperator

and i have to store these in an internal table

is there possibilit pls any one can help me regarding this

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
674


DATA: str1 TYPE string, 
      str2 TYPE string, 
      str3 TYPE string, 
      itab TYPE TABLE OF string, 
      text TYPE string. 

text = `What a drag it is getting old`. 

SPLIT text AT space INTO: str1 str2 str3, 
                          TABLE itab

reward if useful.

4 REPLIES 4
Read only

Former Member
0 Likes
674

loop at itab into wa.

splite here.

move to work arae.

append itab.

endloop.

else.

declear 5 variable move 5 values to that variable.

splite text move into variable.

loop at itab into wa.

move vaiable to work arae.

append itab.

endloop.

Read only

Former Member
0 Likes
674
loop at itab into watab.

contatenate watab+0(3) watab+3(3) watab+6(3) watab+9(3) into l_length separated by ' ' .

append l_length to itemp.

endloop.
Read only

Former Member
0 Likes
675


DATA: str1 TYPE string, 
      str2 TYPE string, 
      str3 TYPE string, 
      itab TYPE TABLE OF string, 
      text TYPE string. 

text = `What a drag it is getting old`. 

SPLIT text AT space INTO: str1 str2 str3, 
                          TABLE itab

reward if useful.

Read only

Former Member
0 Likes
674

Try:


data: begin of itab occurs 0,
        f1(10),
      end of itab,
      text(20) value 'abc defg ijkl njhuk'.

SPLIT text at SPACE INTO itab.

I'm not in R/3 right now so it's not tested, but it shows what I would do.

Rob