Skip to Content
author's profile photo Former Member
Former Member

Internal table

Hello everybody,

i have a problem!!

I think that i can not find the solution because i am so bad in developing code!

I need to create an internal table in a dynamic way.

Now i will explain my real problem !!

I developing a bsp page, i need to extract some HR data from r/3 via RFC i have a function "HR_READ_INFOTYPE" that returns me all the information in a char line without a structure (no problem), i extract from dd03l table the structure of the relative infotype (note: i can extract more data from different infotype) when i come back to the Web AS system i need to create at runtime the n internal table with the exact structure for each infotypes that i have extracted . So is tit possible to create dynamicly an internal table having the structure in another internal table?!?

Thanks a lot !!!!

massimo

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Best Answer
    Posted on Oct 16, 2003 at 11:40 AM

    Hi,

    you can construct a new internal table with a given line type with the following syntax:

    DATA dref TYPE REF TO data.

    CREATE DATA dref { {TYPE tabkind OF {type|(name)}}

    | {LIKE tabkind OF dobj} }

    [WITH key]

    [INITIAL SIZE n].

    The dynamic creation of new structures will be available with Release 6.40.

    Example for creating an internal table with a given structure:

    PARAMETERS: dbtab(10) TYPE c,

    rows TYPE i DEFAULT 100.

    DATA dref TYPE REF TO data.

    FIELD-SYMBOLS: .

    ELSE.

    EXIT.

    ENDIF.

    ENDDO.

    ULINE.

    ENDLOOP.

    CATCH cx_sy_create_data_error.

    WRITE 'Wrong Database!'.

    ENDTRY.

    Regards

    Horst

    Add comment
    10|10000 characters needed characters exceeded