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: 

Convert a string to a table.

Former Member
0 Kudos

We are in the process of upgrading to ECC 6.0 and are correcting unicode errors.

I am looking for a way to convert a string into a flat structure containing various data types.

I have looked at func modules but have not come across one that fits.

Our internal table is defined as a standard table of type string.

We loop thru this table and now want to assign each line of the table into a structure defined as follows:

Begin of _ttype

m like mseg,

other fields...

end of ttype

i_mseg like ttype occurs 0 with header line

any help is appreciated

J

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello

Assuming that the string contains the data with the right lengths and offsets then you can use the methods of class <b>CL_ABAP_CONTAINER_UTILITIES</b>:

FILL_CONTAINER_C	Fill Container of Type C or STRING with Content
READ_CONTAINER_C	Read Container of Type C or STRING

Regards

Uwe

4 REPLIES 4

Former Member
0 Kudos

hi

we can do it by field symbols easily

take one generic field symbol.

copy source data to field symbol then from field symbol to destination.

Former Member
0 Kudos

is there any field seperator in the string .. if yes just us split command..

Thank

Mahesh

uwe_schieferstein
Active Contributor
0 Kudos

Hello

Assuming that the string contains the data with the right lengths and offsets then you can use the methods of class <b>CL_ABAP_CONTAINER_UTILITIES</b>:

FILL_CONTAINER_C	Fill Container of Type C or STRING with Content
READ_CONTAINER_C	Read Container of Type C or STRING

Regards

Uwe

Former Member
0 Kudos

Hello,

if you have a string you can do it with the split command.

Ie:

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.

Bye

Gabriel