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

Modify the structure of internal table which created dynamically!!!

Former Member
0 Likes
686

HI All,

I am creating internal table dynamically using the below syntax. Now I need to remove few of the fields from the internal table structure. Could you please help me how to go ahead in these cases?

* Create table dynamically for local data
  CREATE DATA gv_table_l TYPE TABLE OF (<fs_tabname>).
  CREATE DATA gv_wa_l    TYPE (<fs_tabname>).
  ASSIGN gv_table_l->*   TO <fs_local_tab>.
  ASSIGN gv_wa_l->*      TO <fs_local_wa

>.

Please let me know if you have any thoughts.

Thanks,

Raghu.

HI All,

I am creating internal table dynamically using the below syntax. Now I need to remove few of the fields from the internal table structure. Could you please help me how to go ahead in these cases?

* Create table dynamically for local data
  CREATE DATA gv_table_l TYPE TABLE OF (<fs_tabname>).
  CREATE DATA gv_wa_l    TYPE (<fs_tabname>).
  ASSIGN gv_table_l->*   TO <fs_local_tab>.
  ASSIGN gv_wa_l->*      TO <fs_local_wa

>.

Please let me know if you have any thoughts.

Thanks,

Raghu.

4 REPLIES 4
Read only

narinderpal
Explorer
0 Likes
635

Hi Raghu,

If you have crated internal table with ref to Database table then you cant' do this. You can only achieve this by creating internal table with desired fields and then move data into this by using move-corresponding.

Regards,

Narinder pal

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
635

Hi friend

If you know the fields to be deleted then what is the use of the word dynamic ?

Read only

Former Member
0 Likes
635

Hi ,

check this wiki

[Internal Table|http://wiki.sdn.sap.com/wiki/display/Snippets/Howtocreateinternaltable+dynamically]

in your case ...

1.Get filed list based on the type ...make use of "cl_abap_datadescr=>describe_by_type('MARA'), check for syntax or sample programs...

2.Delete fields which you dont want to be in your internal table....

3.Create internal table using method " CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE" ref attached link for sample code by Pinaki...

regards

Prabhu

Read only

Former Member
0 Likes
635

Hi,

first you are creating a dynamic internal table. if you want to create or delete any field.at first u have to assign a variable for that field then maintain field catalog .Then create the dynamic internal table using call method.next step is used to display the output using reuse_alv_grid_display .