Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Internal table declaration during runtime

Hi All,

I am facing very strange problem in my program.

First I have to download the structure of marketing program.For that I have declear one internal table say itab in which there are three fields.

Now I have to upload data in XD03,in which number of fields will be equal to number of entries in ITAB plus one.

and number of entries in doenloading structure (ITAB) may be varry.So How can I define internal table for uploading.

ITAB

xyz 1 y

abc 2 n

and uploading structure like

111 y n

222 y y

333 n

Regards,

Amar

Former Member
Former Member replied

Hi,

you can try this:

DATA: new_table TYPE REF TO data.

FIELD-SYMBOLS: <l_table> TYPE ANY TABLE.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

  • I_INTERNAL_TABNAME =

i_structure_name = itab

CHANGING

ct_fieldcat = it_fcat[].

LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.

MOVE-CORRESPONDING is_fcat TO is_fieldcat.

is_fieldcat-fieldname = is_fcat-fieldname.

is_fieldcat-ref_field = is_fcat-fieldname.

is_fieldcat-ref_table = is_fcat-ref_tabname.

APPEND is_fieldcat TO it_fieldcat.

ENDLOOP.

*append another field same in the loop.

*then create the internal table

  • Create a new Table

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_fieldcat

IMPORTING

ep_table = new_table.

ASSIGN new_table->* TO <l_table>.

Regards,

Leo

Edited by: Ierardi Leo on Apr 7, 2009 12:26 PM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question