cancel
Showing results for 
Search instead for 
Did you mean: 

Internal table

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

Thanx a lot Horst,

very kind.

Answers (0)