Hide or Delete Empty columns in dynamic internal table

Hi,
                            I am having an dynamic internal table which contains more than 100 columns.
         I need to delete empty column from that table, can any one help this.

Hello,
If you are talking about ALV then you can just the the table for empty columns before populating fieldcataloge and hide the columns.
If your query is still not answered please provide a detail requirement.

Similar Messages

  • Deleting selected record in Dynamic Internal table

    Hi Friends,
    I want to delete selected row from a dynamic internal table. The selected entry should be deleted from Adobe and as well as Webdynpro abap.
    Kindly help me how to solve this problem.
    Thanks in advance.
    Regards,
    Phani.

    Hi Matthias,
    Thanks a lot for responding.
    In my adobe i kept a check box to delete the record. It should delete the selected ones. But right now, its deleting one by one.
    I have coded following script for delete button:
    IT_TIME_SHEET --> is my internal table
    G_ROW_STATUS is the field to track the action performed.
    var tlength = xfa.resolveNodes("IT_TIME_SHEET.DATA[*]").length;
    for ( var i=0; i<tlength; i++
    if(xfa.resolveNode("IT_TIME_SHEET.DATA["i"].FLAG").rawValue ==
    1 )
    IT_TIME_SHEET.DATA.instanceManager.removeInstance(i);
    G_ROW_STATUS.rawValue = "DELETE";
    In the Webdynpro abap following code I wrote:
        row_count = 1.
        FIELD-SYMBOLS <wa> TYPE zshr_time_sheet_time.
        LOOP AT it_time_sheet ASSIGNING <wa>.
          <wa>-srl_no = row_count.
          row_count = row_count + 1.
        ENDLOOP.
        last_row = <wa>-srl_no.
          DELETE it_time_sheet WHERE srl_no EQ last_row.
    Suppose if two records checkboxes are selected I can loop at the internal table IT_TIME_SHEET in webdynpro and delete where checkbox is selected.
    But problem is once user deletes records, adobe is deleting only one record and if i delete two records from webdynpro it looks like something wrong for the user.
    Please help me how to solve this problem.
    Regards,
    Phani.

  • 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

  • How to find the number of columns in an internal table DYNAMICALLY ?

    Hi,
    How to find the number of columns in an internal table DYNAMICALLY ?
    Thanks and Regards,
    saleem.

    Hi,
    you can find the number of columns and their order using
    the <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_INCLNAME                   = sy-repid
      changing
        ct_fieldcat                  = IT_FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif
    now describe your fieldcat . and find no of columns.
    and their order also..
    regards
    vijay

  • How to delete data from dynamic internal table

    Hi,
    I have dynamic internal table and I have some slection screen fields , using these selection screen fields
    (select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
    and also delete will not work for dynamic table..
    as we cannot use assigning with delete..
    So how to do this?
    and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
    so now after selection of data, I need to filter the data from dynamic table.
    Is there any way to do this?
    Regards,
    Mrunal

    Hi matt,
    I tried with below code as  you said. But I am getting dump. can you help?
    here is my piece of code.
    FIELD-SYMBOLS: <LS_DATA> type any,
                               <LT_DATA> TYPE table,
                                <L_FIELD> type any.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LS_DATA>.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LT_DATA>.
    LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
    ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BUKRS.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BELNR.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ENDLOOP.
    and here is the description of my dump:->>>
    You attempted to access an unassigned field symbol
    (data segment 32772).
    This error may occur for any of the following reasons:
    - You address a typed field symbol before it is set using ASSIGN
    - You address a field symbol that points to a line in an internal table
      that has been deleted
    - You address a field symbol that had previously been reset using
      UNASSIGN, or that pointed to a local field that no longer exists
    - You address a global function interface parameter, even
      though the relevant function module is not active,
      that is it is not in the list of active calls. You can get the list
      of active calls from the this short dump.

  • 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.

  • How to create Dynamic internal table with columns also created dynamically.

    Hi All,
    Any info on how to create a dynamic internal table along with columns(fields) also to be created dynamically.
    My requirement is ..On the selection screen I enter the number of fields to be in the internal table which gets created dynamically.
    I had gone thru some posts on dynamic table creation,but could'nt find any on the dynamic field creation.
    Any suggestions pls?
    Thanks
    Nara

    I don't understand ...
    something like that ?
    *   Form P_MODIFY_HEADER.                                              *
    form p_modify_header.
      data : is_fieldcatalog type lvc_s_fcat ,
             v_count(2)      type n ,
             v_date          type d ,
             v_buff(30).
    * Update the fieldcatalog.
      loop at it_fieldcatalog into is_fieldcatalog.
        check is_fieldcatalog-fieldname+0(3) eq 'ABS' or
              is_fieldcatalog-fieldname+0(3) eq 'VAL' .
        move : is_fieldcatalog-fieldname+3(2) to v_count ,
               p_perb2+5(2)                   to v_date+4(2) ,
               p_perb2+0(4)                   to v_date+0(4) ,
               '01'                           to v_date+6(2) .
        v_count = v_count - 1.
        call function 'RE_ADD_MONTH_TO_DATE'
            exporting
              months        = v_count
              olddate       = v_date
            importing
              newdate       = v_date.
        if is_fieldcatalog-fieldname+0(3) eq 'ABS'.
          concatenate 'Quantité 0'
                      v_date+4(2)
                      v_date+0(4)
                      into v_buff.
        else.
          concatenate 'Montant 0'
                      v_date+4(2)
                      v_date+0(4)
                      into v_buff.
        endif.
        move : v_buff to is_fieldcatalog-scrtext_s ,
               v_buff to is_fieldcatalog-scrtext_m ,
               v_buff to is_fieldcatalog-scrtext_l ,
               v_buff to is_fieldcatalog-reptext .
        modify it_fieldcatalog from is_fieldcatalog.
      endloop.
    * Modify the fieldcatalog.
      call method obj_grid->set_frontend_fieldcatalog
           exporting it_fieldcatalog = it_fieldcatalog.
    * Refresh the display of the grid.
      call method obj_grid->refresh_table_display.
    endform.                     " P_MODIFY_HEADER

  • How to delete records from dynamic internal table.

    Hi Experts,
    Need urgent help!!!
    Issue is with Dynamic internal tables.
    Below is code written by me :
    FORM select_query USING Lw_tabnam
                      TYPE  t682i-kotabnr.
      DATA :  lw_line  TYPE REF TO data,
              lw_line1 TYPE REF TO data.
        CREATE DATA Lw_line    TYPE (lw_TABNAM).
        ASSIGN      Lw_line->* TO   <WA_tbl>.
        CREATE DATA LW_LINE    TYPE STANDARD TABLE OF (Lw_tabnam)
                               WITH NON-UNIQUE DEFAULT KEY.
        ASSIGN      Lw_line->* TO <TBL>.
        SELECT * FROM  (Lw_tabnam)
                 INTO CORRESPONDING FIELDS OF TABLE <TBL>
                 WHERE (t_keys).
    Endform.
    code is working fine.
    here even the table name and where condition are dynamic,everything is fine upto this point.
    Now i have to delete some record from <TBL> based on some conditons.
         for ex : ( here lc_fieldname is KUNNR)
          loop at t_kunnr.
              lw_tabix = sy-tabix.
            Read table <tbl>
                    with key (lc_fieldname) = t_kunnr-kunnr ASSIGNING <wa_tbl>.
            If sy-subrc = 0.
            *Delete
            delete <tbl> from <wa_tbl>
    delete <tbl> index  lw_tabix.
            Endif.
         Endloop.
    The above delete statement doesn't work ,even we can't use index as it gives a syntax error " something related to "index is not allowed in standard table or hash table.
    Can you help me ab't how to delete records in Dynamic internal table?
    Other option that i am thinking of is to create a static table of type dynamic table.
    means, data itab type standard table of <tbl> .I know the syntax is wrong ,however is there any way to do this?
    Thanks in advance ,
    If you have any suggestion ab't this then do let me know.
    bye,
    Gaurav.

    Hi
    I wrote this code and it works fine:
    DATA LW_TABNAM(10) VALUE 'LFA1'.
    DATA : LW_LINES TYPE REF TO DATA,
           LW_LINE  TYPE REF TO DATA.
    FIELD-SYMBOLS: <TABLE> TYPE TABLE,
                   <WA>    TYPE ANY.
    CREATE DATA LW_LINES TYPE TABLE OF (LW_TABNAM)
    WITH NON-UNIQUE DEFAULT KEY.
    ASSIGN LW_LINES->* TO <TABLE>.
    CREATE DATA LW_LINE TYPE (LW_TABNAM).
    ASSIGN LW_LINE->* TO <WA>.
    DO 10 TIMES.
      APPEND INITIAL LINE TO <TABLE>.
    ENDDO.
    SY-TABIX = 4.
    DELETE <TABLE> INDEX SY-TABIX.
    WRITE SY-SUBRC.
    I hope it help you
    Max

  • Dynamic internal table column issue

    Hi
    i have ALV report with dynamic internal table.after i build the internal table and fieldcatalog i have problem  i.e. when grid is displayed then one of the column value is coming in the next column.i populated col_pos in field catalog also and in the debug mode data is populated correctly for respective columns in fieldcatalog and dynamic internal table. But when it is displayed i have this problem.
    any inputs on this?

    Hi Moorthy,
    Did you perform an ALV consistency check?
           Check the below given links as well.
    The Consistency Check - ALV Grid Control (BC-SRV-ALV) - SAP Library
    SAP ALV Consistency Check
    Regards,
    Philip.

  • Deleting from Dynamic Internal table

    Hi,
    How can we delete data from dynamic internal table...
    I have a dynamic internal table <fs_dyn_table> which is of type any and can have any fields...
    I want to delete all those records which have a value of '10' in a field named field1
    I have written my delete statement in the following manner..
    DELETE <fs_dyn_table> WHERE field1 = '10'.....but it is not working...it gives me an error...stating that the line type of table must be statically defined.

    Hi,
    Loop on the internal table into a field-symbol of line type same as the internal table.
    Use assign component statement and then delete the corresponding record.
    Regards,
    Ankur Parab

  • 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

  • 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

  • ALV rows to column dynamic internal table

    Hello People ,
    I am stuck in a report which displays an output in ALV as follows :-
    bukrs | kntyp | konto | knfix  | period     | element    | emeng  | emein
    1000  | 10      | 1100 | berlin | 11.2011  |      AG      |  0.148    | kgAG
    1000  | 10      | 1100 | berlin | 11.2011  |      AU      | 0.104    | kgAU
    1000  | 10      | 1100 | berlin | 11.2011  |      GA     | 0.207    | kgGA
    And this table has many values corresponding to element AG,AU and GA respectively . For example , there would be many element AG's with many "EMENG" values . Similarly for AU and GA .
    MY question :- I am asked to make AG , AU , GA as 3 different fields which should show the value "EMENG" under respective elements . Like :-
    bukrs | kntyp | konto | knfix  | period     |   AG       |   AU      |  GA     |    emein
    1000  | 10      | 1100 | berlin | 11.2011  |   0.148    |   0.104  |  0.207 |    kgAG
    That should be my output . ( elements replaced by AG , AU and GA which comes from a Metal table ZXXXX where
    metal no. 1 = AU
    metal no. 2 = AG
    metal no. 3 = GA
    If there is any metal added to it would be metal no. 4 ,5,6,7 .... so on ) and then that should be added as a field in our report .. So that has to be DYNAMIC .
    I am unable to move on with problem . Pls suggest ? I am pasting my report here ...
    FORM select_table_gt_bb CHANGING p_gt_bb.
      TABLES : zpam_as .
      DATA : i_zpam_as TYPE TABLE OF zpam_as ,
             wa_zpam_as LIKE LINE OF i_zpam_as ,
             i_tcurr TYPE TABLE OF tcurr ,
             wa_tcurr LIKE LINE OF i_tcurr,
             zt_as TYPE TABLE OF zpam_as.
      SELECT * FROM zpam_as INTO TABLE gt_as
             WHERE bukrs   EQ bukrs
               AND kntyp   IN kntyp
               AND konto   IN konto
               AND knfix   IN knfix
               AND buper   IN buper
               AND element IN element
               AND ameng   IN ameng
               AND ashkz   IN ashkz
               AND emeng   IN emeng
               AND eshkz   IN eshkz
               AND emein   IN emein.
      SELECT * FROM zpam_tcurr INTO TABLE gt_tcurr.
      IF sy-subrc IS INITIAL.
        LOOP AT gt_tcurr INTO gw_tcurr.
         SELECT * FROM tcurr INTO wa_tcurr WHERE fcurr = gw_tcurr-fcurr AND
         tcurr = tcurr.
          ENDSELECT.
          APPEND wa_tcurr TO i_tcurr.
          DELETE ADJACENT DUPLICATES FROM i_tcurr.
        ENDLOOP.
      ENDIF.
      IF i_tcurr IS NOT INITIAL.
        LOOP AT gt_as INTO gw_as.
    CLEAR sy-subrc.
    LOOP AT i_tcurr
    INTO wa_tcurr
    WHERE   fcurr = gw_as-emein.
            gw_as-tcurr = wa_tcurr-tcurr.
            gw_as-ukurs = wa_tcurr-ukurs.
            gw_as-total = abs( gw_as-emeng ) * wa_tcurr-ukurs.
            APPEND gw_as TO zt_as.
          ENDLOOP.
          IF sy-subrc <> 0.
            gw_as-tcurr = 'None'.
            gw_as-ukurs = ''.
            gw_as-total = ''.
            APPEND gw_as TO zt_as.
          ENDIF.
        ENDLOOP.
        REFRESH gt_as.
        LOOP AT zt_as INTO gw_as.
          APPEND gw_as TO gt_as.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    Priority normalized
    Edited by: Rob Burbank on Dec 28, 2011 3:44 PM

    Hey,
    But after understanding my question correctly , you sure that dynamic internal table is the solution for it ?

  • 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 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

Maybe you are looking for

  • How to unlock a row if i use FOR UPDATE clause

    In procedure if we use FOR UPDATE clause, it will lock particular row and allow only one client to update whereas other client can only fetch data in the same row at that time. My question is when will it unlock the row, what should we do to unlock t

  • How to search XML file for specific attributes ...

    Hi, Im trying to design a XML driven billboard. Is there an easy way to seach attributes of all elements using DOM parser and return the element with attribute that matched search criteria?

  • List component trouble

    Hello! I have some trouble with the list component in my application. The thing is that the keyboard interaction don't work proper. I've found out that it is my function "transferParameters" who spoils it. The function looks like this: Object.prototy

  • WHAT IS THE NAME

    ... of the stupid MTP driver that Creative Zen Vision M: needs to be able to run? I have done *everything*. I am not a novice, nor am I an uber-geek who would be able to point out the needle in this proverbial haystack. I have reinstalled windows. I

  • While doing 3rd party process,  So, how system will pick the vendor?

    Hi  SAP SD Experts, while doing 3rd party process, at the time of creation of sales order system automatically creates Purchase Requestiion with   reference to this Purchase order will be created while creating Purchase order system automatically pic