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

split string into internal table.

Former Member
0 Likes
21,878

hi all,

i want to split a string into an internal table.

let suppose i have a string 1,2,3,4 i want 1 2 3 4 to be the column of itable .and string is not specified.

plz help.

thanks.

Moderator message: frequent topic, please search for previous discussions before posting.

Message was edited by: Thomas Zloch

hi all,

i want to split a string into an internal table.

let suppose i have a string 1,2,3,4 i want 1 2 3 4 to be the column of itable .and string is not specified.

plz help.

thanks.

Moderator message: frequent topic, please search for previous discussions before posting.

Message was edited by: Thomas Zloch

5 REPLIES 5
Read only

Venkat_Sesha
Product and Topic Expert
Product and Topic Expert
0 Likes
7,772

If you question regarding spliting data into ITAB.

Split String itself have an Addition Into Table. Please read F1 help on SPLIT.

SPLIT f AT g INTO TABLE itab

When I understand your question in another way.

If you want to split the string 1,2,3,4 as the Columns of the Internal Table like ITAB with four Columns. the you need to use it with Dynamic tables.

For simple thing we shouldnt make it complicate. In both the case SPLIT into Table ITAB is used and later you have columns in ITAB and you can make use of it.

hope this helps

Read only

former_member282968
Contributor
7,772

Hi Aashima,

Use:  SPLIT f AT g INTO TABLE itab.

Please check the code below:

DATA:lv_string TYPE string.

DATA :BEGIN OF ls_string,
           col1     TYPE char50,
          END     OF ls_string.

DATA:lt_string LIKE STANDARD TABLE OF ls_string.

lv_string = '1,2,3,4'.

SPLIT lv_string AT ',' INTO TABLE lt_string.

LOOP AT lt_string INTO ls_string.
  WRITE:/ ls_string-col1.
ENDLOOP.

With regards,

Read only

RaymondGiuseppi
Active Contributor
0 Likes
7,772

Just

- press F1 on split statement in your source code (will give the individual strings in rows of an internal table)

- if required perform some search at scn on dynamic table or use of field-symbols with assign component (converting rows to columns)

Regards,

Raymond

Read only

0 Likes
7,772

hi raymond,

the string is converted into rows of internal table, now i want those rows to be the header of the internal table.

thanks

Read only

0 Likes
7,772

Just create a dynamic internal table using either, use search tool or click on below links

- RTTC classes

- cl_alv_table_create=>create_dynamic_table from a field catalog

Regards,

Raymond