Application Development and Automation 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: 
Read only

How to convert dynamic structure internal table into normal internal table?

Former Member
0 Likes
1,392

Hi,

I created a dynamic internal table as below

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = i_fieldcat

IMPORTING

ep_table = i_dyntab

EXCEPTIONS

generate_subpool_dir_full = 1

OTHERS = 2.

ASSIGN i_dyntab->* TO <f_dyntable>.

Is there a provision to create a normal internal table of the same structure as <f_dyntable> using it?

Hi,

I created a dynamic internal table as below

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = i_fieldcat

IMPORTING

ep_table = i_dyntab

EXCEPTIONS

generate_subpool_dir_full = 1

OTHERS = 2.

ASSIGN i_dyntab->* TO <f_dyntable>.

Is there a provision to create a normal internal table of the same structure as <f_dyntable> using it?

1 REPLY 1
Read only

Former Member
0 Likes
559

Charan,

What do you want to achieve which can't be done with table <f_dyntable> now, I believe this can do almost all operations of a normal itab now.


data: i_dyntab type REF TO data,
      i_dunstr type ref to data.

FIELD-SYMBOLS: <f_dyntable> type any table,
               <f_str> type any,
               <ls_field> type any.

CALL METHOD cl_alv_table_create=>create_dynamic_table
 ............................

ASSIGN i_dyntab->* TO <f_dyntable>. 

 CREATE DATA i_dunstr like line of <f_dyntable>.
 assign i_dunstr->* to <f_str>.

do 5 times.

ASSIGN COMPONENT 1 of STRUCTURE <f_str> to <ls_field>.
 if <ls_field> is ASSIGNED.
   <ls_field> = 'DIW1'.
 endif.

insert <f_str> into TABLE <f_dyntable>.
enddo.

Regards,

Diwakar

Edited by: Diwakar Aggarwal on Oct 11, 2011 10:59 AM