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: 

SPLIT function

Former Member
0 Kudos

Hello, i need separate a string, example, 1,95,02,55, by ',' into a internal table. if i use "SPLIT p_frase AT ',' INTO TABLE t_frase" but it create a registry for string. Is it posible in only one registry?

Excuse for my bad english.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

thats ok, but my internal table has 26 fields and i want to know if there are one fast way ;-).

Thanks.

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Not sure what you mean by registry. By using the statement that you have provided, it will break the string into the specific parts into each line of the internal table. So if there are 4 fields in your string delimited by ',' you will have 4 records in your internal table. You can also break it out into individual fields.

split field_string at ',' into field1 field2 field3 field4.

Regards,

Rich Heilman

Former Member
0 Kudos

thats ok, but my internal table has 26 fields and i want to know if there are one fast way ;-).

Thanks.

0 Kudos

I am not sure, but try this.

Have a work area of the table

SPLIT STRING_vAR AT ',' INTO WA_TABLE.

I am not sure but this might get the values into individual tables.

Regards,

Ravi

Note : Please mark the helpful answers

0 Kudos

it´s no good.

0 Kudos

You may want to try something like this.



report  zrich_0001.


data: str type string.
data: istr type table of str with header line.

data: begin of xstructure,
      field1(10) type c,
      field2(10) type c,
      field3(10) type c,
      field4(10) type c,
      end of xstructure.

field-symbols: <fs>.

str = '12,345,678,901'.

split str at ',' into table istr.

do.

  read table istr index sy-index.
  if sy-subrc <> 0.
    exit.
  endif.

  assign component sy-index of structure xstructure to <fs>.

  <fs> = istr.


enddo.

write:/ xstructure-field1,
        xstructure-field2,
        xstructure-field3,
        xstructure-field4.

Regards,

Rich Heilman

0 Kudos

ok thank you very much.