Doubt in internal tables

hi experts
could you please tell difference between linear search, binary search and hashed mechanism.
above 3 which is faster and why.
if  i use binary search in descending order it will search the records are not could please send why.

Hi Sayeed,
Standard table:
The key access to a standard table uses a sequential search. The time required for an access is linearly dependent on the number of entries in the internal table.
You should usually access a standard table with index operations.
Sorted table:
The table is always stored internally sorted by its key. Key access to a sorted table can therefore use a binary search. If the key is not unique, the entry with the lowest index is accessed. The time required for an access is logarithmically dependent on the number of entries in the internal table.
Index accesses to sorted tables are also allowed. You should usually access a sorted table using its key.
Hash table:
The table is internally managed with a hash procedure. All the entries must have a unique key. The time required for a key access is constant, that is it does not depend on the number of entries in the internal table.
You cannot access a hash table with an index. Accesses must use generic key operations (SORT, LOOP, etc.).
Index table:
The table can be a standard table or a sorted table.
Index access is allowed to such an index table. Index tables can be used to define the type of generic parameters of a FORM (subroutine) or a function module.
Just have a look at these links:
http://help.sap.com/saphelp_nw04/helpdata/en/90/8d7304b1af11d194f600a0c929b3c3/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/74/83015785d811d295a800a0c929b3c3/frameset.htm
Also Go through the following Document
1.1 STANDARD table
Key access to a standard table uses a linear search. This means that the time required for a search is in linear relation to the number of table entries.
You should use index operations to access standard tables.
1.2 SORTED table
Defines the table as one that is always saved correctly sorted.
Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries.
1.3 HASHED table
Defines the table as one that is managed with an internal hash procedure
You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.
1.4 INDEX table
A table that can be accessed using an index.
Index table is only used to specify the type of generic parameters in a FORM or FUNCTION. That means that you can't create a table of type INDEX.
Standard tables and sorted tables are index tables.
1.5 ANY table
Any table is only used to specify the type of generic parameters in a FORM or FUNCTION. That means that you can't create a table of type ANY.
Standard, sorted and hashed  tables belongs to ANY tables.
2. Defining an internal table
DATA itab TYPE table type of line type [WITH UNIQUE/NON-UNIQUE KEY <key>] [Iinitial size n]  [WITH HEADER LINE]
Note: There are also other ways to define an internal table. Please refere to the documentation.
2.1 The KEY option
KEY key1,,keyn :
key1..keyn are fields in the table.  The sequence in which you specify the key is significant.
DEFAULT KEY :
The key fields are the standard keys. Note that you can only specify an empty key for tables with access type STANDARD TABLE.  The standard key basically comprises all tables fields with character-like types (type ( C, STRING, D, T, N, X, XSTRING). In particular, components with a numeric type (also refer to ABAP numeric types) and table components usually do not belong to the standard key.
Example:
types:
  begin of t_makt,
    matnr like makt-matnr,
    maktx like makt-maktx,
  end of t_makt.
data:
Define the table
  gi_makt type sorted table of t_makt with unique key matnr.
Define the work area for the table if necessary
  gi_makt type  t_makt.
3. Reading internal tables
READ TABLE itab WITH TABLE KEY k1 = v1 k2 = v2 [additions]
Note: In case of more than one match, it is the first match that is selected.
STANDARD TABLE: The system searches from the start of the table. The response time is in linear relation to the number of table entries.
     SORTED TABLE: The response time is in logarithmic relation to the number of table entries.
     HASHED TABLE: The response time is constant
READ TABLE itab WITH KEY k1 = v1 k2 = v2  [BINARY SEARCH] [additions]
Note: In case of more than one match, it is the first match that is selected.
STANDARD TABLE: If you use the ... BINARY SEARCH addition, the system uses a binary search. Otherwise, the search is sequential. This assumes that the internal table is sorted in ascending order in the sequence of the specified key fields.
     SORTED TABLE: If the specified key fields form a left-justified extract of the table key, the search is binary, otherwise sequential.
     HASHED TABLE: Sequential search.
READ TABLE itab INDEX i [additions]
Accessing the table entry with the index i.
Additions:
INTO wa - wa is used as output area
     ASSIGNING <fs> - The field symbol <fs> is assigned to the entry. This saves the cost of copying the contents in comparison to the first addition. However, this addition does involve table administration costs, and it is therefore only worthwile for lines longer than around 300 bytes.
     COMPARING f1...fn - If the system find an entry, the system compares the subfields f1, f2, ... with the corresponding fields of the work area before they are transported into it.
     COMPARING ALL FIELDS
     TRANSPORTING f1 f2 - If the system finds an entry, it does not transfer all of the subfields (default) into the work area, but only the specified fields f1 f2 ...; the other subfields remain unchanged.
TRANSPORTING NO FIELDS
Example:
loop at gi_mseg into g_mseg.
   read table gi_makt
     with table key matnr = g_mseg-matnr
     into g_makt.
endloop.
Regards
Sreeni

Similar Messages

  • Doubt In internal table using in GUI download

    Hi,
    how to get the field lable of all the fields in the internal table... when i download it to xls file... while downloading it i want to pass the field lable first and then its value.
    eg. in mara table .
    MATERIAL NO.
    p-101
    points will be rewarded for correct answer.

    hi,
    Actually i'm downloading the data from mara table to excel file i.e from mara -> internal table-> excel file.
    In this i'm gettng all the values in excel file but i don't kno what those values exactly ment for , so i want the fields lable to be passed first.
    But i don't kno how to get the field lables into the internal atble and then how to pass that value to the excel file.
    Thanks.
    Arunprasad.P

  • Doubt in internal table

    Hi,
    I have internal table with 5 records. I want to separate out the last record in the internal table.
    For ex : itab contains,
                 12,
                 10,
                 15,
                 09,
                 13 .  i need the last record '13' only. how to fetch the last record from the internal table, i no need the other records.
    point will be sure.
    Gowri

    Hi,
    try this simle code:
    DATA: BEGIN OF ITAB OCCURS 0,
            N2(2) TYPE N,
          END   OF ITAB.
    DATA: LINE_ITAB LIKE SY-TABIX.
    START-OF-SELECTION.
      ITAB-N2 = '12'. APPEND ITAB.
      ITAB-N2 = '10'. APPEND ITAB.
      ITAB-N2 = '15'. APPEND ITAB.
      ITAB-N2 = '09'. APPEND ITAB.
      ITAB-N2 = '13'. APPEND ITAB.
      CLEAR: ITAB.
      DESCRIBE TABLE ITAB LINES LINE_ITAB.
      READ TABLE ITAB INDEX LINE_ITAB.
      WRITE: / ITAB-N2.
    Regards, Dieter

  • Doubt in internal table record count

    Hi,
    i have an internal table with 5 fields. Last field is flag. In my internal table lot many records are there. i want to count only the records with flag 'E'. How to count the total records with 'E'.
    Mohana

    Try like this,
    Data: c type i.
    Loop at itab into wa.
    if wa-flag = 'E'.
    c = c + 1.
    endif.
    Endloop.
    Write:/ 'Total records', c.
    OR
    LOOP AT itab WHERE flag = 'E'.
      c = c + 1.
    ENDLOOP.
    Edited by: Sap Fan on Apr 3, 2009 5:21 PM

  • Doubt in internal table records

    Hi all,
       I have a one problem, in my internal table have 5 records. i did some correction in my progm after i execute the loop i need the correction in the records. In debug mode it showing in the header level. but it not changing the body records. give some soln.
    Thanks,
    gowri

    hi,
    chk the code below:
    loop at itab.
    modify itab index sy-tabix.
    endloop.
    regards,
    Navneeth K.

  • Doubt for internal table

    hi abap gurus,
      Consider u have 2 internal tables (one for Header Data, other one
          for Line Item)
       How to transfer the Header & its corresponding Item data
            to third Internal table
    thanks and regards,
    bala

    Hi Bala,
    DATA : BEGIN OF IT_LIKP OCCURS 0,  "1st internal table
           FIELD1,
           FIELD2,
           FIELD3, ETC....
           END OF IT_LIKP.
    DATA : BEGIN OF IT_VBPA OCCURS 0,  "2nd internal table
           FIELD1,
           FIELD2,
           FIELD3, ETC....
        END OF IT_VBPA.
    DATA : BEGIN OF IT_FINAL OCCURS 0, "3rd internal table
           FIELD1,
           FIELD2,
           FIELD3, ETC....
    END OF IT_FINAL.
    SELECT STATEMENTS ON FIRST 2 INTERANL TABLES AND THEN PASS THE DATA IN THE FINAL INTERNAL TABLE IE IT_FINAL.
    THEN WITH IT_FINAL TABLE DISPLAY THE DATA.
      LOOP AT IT_LIKP.
        IT_FINAL-VBELN = IT_LIKP-VBELN.
        IT_FINAL-WADAT_IST = IT_LIKP-WADAT_IST.
        IT_FINAL-KUNNR = IT_LIKP-KUNNR.
        IT_FINAL-NAME1 = IT_LIKP-NAME1.
        IT_FINAL-VBELN_S = IT_LIKP-VBELV.
        IT_FINAL-ERDAT = IT_LIKP-ERDAT.
        READ TABLE IT_VBPA WITH KEY VBELN = IT_LIKP-VBELV BINARY
        SEARCH.
        IF SY-SUBRC = 0.
          IT_FINAL-KUNN2 = IT_VBPA-KUNNR.
          IT_FINAL-NAME2  = IT_VBPA-NAME1.
        ENDIF.
        APPEND IT_FINAL.
        CLEAR IT_FINAL.
      ENDLOOP.
    Thanks
    Vikranth Khimavath

  • Doubts in internal table logic

    Hi All,
    I have two internal table, according to the posnr value i need to add the kbetr value from the 2nd internal table and update the value in the 1st line internal table. below the example of my internal table. Here for the line item 0010 i need to calculate 10.0030.1011.00 and i need to add the value inthe 1st internal table kbeter_value. can anyone help this?
    POSNR        MATNR kbetr_value
    0010             abc
    0020             xyz
    0030             123
    POSNR     KBETR
    0010       10.00
    0010        30.10
    0010       11.00
    0010       60.30
    0020       12.64
    0020       11.32
    0030       79.46
    0030       00.00
    0030       45.3     
    by
    Mohana

    Hi Mohana,
    Its very simple ..you can do it in many ways....
    first one is in the second internal table use collect ....
    for example : 1st internal table is itab and the second is jtab .
    1. In jtab u use collect stmt to calculate the posnr values .
    loop at jtab.
      collect jtab .           " by using this u will have  0010    111.40 in jtab
    endloop.
    structure of jtab will be :
    0010    111.40
    0020    .........
    0030    ..........
    2. afterwards while printing you can use read to get those :
    loop at itab.
    read table jtab with key posnr = itab-posnr.
    if sy-subrc = 0.
    itab-ksbtr-value = itab-value .
    modify itab .
    endif.
    endloop.
    Hope you got it by now...if you any problem do reply back ....
    cheers,
    Vishnu .

  • Doubt on internal table.

    Hello All,
    I have internal table with multiple rows.
    Each row has some text. I want to print in smart form as it is in internal table.
    Acutally it is questionare in the service order
    Please let me knwo if you have the solution
    thanks for your time adn cooperation.
    Bobby

    Hi Bobby,
    if u want to pass the data from internal table in print program to Smartform.. there is only way.. that is using form interface..
    1. goto se11, create a structure same as the itab in the print program.ex. z_itab
    2. create line type... se11>select radio button-DATA type>z_it_itab >press create>then select>TABLE Type> then entrer some text--> in the line type Field in giveth Str name u have created in STEP 1. activate it.
    3. got SMARTFORMS-> form inteface>tables tabe--> give some name ex IT_tab type z_it_itab.
    then acivate it.. then in the driver progam pass this table data.
    Exapmpel
    CALL FUNCTION fp_v_fm_name
        EXPORTING
          archive_index      = toa_dara
          archive_parameters = arc_params
          control_parameters = fp_st_control_parameters
          user_settings      = space
          output_options     = fp_st_output_options
          wa_vbdkr           = fp_st_vbdkr
        IMPORTING
          job_output_info    = l_it_ssfcrescl
          job_output_options = l_it_ssfcresop
        TABLES
    IT_tab = z_it_itab (or table in driver program)
      EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Another way is cteate a type in Globaldifination-->types tab..
    ex:
    types: begin of ty_itab,
    matnr type matnr,
    meins type meins
    vrkme type vrkme,
    end of ty_itab,
    ty_it_itab type standard table of ty_itab.
    then GLOBAL DIFINATION>GLOBAL DATA TAB>IT)ITAB TYPE TY_IT_ITAB.
    BUT In this u can't pass the data from the print Program.. if u want to populate data in to this table... u have to write the Select query in the GLOBAL DIFINATIONS-->INITILIZATIONS TAB.
    Thanks,
    Reward If Helpful.

  • Doubt on internal tables

    Hi
    I have a internal table with several entries. The entries are like this.
    1  A  X
    1  B  N
    1  C  D
    2  B  N
    2  C  K
    3  G  L
    3  K  M
    I want to loop  on this internal table and separate the entrie starting with 1 into a new internal table and entries starting with 2 into another table and entries starting with 3 into another table. Please note that the numbers 1, 2 and 3 ,I have given as an example. They might be different at runtime.
    thanks
    sankar

    hi sankar,
    what you can do is just create a structure of destination internal table and LOOP on the present internal table and code FOR ON CHANGE
    TYPES: BEGIN OF x_stru_dyn,
                END OF x_stru_dyn.
    LOOP AT itab into wa.      "source internal table
        ON CHANGE OF wa-keyfield.
                 create new internal table of x_stru_dyn TYPE and refer it by Field symbol.
        ENDON.
        write code for filling the data from <b>wa</b> to new internal table using field symbol 
    ENDLOOP.
    give points if useful.
    Regards,
    Sachin.

  • Error occured in  moving internal tables

    Hi  i have a doubt in internal tables
    Actually i have created a internal table(rtab_alv ) for the output in the format of alv grid and after that i had created another internal table as iznew1 in which i had transfered all the values of a database view(znew1)  into that internal table iznew1 after that while i was trying to move the values of iznew1 to rtab_alv its not accepting it was showing an error  as
    <b>rtab_alv and iznew1 are not mutually convertible in a unicode program</b>
    so can u explain me what is the possible error in this and how to resolve it
    solution will be rewarded points

    Hi Mr. Sadiqui
    By following your procedure an error has occured as
    below field are coming from database view and i m passing view data into iznew1
    fields of iznew1
                 LIFNR  LIKE EKKO-LIFNR,
                 EBELN  LIKE EKKO-EBELN,
                 VGABE  LIKE EKBE-VGABE,
                 EBELP  LIKE EKBE-EBELP,
                 BELNR  LIKE EKBE-BELNR,
                 MATNR  LIKE EKPO-MATNR,
                 TXZ01  LIKE EKPO-TXZ01,
            PS_PSP_PNR  LIKE EKKN-PS_PSP_PNR,
                 KOSTL  LIKE EKKN-KOSTL,
                 NAME1  LIKE LFA1-NAME1,
                 NAME2  LIKE LFA1-NAME2,
                 WERKS  LIKE EKPO-WERKS,
                 NETWR  LIKE EKPO-NETWR,
                 KNUMV  LIKE EKKO-KNUMV,
                 GJAHR  LIKE EKBE-GJAHR,
    and now i want to pass
    one field ED1  which i hase calculated separatly and i want to pass this value into iznew1
    but error is coming that iznew1 is a table with out header line  has no component like ED1.
    so how can i pass calculated value to internal table iznew1,

  • Data populated in internal Table its not diplay in result

    Hi ABAPers,
                         i have one doubt in internal table one field data is populated but in result its diplayed. can  any one tell me the solution for this
    regards,
    kishore.

    hi this is a simple report on internal table.
    REPORT  zvenkattest0.
    TABLES:pa0002,pa0008.
    data:begin of it_pa0002 occurs 0,
         pernr like pa0002-pernr,
         begda like pa0002-begda,
         endda like pa0002-endda,
         vorna like pa0002-vorna,
         nachn like pa0002-nachn,
         end of it_pa0002.
    SELECT-OPTIONS: S_pernr FOR pa0002-pernr.
    START-OF-SELECTION.
      SELECT pernr
             begda
             endda
             vorna
             nachn
             FROM pa0002
             INTO  TABLE IT_pa0002
             WHERE pernr IN S_pernr.
    sort it_pa0002 by pernr begda descending.
    loop at it_pa0002.
    write:/ it_pa0002-pernr,
            it_pa0002-begda,
            it_pa0002-endda,
            it_pa0002-vorna,
            it_pa0002-nachn.
    endloop.
    reward points if useful,
    venkat.

  • Re : Internal table

    Hi all,
    I have one doubt in internal table.
    My code as follows ;
    types : begin of ty,
               vbeln type vbak-vbeln,
               ernam type vbak-ernam,
               netwr type vbak-netwr,
               end of ty.
    data : itab type table of ty,
             wa type ty
             itab1 like itab.
    select vbeln ernam netwr from vbak into table itab up to 10 rows.
    loop at itab into wa.
    write : wa-vbeln,wa-ernam,wa-netwr.
    endloop.
    move itab to itab1.
    loop at itab1.
    write :/ itab1-vbeln,itab1-ernam,itab1-netwr.
    endloop.
    when I check the above .The error message will show itab1 has no header-line and therefore no vbeln.
    My question is, How can I get data from Itab1.
    thanks in advance,
    raghul.

    >
    raghul kanna wrote:
    > Hi all,
    >
    > I have one doubt in internal table.
    >
    > My code as follows ;
    >
    > types : begin of ty,
    >            vbeln type vbak-vbeln,
    >            ernam type vbak-ernam,
    >            netwr type vbak-netwr,
    >            end of ty.
    >
    > data : itab type table of ty,
    >          wa type ty
    >          itab1 like itab.
    >
    > select vbeln ernam netwr from vbak into table itab up to 10 rows.
    >
    > loop at itab into wa.
    > write : wa-vbeln,wa-ernam,wa-netwr.
    > endloop.
    >
    > move itab to itab1.
    >
    > loop at itab1.
    >
    > write :/ itab1-vbeln,itab1-ernam,itab1-netwr.
    >
    > endloop.
    >
    > when I check the above .The error message will show itab1 has no header-line and therefore no vbeln.
    >
    > My question is, How can I get data from Itab1.
    >
    > thanks in advance,
    >
    > raghul.
    u r getting the error because u have not defined any header line or explicit work area.
    for example there are 2 ways doing it
    data: itab1 type standard table of ty with header line.
    or
    data: itab1 type standard table of ty,
            wa1  like line of itab1.
    and while looping
    loop at itab1 into wa1.
    so u r code should be modified as
    types : begin of ty,
              vbeln type vbak-vbeln,
                ernam type vbak-ernam,
                netwr type vbak-netwr,
                end of ty.
    data : itab type table of ty,
              wa type ty
              itab1 like itab,
             wa1 like line of itab1.
    select vbeln ernam netwr from vbak into table itab up to 10 rows.
    loop at itab into wa.
    write : wa-vbeln,wa-ernam,wa-netwr.
    endloop.
    move itab to itab1.
    loop at itab1 into wa1.
    write :/ wa1-vbeln,wa1-ernam,wa1-netwr.
    endloop.

  • Doubts with control break statements on internal table loops (AT/ENDAT)

    Hi, i've had a couple of doubts for a long while which I hope someone can clarify today:
    1) I know how to use the AT statements, however, i'm not sure I get correctly what this part of help regarding this commands means:
    <i>"The control level structure with internal tables is static. It corresponds exactly to the sequence of columns in the internal table (from left to right). In this context, the criteria according to which you sort the internal table are unimportant."</i>
    I've always sorted the internal table before the control break and it works that way. For example:
    SORT ITAB BY EBELN EBELP.
    LOOP AT ITAB.
      AT NEW EBELN.
    *   Code for the order header
      ENDAT.
    ENDLOOP.
    If I <b>don't</b> sort the internal table, it doesn't work! (i get dupplicated processing). In the example, if i have more than one register with the same EBELN and they're not consecutive, the header gets processed twice. I really don't get that part of the help text.
    2) I know this: <i>"At the start of a new control level (i.e. immediately after AT), the following occurs in the output area of the current LOOP statement:
    All character type fields (on the right) are filled with "*" after the current control level key.
    All other fields (on the right) are set to their initial values after the current control level key."</i>
    My doubt is: WHY is that this way? Because sometimes (most times) I need those fields INSIDE the statement! So when that happened i've solved it in one of three ways:
    LOOP AT ITAB INTO WA_ITAB.
      WA_ITAB_AUX = WA_ITAB.
      AT NEW FIELD.
        WA_ITAB = WA_ITAB_AUX.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    LOOP AT ITAB INTO WA_ITAB.
      AT NEW FIELD.
        READ TABLE ITAB INDEX SY-TABIX INTO WA_ITAB.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    * (Without AT)
    LOOP AT ITAB INTO WA_ITAB.
      IF WA_ITAB-FIELD <> FIELD_AUX.
        FIELD_AUX = WA_ITAB_FIELD.
    *   ...Rest of the code for the first register
      ENDIF.
    ENDLOOP.
    Is there any problem with this way of coding? Can be done better?
    Thank you very much in advance.

    Hi..,
    1)
    See if u sort the table on a field on which u r using AT ENDAT .. then all the records which are having the same value for that field will form a group or those reocrds will be at one place.. so when u sort the table for all the records  AT ENDAT  will get executed onli once..
    If u dont sort this table on this field then all these records will be at different places and in between there may be records with different value for this field.. so this AT ENDAT will get executed for each record !!
    2)
    No u cannot use the Right hand fields of the field in the table .. Because these AT events work as Group based operations... So till that field on which AT ENDAT is working it breaks that record into two groups.. One is the left hand fields including that field.. and right hand fields as another group.. and makes the right hand group as stars ****.  Thats y u can observe that even any one field in the left hand group changes the AT ENDAT will get executed  !!!!
    Hope u understood !!!
    regards,
    sai ramesh

  • Internal Table Doubt!!!

    Hi!
       I ve doubt on the following,
    1) Data: Begin of itab occurs 10
                  ......, end of itab.
        In the above what will happen if i store records more than 10 & less than 10 records
    if more than 10 where records will be stored .
    if i store 5 then whats the remaining storage space.
    2)  Types of internal Table
         SOrted, Hashed, index, standard
        Can u pls explain  in short terms(i dont want big details) good understanding
         which one from above improve performance
    3)  see this,
         types: begin of ty_itab occurs 0,
                   mara like mara-matnr.
                   end of ty_itab,
                   ty_t_itab type standard table of ty_itab with default key.
    Data:  it_itab type ty_t_itab.
              it_itab2 like it_itab
              or it_itab2 type ty_t_itab.
      i want to know,
          ty_t_itab is an internal table with header line or not
         it_itab, it_itab2 has header line or not
      Pls reply guys, looking for your reply.
    Thanks  In Advance.
    Rahul.

    Hi,
    <b>if more then 10 then records will be stored in the table itself
    if less than 10 then space willbe reserved for 10 records</b>
    <b>Standard Tables:</b>
    Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
    This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to
    the number of table entries.
    <b>Sorted Tables:</b>
    Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.
    This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of
    table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
    <b>Hashed Tables:</b>
    Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
    This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
    using internal tables that are similar to database tables.
    <b>it_itab, it_itab2 has header line</b>
    Regards,
    ravish
    plz dont forget to reward points if useful

  • Reg:doubt in dynamic generated internal table

    hi everyone,
                 i generated a internal table dynamically,the output is in fied symbol,i want to create a internal table using the field symbol sturture,how to create that????
    plz tell me how to create a internal table referencing field symbol structure........
    very urgent plz help.........
    thanks in advance....
    regards,
    balaji.s

    Hi ,
           check out   a small part of an alv report which is using dynamic internal table
    data: dy_table type ref to data,
          dy_line type ref to data.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa> type any,
                   <dyn_line> type any.
        call method cl_alv_table_create=>create_dynamic_table
          exporting
            it_fieldcatalog = ifc
          importing
            ep_table        = dy_table.
        assign dy_table->* to <dyn_table>.
    CREATE A DYNAMIC WORK AREA.
        create data dy_line like line of <dyn_table>.
        sort it_mard by matnr werks.
        loop at it_mard into wa_mard.
          at new matnr.
            assign dy_line->* to <dyn_wa>.
            assign component 'MATNR' of structure <dyn_wa> to <dyn_line>.
            <dyn_line> = wa_mard-matnr.
            read table it_mard2 into wa_mard1 with key matnr = wa_mard-matnr.
            v_amount = wa_mard1-v_total * p_unit.
            call function 'SPELL_AMOUNT'
              exporting
                amount = v_amount
           currency        = 'INR'
      FILLER          = ' '
            language        = sy-langu
          importing
            in_words        = v_price
          exceptions
            not_found       = 1
            too_large       = 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.
            assign component 'V_TOTAL' of structure <dyn_wa> to <dyn_line>.
            <dyn_line> = wa_mard1-v_total.
            assign component 'V_PRICE' of structure <dyn_wa> to <dyn_line>.
            <dyn_line> = v_price-word.
          endat.
          concatenate 'STOCK' '-' 'IN' '-' wa_mard-werks into v_new.
          assign component v_new of structure <dyn_wa> to <dyn_line>.
          <dyn_line> = wa_mard-labst.
          at end of matnr.
            append <dyn_wa> to <dyn_table>.
            clear wa_mard.
            clear <dyn_wa>.
            unassign <dyn_line>.
            unassign <dyn_wa>.
          endat.
        endloop.
    rewards points if helpful.

