Skip to Content
avatar image
Former Member

Convert a string to a table.

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 17, 2007 at 02:54 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 02:33 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 02:44 PM

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

    Thank

    Mahesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 02:57 PM

    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

    Add comment
    10|10000 characters needed characters exceeded