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 at delimiter into table.

former_member202771
Contributor
0 Likes
4,161

Hi Experts,

I have a requirement wherein i need to split aaaa#bbbbbbbbbbbb#ccc#dddddddddddddddddddddd#e# into internal table as below:

Header 1Header 2
1aaaa
2bbbbbbbbbbbb
3ccc
4dddddddddddddddddddddd
5e

how can this be done.

Thanks & Regards,

Anil

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,580

Hi Anil,

Declare one internal table with field string data type.

data : Begin of ty,

    var type string,

      end of ty.

data it type table of ty.

Then use below syntax,

split <string> at '#' into table it.

Hopes it helps you.

Thanks,

Ashok.

10 REPLIES 10
Read only

VijayCR
Active Contributor
0 Likes
3,580

Use SPLIT at # command,

thanks,

VJ.

Read only

0 Likes
3,580

Hi,

split at into variables?

Number of # is not a constant here. split into variables and appending to table will not work here.

thanks,

Anil

Read only

rosenberg_eitan
Active Contributor
0 Likes
3,580
Read only

Former Member
0 Likes
3,581

Hi Anil,

Declare one internal table with field string data type.

data : Begin of ty,

    var type string,

      end of ty.

data it type table of ty.

Then use below syntax,

split <string> at '#' into table it.

Hopes it helps you.

Thanks,

Ashok.

Read only

0 Likes
3,580

Hi Ashok,

split <string> at '#' into table it.  -Doesn't work


split <string> at SPACE into table it. - Works


But same statement with '#' is not working.


Feeling strange.


Thanks,

Anil

Read only

0 Likes
3,580

Hi,

It might be a tab .

Try with cl_abap_char_utilities=>horizontal_tab

regards.

Read only

0 Likes
3,580

Hi Eitan,

How do we split on wrt to tab.

# here is a tab, formed when data uploaded from an excel.

Thanks,

Anil

Read only

0 Likes
3,580

SPLIT text AT cl_abap_char_utilities=>horizontal_tab INTO....

Read only

0 Likes
3,580

SPLIT text AT cl_abap_char_utilities=>NEWLINE INTO.... worked beautifully.


Thank you,

Anil

Read only

0 Likes
3,580

You need to look at debug at the hex value.