Maybe you are looking for

  • Why wont Photoshop elements 12 save to DVD in MPEG2 format when I have Premiere Elements 12 package loaded onto pc also?

    I purchased the Adobe Photoshop Elements and Premiere Elements 12 package at Best Buy.  I created a slideshow within the Photoshop Elements Package.  When finished, I tried to save it using the instructions noted within the Help section of the Photos

  • FlashPlayer 10.6 Plugin Crashes Safari

    MacBook Pro, OS 10.6.7 FlashPlayer 10.6 is constantly crashing the Safari (5.0.5) browser. Each time I get the following message: Problem Report for Safari Safari quit unexpectedly while using the FlashPlayer-10.6 plugin. Any information how to fix t

  • PHP 5.0.4, php apps and zip file problems

    I use various opensource web apps that allow for files to be uploaded in zip format. The app then unzips the files and does what it needs to do with them. ie: Gallery2 uploading photos that are zipped up and placing the enclosed photos into the galle

  • Autosubmit in input text changing other fields

    Hi, I have an af:inputText set to autosubmit. When it gets called it is changing the value of an already set selectonechoice to null. This is causing some major issues in usability. Is this normal behavior? I am using JDeveloper 11.1.1.6 Here is what

  • CS4 ACR problem

    Received and installed CS4 tonite. Disc wouldn't open automatically, so I had to copy to the desktop and install from there! Oh, well, that went, OK, I think. When in Bridge, trying to enter Camera Raw Preferences, or clicking on the round 'open in A