Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SPLIT function

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.

Tags:
Former Member
replied

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 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question