How to Organize the columns in the dynamic internal table?

Hello Folks!
How to Organize the columns in the dynamic internal table? i tried passing the parameter COL_POS to the fieldcatalog, Which is not working.

Organize in What order ? What is your way to output ?
If you use ALV, you need to create fresh FIELD CATALOG for your dynamic table and then assign the column position.
Regards,
Diwakar

Similar Messages

  • Logic for retreiving the values from a dynamic internal table

    Hi all,
    I have an issue with the logic to fetch data from a dynamic internal table into fields. let me give you guys an example the sy-tfill = 9 (subject to vary). I need to populate the fields.
    Regards,
    Sukumar

    Hi,
    this is for printing out the info in a dynamic table,
    it will work likewise to insert data.
    PARAMETERS:
      p_tabnam TYPE tabname DEFAULT 'DB_TABLE_NAME'.
    DATA:
      lv_dref TYPE REF TO data,
      ls_dd03l LIKE dd03l,
      lt_fieldname TYPE TABLE OF fieldname,
      ls_fieldname TYPE fieldname.
    FIELD-SYMBOLS:
      <fs> TYPE STANDARD TABLE,
      <wa_comp> TYPE fieldname,
      <wa_data> TYPE ANY,
      <wa_field> TYPE ANY.
    REFRESH lt_fieldname.
    SELECT * FROM dd03l INTO ls_dd03l
                       WHERE as4local = 'A'
                         AND as4vers  = '0000'
                         AND tabname  = p_tabnam
                       ORDER BY position.
      ls_fieldname = ls_dd03l-fieldname.
      APPEND ls_fieldname TO lt_fieldname.
    ENDSELECT.
    IF NOT ( lt_fieldname[] IS INITIAL ).
      CREATE DATA lv_dref TYPE TABLE OF (p_tabnam).
      ASSIGN lv_dref->* TO <fs>.
      SELECT * FROM (p_tabnam) INTO TABLE <fs>.
      WRITE:
        / 'CONTENTS OF TABLE', p_tabnam.
      LOOP AT <fs> ASSIGNING <wa_data>.
        SKIP.
        WRITE:
          / 'LINE', sy-tabix.
        ULINE.
        LOOP AT lt_fieldname ASSIGNING <wa_comp>.
          ASSIGN COMPONENT sy-tabix OF STRUCTURE <wa_data> TO <wa_field>.
          WRITE:
            / <wa_comp>, <wa_field>.
        ENDLOOP.
      ENDLOOP.
    ENDIF.
    grtz
    Koen

  • To read the column names of an internal table

    Hi ,
    I want to read the column/field names of an internal table into another internal table.
    How can this be done?
    Kind Regards,
    hgarsht Rungta

    Hi ,
    you can get the attributes of any internal table into another ..
    check the following code ..
    DATA : it_mara TYPE STANDARD TABLE OF mara  WITH HEADER LINE.
    DATA : it_detail   TYPE abap_compdescr_tab,
               wa_comp TYPE abap_compdescr.
    DATA : ref_descr TYPE REF TO cl_abap_structdescr.
    ref_descr ?= cl_abap_typedescr=>describe_by_data( it_mara ).
    it_detail[] = ref_descr->components .
    loop at it_detail into wa_comp.
    write:/ wa_comp-name .
    endloop.
    Regards,
    Rajesh Kumar

  • Make the column to row.(internal table)

    hi
    i have an internal table ITAB
    data:begin of itab
            quarters(2),
           end of itab.
       that has contents
    Q1
    Q2
    Q3
    Q4
    I would like to have a ITAB2 like this
    data:begin of itab
            Q1(2),
            Q2(2),
           Q3(2),
           Q4(2)
           end of itab.
    Q1  Q2  Q3 Q4 Q5
    any ideas guys..........
    thanks
    raghu.

    REPORT  z_test.
    Transpose itab1 to itab2.
    TYPES: BEGIN OF ty_1,
    first,
    second,
    third,
    fourth,
    END OF ty_1.
    TYPES: BEGIN OF ty_2,
    first,
    second,
    third,
    END OF ty_2.
    FIELD-SYMBOLS: <fs> TYPE ANY,
                  <fs2> TYPE ANY.
    DATA: itab1 TYPE TABLE OF ty_1 WITH HEADER LINE,
          itab2 TYPE TABLE OF ty_1 WITH HEADER LINE,
          curr_line TYPE sy-tabix.
    itab1-first = '1'.
    itab1-second = '2'.
    itab1-third = '3'.
    itab1-fourth = '4'.
    APPEND itab1.
    itab1-first = '1'.
    itab1-second = '2'.
    itab1-third = '3'.
    itab1-fourth = '4'.
    APPEND itab1.
    itab1-first = '1'.
    itab1-second = '2'.
    itab1-third = '3'.
    itab1-fourth = '4'.
    APPEND itab1.
    LOOP AT itab1.
      CLEAR itab2.
      ASSIGN COMPONENT sy-tabix OF STRUCTURE itab2 TO <fs>.
      curr_line = sy-tabix.
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE itab1 TO <fs2>.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        IF curr_line = 1.
          <fs> = <fs2>.
          APPEND itab2.
        ELSE.
          READ TABLE itab2 INDEX sy-index.
          <fs> = <fs2>.
          MODIFY itab2 INDEX sy-index.
        ENDIF.
      ENDDO.
    ENDLOOP.
    LOOP AT itab2.
      WRITE:/ itab2.
    ENDLOOP.
    Please find the above code for the same.
    Regards
    Ramesh.

  • How to get the NameTab Structure(X031L) for Dynamic internal table?

    when we pass standard table to the FM 'DD_GET_NAMETAB' we will get the
    nametab structure(x031l), like this i want to get the same structure for
    dynamic internal  table . how can I achieve this
    please help me...

    Hi,
    try this method
    REPORT zmaschl_create_data_dynamic .
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
          is_fcat LIKE LINE OF it_fcat.
    DATA: it_fieldcat TYPE lvc_t_fcat,
          is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data.
    DATA: new_line  TYPE REF TO data.
    FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
                   <l_line>  TYPE ANY,
                   <l_field> TYPE ANY.
    Build fieldcat
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'       EXPORTING           i_structure_name = 'SYST'       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.
    Create a new Table
    CALL METHOD cl_alv_table_create=>create_dynamic_table       EXPORTING        it_fieldcatalog = it_fieldcat       IMPORTING        ep_table        = new_table.
    Create a new Line with the same structure of the table.
    ASSIGN new_table->* TO <l_table>.CREATE DATA new_line LIKE LINE OF <l_table>.ASSIGN new_line->* TO <l_line>.
    Test it...
       DO 30 TIMES.
          ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
          <l_field> = sy-index.
          INSERT <l_line> INTO TABLE <l_table>.
       ENDDO.
       LOOP AT <l_table> ASSIGNING <l_line>.
          ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
          WRITE <l_field>.
       ENDLOOP.

  • Column names of a dynamic internal table

    Hi Friends,
    I have a dynamic internal table flowing in my ABAP program and I want to list down the column names of the this dynamic internal table.
    The declaration of this dynamic internal table :
       FIELD-SYMBOLS:
        <l_t_data>         TYPE STANDARD TABLE.
    Can you please tell me how to get the column names?
    Thanks,
    Gaurav

    Hi,
         You can use ABAP Runtime Type Identification to get the column names of the internal table.
    e.g >
    >lo_itab holds reference to description object of internal table whose column names i have to extract.
    >Using method describe_by_data of class cl_abap_typedescr export the field symbol assigned to the table and import the object reference into lo_itab.
    >Then using method get_table_line_type of lo_itab import line type description object reference into lo_line.
    >Check if lo_line is referring to a structure, if yes , downcast it to a object reference lo_struct of type cl_abap_structdescr.
    >The column description of all columns in the structure is stored in 'components' table of cl_abap_structdescr.
         So loop at the table to get all the column names stored in column 'name' of table 'components'.
    Thank You.

  • Adding Specific columns of dynamic internal table row into another column

    Hi Gurus,
    I need to add  few columns of a dynamic internal table row into another column:
    Article description hy01 hy02 total
    101      panza         10     12      22
    102      masht         12     12     24
    dynamic internal table is created and columns hy01 hy02.... can increase
    How to add the the values in hy01 hy 02... into total.
    Regards,
    Dep

    Hi,
    If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
    Here an example how to generate a dynamic table based on another internal table, hope this will help you.
    TYPE-POOLS: slis.
    PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
    * Type ZST_T:
    *   matnr  TYPE matnr
    *   maktx  TYPE maktx
    *   hy01   TYPE i
    *   total  TYPE i
    TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
    PERFORM main.
    *&      Form  main
    *       text
    FORM main.
      DATA: lt_fieldcat     TYPE slis_t_fieldcat_alv,
            lt_t            TYPE ty_t,
            lr_new_t        TYPE REF TO data.
      FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
      "Add some lines to LT_T just to have something to display on screen
      DO 10 TIMES.
        APPEND INITIAL LINE TO lt_t.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZST_S'
        CHANGING
          ct_fieldcat      = lt_fieldcat.
      "Copy LT_T to LR_NEW_T
      PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
      CLEAR lt_t. "Not needed anymore...
      ASSIGN lr_new_t->* TO <lt_new_t>.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <lt_new_t>.
    ENDFORM.                    "main
    *&      Form  extend_and_copy_table
    FORM extend_and_copy_table USING ut_t           TYPE STANDARD TABLE
                                     uv_nb_hy       TYPE i
                               CHANGING cr_t        TYPE REF TO data
                                        ct_fieldcat TYPE slis_t_fieldcat_alv
                               RAISING cx_sy_struct_creation cx_sy_table_creation.
      DATA: lo_tabledescr      TYPE REF TO cl_abap_tabledescr,
            lo_structdescr     TYPE REF TO cl_abap_structdescr,
            lo_new_structdescr TYPE REF TO cl_abap_structdescr,
            lo_new_tabledescr  TYPE REF TO cl_abap_tabledescr,
            lt_components      TYPE cl_abap_structdescr=>component_table,
            ls_component       TYPE cl_abap_structdescr=>component,
            lv_field_cnt       TYPE numc2,
            ls_fieldcat        TYPE slis_fieldcat_alv,
            lr_fieldcat        TYPE REF TO slis_fieldcat_alv.
      FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
                     <lt_new_t> TYPE STANDARD TABLE,
                     <ls_new_s> TYPE ANY.
      "Get the list of all components from UT_T line structure
      lo_tabledescr  ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
      lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_components  = lo_structdescr->get_components( ).
      "The new columns will be from type of column HY01
      ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
      "The new columns will have the same fieldcat info as column HY01
      READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
      "HY<lv_field_cnt> = new field name
      lv_field_cnt = uv_nb_hy + 1.
      "For each new column...
      DO uv_nb_hy TIMES.
        "Generate the new column field name
        CONCATENATE  'HY' lv_field_cnt INTO ls_component-name.
        ls_fieldcat-fieldname = ls_component-name.
        "Add the new field to the components of the new structure
        INSERT ls_component INTO lt_components INDEX 4.
        "Add the new field's fieldcat info to the fieldcat
        INSERT ls_fieldcat  INTO ct_fieldcat   INDEX 4.
        lv_field_cnt = lv_field_cnt - 1.
      ENDDO.
      "Adjust the COL_POS from fieldcat
      LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
        lr_fieldcat->col_pos = sy-tabix.
      ENDLOOP.
      "Create the new table
      lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
      lo_new_tabledescr  = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
      CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
      ASSIGN cr_t->* TO <lt_new_t>.
      "Copy all data from old to new table
      LOOP AT ut_t ASSIGNING <ls_old_s>.
        APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
        MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
      ENDLOOP.
    ENDFORM.                    "main

  • Dynamic internal table- column to row conversion

    Hello all,
    Inside a program i generate a dynamic internal table and
    This table has one single column. But I need to convert the rows as columns.
    Eg:
    dynamic internal table ITAB has content
    Forbes
    Times
    Reuters
    Warner
    stern
    I would like to have a ITAB2 like this
    Forbes Times Reuters Warner Stern
    Please note this is a Dynamic internal table!!!!
    I need some approach for my problem. Thanks a lot in advance.
    Karthik.

    Hi karthik,
    1.
      For this purpose,
      in my program,
    <b>  there is an INDEPENDENT FORM</b>
       whose inputs are
    <b>  LIST OF FIELDS, (just as u require)</b> 
    and from those, it consructs dynamic table.
    2. Here is the program.
    the dynamic table name will be
    <DYNTABLE>.
    3. U can use this program (FORM in this program)
    to generate any kind of internal table
    by specifying list of fields.
    4.
    REPORT abc.
    COMPULSORY
    FIELD-SYMBOLS: <dyntable> TYPE ANY TABLE.
    FIELD-SYMBOLS: <dynline> TYPE ANY.
    DATA: lt TYPE lvc_t_fcat.
    DATA: ls TYPE lvc_s_fcat.
    FIELD-SYMBOLS: <fld> TYPE ANY.
    DATA : fldname(50) TYPE c.
    DATA : ddfields LIKE ddfield OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
    field list
      ddfields-fieldname = 'BUKRS'.
      APPEND DDFIELDS.
      ddfields-fieldname = 'MATNR'.
      APPEND DDFIELDS.
      PERFORM mydyntable .
    see <DYNTABLE> in debug mode.
      BREAK-POINT.
    INDEPENDENT FORM
    FORM mydyntable .
    Create Dyn Table From FC
      FIELD-SYMBOLS: <fs_data> TYPE REF TO data.
      FIELD-SYMBOLS: <fs_1>.
      FIELD-SYMBOLS: <fs_2> TYPE ANY TABLE.
      DATA: lt_data TYPE REF TO data.
      data : lt TYPE lvc_t_fcat .
    CONSTRUCT FIELD LIST
      LOOP AT ddfields.
        ls-fieldname = ddfields-fieldname.
        APPEND ls TO lt.
      ENDLOOP.
      ASSIGN lt_data TO <fs_data>.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = lt
        IMPORTING
          ep_table                  = <fs_data>
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
      ENDIF.
    Assign Dyn Table To Field Sumbol
      ASSIGN <fs_data>->* TO <fs_1>.
      ASSIGN <fs_1> TO <fs_2>.
      ASSIGN <fs_1> TO <dyntable>.
    ENDFORM. "MYDYNTABLE
    regards,
    amit m.

  • How to Copy data from field symbol to Dynamic Internal Table

    Hi,
    I want to copy the data between two dynamic Internal tables . Following is the code were I have data in the field symbol wanted to transfer it to the other Internal table :
    REPORT  ztest.
    DATA:
           gd_dref          TYPE REF TO data,
           gd_dref1          TYPE REF TO data.
    FIELD-SYMBOLS:  <fs1>   TYPE any,
                               <fs_wa> TYPE any,
                                <field>    TYPE any,                  
                                <fs_wa1> TYPE ANY TABLE.  * Contains data from p_src
    *Copy data from p_src to p_dest*
    PARAMETERS: p_src LIKE dd02l-tabname .    * Name of Dynamic Internal table *
                             p_dest LIKE dd02l-tabname .  * Name of Dynamic Internal table*
    *DATA : lt_csks LIKE p_dest WITH HEADER LINE.
    START-OF-SELECTION.
      CREATE DATA gd_dref TYPE (p_src).
      CREATE DATA gd_dref1 TYPE TABLE OF (p_src).
       ASSIGN gd_dref->* TO <fs_wa>.
       ASSIGN gd_dref1->* TO <fs_wa1>.
       SELECT * FROM (p_src) INTO TABLE <fs_wa1>.
    *Write out data from FIELD SYMBOLS TO Table.
       loop at <fs_wa1> into <fs_wa>.
         do.
           assign component  sy-index
              of structure <fs_wa> to <field>.
           if sy-subrc <> 0.
           exit.
           endif.
           if sy-index = 1.
             write:/ <field>.
           else.
           write: / <field>.
           endif.
         enddo.
       endloop.
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    *p_dest is a table having a similar structure to table p_src .
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    EXIT.
    Thanks in Advance.

    try this...
    I have extended your source code and just used vbak/vbap as an example as they have some common fields like vbeln/erdat etc which corresponds with your requirement of 'similar structure' i.e. shared/common fields in both.
    Cheers...
    report  ztest.
    data:
      gd_dref type ref to data,
      gd_dref1 type ref to data,
      gd_dref_str type ref to data,
      gd_dref_tab type ref to data.
    field-symbols:
      <fs1> type any,
      <fs_wa> type any,
      <fs1_dest_str> type any,
      <fs_dest_tab> type any table,
      <field> type any,
      <fs_wa1> type any table.
    * contains data from p_src
    *Copy data from p_src to p_dest*
    parameters: p_src like dd02l-tabname default 'vbak',
    * name of dynamic internal table *
                p_dest like dd02l-tabname default 'vbap'.
    * name of dynamic internal table*
    *data : lt_csks like p_dest with header line.
    start-of-selection.
      create data gd_dref type (p_src).
      create data gd_dref1 type table of (p_src).
      assign gd_dref->* to <fs_wa>.
      assign gd_dref1->* to <fs_wa1>.
      select * from (p_src) into corresponding fields of table <fs_wa1>
      up to 3 rows
      where vbeln ne space.
      create data gd_dref_str type (p_dest).
      create data gd_dref_tab type standard table of (p_dest).
      assign gd_dref_str->* to <fs1_dest_str>.
      assign gd_dref_tab->* to <fs_dest_tab>.
    *write out data from field symbols to table.
      loop at <fs_wa1> into <fs_wa>.
        " break-point here - can see vbeln/waers/create date/ etc move over to new structure
        " the 'common' fields of your structures - the same will happen. if they not the same name you will have to do an
        " explicit move i.e. if fieldname = xyz ....move fieldxyz to new field123....after the move-corre
        break-point.
        move-corresponding <fs_wa> to <fs1_dest_str>.
        insert <fs1_dest_str> into table <fs_dest_tab>.
    **    do.
    **      assign component  sy-index
    **         of structure <fs_wa> to <field>.
    **      if sy-subrc <> 0.
    **        exit.
    **      endif.
    **      if sy-index = 1.
    **        write:/ <field>.
    **      else.
    **        write: / <field>.
    **      endif.
    **    enddo.
      endloop.
      " write out some dest data from the dest table build from previous loop
      loop at <fs_dest_tab> assigning <fs1_dest_str>.
        do.
          assign component sy-index of structure <fs_wa> to <field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <field>.
          else.
            write: / <field>.
          endif.
        enddo.
      endloop.

  • Dynamic internal table from SELECT - statement ?

    Hi, is it possible to define an internal table just after a select statement is executed so that this internal table holds all the data that come back from the statement ?
    thanks in advance,

    Check the link -
    Re: Create Dynamic internal table
    Regards,
    Amit

  • Dynamic internal table operations

    Hi,
    I have an issue with dynamic internal table wherein I need to write  a  select statement with For All Entries on dynamic internal table and populating the record into another dynamic internal table.
    I am trying with the code below but its not working.
    SELECT (FLD)
    FROM (T_TABLE)
    INTO CORRESPONDING FIELDS OF TABLE <DYN1_TABL>
    FOR ALL ENTRIES IN <DYN_TABL>
    WHERE KEY_FNAME = <DYN_TABL>-KEY_FNAME.
    FLD is the dynamic field.
    T_TABLE is the dynamic database table.
    DYN1_TABL is the dynamic internal table
    DYN_TABL is the dynamic internal table
    KEY_FNAME is the dynamic key field of T_TABLE.
    Pls help me on this issue.
    Response with code snippets will be appreciated.
    Thanks in advance.

    Thanks for your reply Nikki but my issue is to reference  a field in dynamic internal table to be used with 'For All Entries' satement.
    like for static we use
    For All Entries in Itab where <fieldname> = itab-<fieldname>
    I was looking for the same statement for dynamic tables

  • Dynamic internal table structure

    pl. give the solution to create dynamically internal table structure with respective of different table.

    Hi and welcome to the SDN,
    this topic is more related to abap, but anyway:
    data: l_tabname(30) type c value 'MARA',
          ref_data type ref to data.
    field-symbols: <fs_tab> type table.
    create data ref_data type standard table of (l_tabname).
    assign ref_data->* to <fs_tab>.
    Now <fs_tab> is a internal table with structure of table mara.
    Hope this helps!
    regards
    Siggi

  • How to create New columns for the Internal Table Dynamically?

    HI Guys,
                          In my logic i have to create new columns depending on the logic which i am executing.
    My requirement is .I have to display o/p like this
    Material || Year || Period  ||  Mix ratio || Vendor ||Mix Ratio || Vendor || Mix Ratio Vendor || Mix ratio || Vendor || Mix ratio.............................from table's CKMLMV003 and CKMLMV001.Her i have to display the o/p in the above format and i have to display Vendor and Mix Ratio for 5 columns irrespective of data .If i have more than 5 columns for any record then i have to create a New columns dynamically for Vendor and Mix ratio.If anybody want my code i can Submit But plz tell with example how to do?
                    <b>The O/P must be finally shown in ALV Grid</b>
    Thanks,
    Gopi

    You must create the entire internal table dynamically, you can not add columns to a statically define internal table.  Here is an example of creating a dynamic internal table.
    Creation of internal table dynamically based on the Date Range entered
    Regards,
    Rich Heilman

  • How to delete a column from the table control in module pool?

    Hi,
      can any one please tell How to delete a column from the table control in module pool?
    thanks in advance
    warm regards
    HareeshKumar N

    hi hareesh,
    I think it is better to hide it.
    How to hide: You can check this link
    Dynamic Hide column in table control

  • Add column in the dynamic internal table

    Hi Experts,
    I have a dynamic internal table. I need add new column in the internal table and I don´t Know.
    My code:
    DATA:  it_generic TYPE REF TO Data,
    wa_generic TYPE REF TO data.
    FIELD-SYMBOLS: <table> TYPE ANY TABLE,
    <wa>    TYPE ANY,
    <field> TYPE ANY.
    CREATE DATA it_generic  TYPE STANDARD TABLE OF (wa_datoscarga-ZTBLCAR).
    CREATE DATA wa_generic  TYPE (wa_datoscarga-ZTBLCAR).
    ASSIGN it_generic->* TO <table>.
    CHECK <table> IS ASSIGNED.
    ASSIGN wa_generic->* TO <wa>.
    CHECK <wa> IS ASSIGNED.
    SELECT *
    INTO  CORRESPONDING FIELDS OF TABLE <table>
    FROM (wa_datoscarga-ZTBLCAR)
    WHERE  bukrs   EQ p_bukrs      AND
    z_petic EQ z_peticion   AND
    ZIDFASE eq 'E'.
    After this I need add one column selection at the first position of the columns.
    Thanks

    Hi,
    Please refer to the below link for the code snippet on how to create a dynamic internal table -
    [Create a dynamic internal table.|http://www.divulgesap.com/blog.php?p=MjE=]
    Cheers,
    Ravi

Maybe you are looking for