2 Replies Latest reply: Nov 18, 2010 9:53 AM by Clemens Li RSS

Modify Syntax on Internal table of type ANY TABLE

Currently Being Moderated



I have declared one internal table which is of type ANY TABLE.


In the Loop statement, I am trying to Modify that Internal table from WA.


Then I am getting one Error message


"You cannot use explicit or implicit index operations on tables with types "HASHED TABLE" or "ANY TABLE". "C_T_DATA" has the type "ANY TABLE".



Above code I have placed in method of a corresponding Class.



Can u please advise me on this..How to modify the Intenal table .


Thanks and Regards,

K.Krishna Chaitanya.

  • Re: Modify Syntax on Internal table of type ANY TABLE
    KaushiK Datta
    Currently Being Moderated


    Can you paste your sample code here  ? How you have declared the internal table ?

  • Re: Modify Syntax on Internal table of type ANY TABLE
    Clemens Li
    Currently Being Moderated

    Hi Krishna,


    the modify statement is obsolete.


    You can always LOOP AT [itab] ASSIGNING <field-symbol>.


    This makes the loop never slower, depending on the table structure faster or much faster.


    If you know the table structure at run time, you can use a field-symbol of that type. If not, you can use a field-symbol TYPE any. Then you have to assign the components to field-symbol to modify them, i.e.


      <table_line> type any,
      <matnr>        type mara-matnr.
    loop at itab assigning  <table_line>.
      assign component 'MATNR' of structure <table_line> to <matnr>.
      clear <matnr>.


    This technique (available more than ten years) works incredibly fast. My estimate is that if SAP would change all the old standard programs that way and use it consequently in the new ones, the whole system would be 20 % faster because myriads of unnecessary copy operations of LOOP INTO would not happen.