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

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

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Dec 09, 2011 at 04:47 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2011 at 05:21 AM

    Hi friend 😊

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2011 at 05:41 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2011 at 07:43 AM

    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 .

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.