Internal table and work area

Hi,
       can anybody explain the concepts of Internal table and work area.Thanks in advance.

hai,
This may help u.
WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.
Each row in a table is a record and each column is a field.
While adding or retrieving records to / from internal table we have to keep the record temporarily.
The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
e.g.
data: begin of itab occurs 10,
ab type c,
cd type i,
end of itab. " this table will have the header line.
data: wa_itab like itab. " explicit work area for itab
data: itab1 like itab occurs 10. " table is without header line.
Internal tables are used for storing records which are obtained as a result when we use select statement on database. internal tables are run time entities and doesn't occupy any memory. they are dynamic.
internal tables are of types.
1. internal tables with header line. [header and body]
2. internal tables with out header line. [only body]
Workarea is the concept which is mainly useful when working with internal tables with out header line.
at any point of time we can access only one record through header of a internal table. every thing should be done [inserting,modifying, reading ] through header only.
ex: data: itab like standard table of mara with header line.
for internal tables with out header line we will create a work area [explicit header] as type of table for storing data into internal table.
ex: data: itab like mara,
wa like mara.
more about internal table types:
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.).
Hashed tables
This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index.
The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always
have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for
processing large amounts of data.
TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.
TYPES: BEGIN OF LINE,
COLUMN1 TYPE I,
COLUMN2 TYPE I,
COLUMN3 TYPE I,
END OF LINE.
DATA ITAB TYPE HASHED TABLE OF SPFLI
WITH UNIQUE KEY CARRID CONNID.
with regards,
B.Sowjanya,
reward points if helpful.

Similar Messages

  • Internal table declaration - work area and body

    Hi all
    I have declared my internal table in my program as
    data : itab_wa type ZRESULT_LINE,
           itab    type ZRESULT_ROW.
    Where ZRESULT_LINE and ZRESULT_ROW are the structure and table types.
    Now I want to add
    data: TCOLOR TYPE SLIS_T_SPECIALCOL_ALV.
    in my internal table declaration. How can I do this. Please remember I need to have work area and body in my internal table as I have used work area and body in my code.
    Waiting..............
    Message was edited by: Raju Boda

    HI,
    See the Declarion types of workarea and Internal tables
    * Table declaration (old method)
    DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
    END OF tab_ekpo.
    *Table declaration (new method)     "USE THIS WAY!!!
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
          wa_ekpo TYPE t_ekpo.                    "work area (header line)
    * Build internal table and work area from existing internal table
    DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
          wa_datatab LIKE LINE OF tab_ekpo.
    * Build internal table and work area from existing internal table,
    * adding additional fields
    TYPES: BEGIN OF t_repdata.
            INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
    TYPES: bukrs  TYPE ekpo-werks,
           bstyp  TYPE ekpo-bukrs.
    TYPES: END OF t_repdata.
    DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
          wa_repdata TYPE t_repdata.                 "work area (header line
    you need to maintain same structure for both workarea as well Internal table
    Regards
    Sudheer

  • Structure of table and work area are not compatible - table control wizard

    Structure of table and work area are not compatible is the error i am getting when specifying my internal table and work area in my table control?  What am I doing wrong?

    hii
    this error comes when you have different structure of work area then internal table..so work area will not work here and you will not be able to append records in internal table.
    check strucure of internal table and work area.it should be like below.
    TYPES:
      BEGIN OF type_s_kna1,
         kunnr LIKE kna1-kunnr,            " Customer Number
         name1 LIKE kna1-name1,            " Name
         vbeln LIKE vbap-vbeln,            " Sales Document
      END OF type_s_kna1.
    * Internal Table And Work Area Declarations For Customer Details      *
      DATA : t_kna1 TYPE STANDARD TABLE OF type_s_kna1,
             fs_kna1 TYPE type_s_kna1.
    regards
    twinkal

  • The type of the database table and work area (or internal table)...

    Hello
    I am trying to use a database and select all records from it and store them into an internal table.
    My code:
    Select * from xixi_dbcurrency into table gt_currency.
    The error:
    "The type of the database table and work area (or internal table) "GT_CURRENCY" are not Unicode-convertible . . . . . . . . . .     "
    Any suggestions?
    Thank you

    Hi Thomas,
    Thank you for your inputs above.
    But as you suggested is we use INTO CORRESPONDING FIELDS OF TABLE then it resolve the error.
    But I have below piece of code:
    DATA:    it_new_source TYPE STANDARD TABLE OF _ty_s_sc_1,
                  wa_source TYPE _ty_s_sc_1,
                  wa_new_source TYPE _ty_s_sc_1,
                  ls_target_key TYPE t_target_key.
    SELECT * INTO CORRESPONDING FIELDS OF TABLE it_new_source
           FROM /bic/afao06pa100
           FOR ALL ENTRIES IN SOURCE_PACKAGE
           where /bic/fcckjobno = SOURCE_PACKAGE-/bic/fcckjobno
           and /bic/fcckjitid = SOURCE_PACKAGE-/bic/fcckjitid.
    But since this is reading into corresponding fields of table the data load from one DSO to other DOS is running for long more that 15 hours and still not getting completed and giving dump.
    So if I switch the search to below:
    SELECT * FROM /bic/afao06pa100
       INTO TABLE it_new_source
           FOR ALL ENTRIES IN SOURCE_PACKAGE
           where /bic/fcckjobno = SOURCE_PACKAGE-/bic/fcckjobno
           and /bic/fcckjitid = SOURCE_PACKAGE-/bic/fcckjitid.
    Then I am getting below error:E:The type of the database table and work area (or internal table) "IT_NEW_SOURCE" are not Unicode convertible.
    Can you please advice on this, as performance need to improve in start routine code.
    Thank You.

  • Get the fieldnames of a generic internal table or work area

    Hi All,
           I have one generic work area which I have created in the below manner...
    * ET_DATA itself is a generic table of type ANY...can have any internal table data in it.
    * Create dynamic internal table
      CREATE DATA lv_new_table LIKE et_data.
      ASSIGN lv_new_table->* TO <fs_dyn_table>.
    * Create dynamic work area and assign to fieldsymbol.
      CREATE DATA lv_new_line LIKE LINE OF <fs_dyn_table>.
      ASSIGN lv_new_line->*   TO <fs_dyn_wa>.
    Now...I need to get the field names of this dynamic internal table or work area..
    I have already searched in forum...got many answers..but none them gives me the output.
    Please note that I require the field names and not field position..
    Awaiting your suggestions on how to get field names of this dynamic work area...

      create data wa_ref like line of it_data.
      assign wa_ref->* to <p_data>.
      desc_table ?= cl_abap_tabledescr=>describe_by_data( it_data ).
      desc_struc ?= desc_table->get_table_line_type( ).
      describe field <p_data> type rtty components ncom.
    This one is working in our environment without any error. it_data is an importing parameter in the signature of a method of type any table.

  • The type of the database table and work area are not Unicode convertible

    ***Data declaration
    TYPES : BEGIN OF t_zle_lagerplanung,
                       SEl, "stores which row user has selected
                       kdauf TYPE zle_lagerplanung-kdauf,
                       kdpos TYPE zle_lagerplanung-kdpos,
                       etenr TYPE zle_lagerplanung-etenr,
                       papiermaschine TYPE zle_lagerplanung-papiermaschine,
                       runnr TYPE zle_lagerplanung-runnr,
                       prio TYPE zle_lagerplanung-prio,
                       werk TYPE zle_lagerplanung-werk,
                       durchmesser TYPE zle_lagerplanung-durchmesser,
                       breite TYPE zle_lagerplanung-breite,
                       anzle TYPE zle_lagerplanung-anzle,
                       lgpla TYPE zle_lagerplanung-lgpla,
                       lgtyp TYPE zle_lagerplanung-lgtyp,
                       art TYPE zle_lagerplanung-art,
                       anzhoehe TYPE zle_lagerplanung-anzle,
                       fa TYPE zle_lagerplanung-fa,
    END OF t_zle_lagerplanung.
    DATA : it_zle_lagerplanung TYPE STANDARD TABLE OF t_zle_lagerplanung INITIAL SIZE 0,
                wa_zle_lagerplanung TYPE t_zle_lagerplanung.
    Here I am getting the data in internal table by using thiis select statement.
    SELECT kdauf kdpos etenr papiermaschine runnr prio werk durchmesser breite
                  anzle lgpla lgtyp art anzhoehe fa
    FROM    zle_lagerplanung INTO CORRESPONDING FIELDS OF TABLE it_zle_lagerplanung
    WHERE  kdauf IN s_kdauf
    AND       KDPOS IN s_kdpos
    AND      werk = p_werks.
    But while updating the particular field in zle_lagerplanung using this statement
    UPDATE zle_lagerplanung from table it_zle_lagerplanung.
    it is giving syntax error
    "The type of the database table and work area (or internal table)
    "IT_ZLE_LAGERPLANUNG" are not Unicode convertible. "
    Could any one help me out how to resolve this problem....
    Thanks in advance

    Dear Shayamal,
    XXX....are not Unicode convertible
    This  error comes while inserting or updating database and the fields are not matching between  data base table and structure .
    Check you fields of data base table and  "zle_lagerplanung" and struture "it_zle_lagerplanung" . There fields must match.
    thanks and regrds,
    Anup Banerjee

  • I need insert /update/modify  ztable from  internal table or work area

    I have one simple problem.
    TYPES: BEGIN OF t_account,
            acc_no          LIKE zztaccountheader-acc_no,
            cust_id         LIKE zztaccountheader-cust_id,
            acc_type        LIKE zztaccountheader-acc_type,
            od_option       LIKE zztaccountheader-od_option,
            od_limit        LIKE zztaccountheader-od_limit,
            od_issue_date   LIKE zztaccountheader-od_issue_date,
            END OF t_account.
    data: lwa_account TYPE  t_account,
         li_account TYPE STANDARD TABLE OF t_account,
    bu scerrin i am inputing data :
    i want modify updare or insert record into ztable by work area  i put following thing
    MOVE : zztaccountheader-acc_no        TO lwa_account-acc_no,
               zztcustomer-cust_id            TO lwa_account-cust_id,
               zztaccountheader-acc_type      TO lwa_account-acc_type,
               zztaccountheader-od_option     TO lwa_account-od_option,
               zztaccountheader-od_limit      TO lwa_account-od_limit,
               zztaccountheader-od_issue_date TO lwa_account-od_issue_date.
        INSERT   zztaccountheader CLIENT SPECIFIED FROM lwa_account .
        CLEAR lwa_account.
      ENDIF.
    i am etting error
    The type of the database table and work area (or internal table)
    "LWA_ACCOUNT" are not Unicode convertible.
    please solve it

    hi,
    decalre like this.
    tables : zztaccountheader.
    data : t_account like zztaccountheader occurs 0 with header line.
    data: lwa_account TYPE t_account,
    li_account TYPE STANDARD TABLE OF t_account,
    MOVE : zztaccountheader-acc_no TO lwa_account-acc_no,
    zztcustomer-cust_id TO lwa_account-cust_id,
    zztaccountheader-acc_type TO lwa_account-acc_type,
    zztaccountheader-od_option TO lwa_account-od_option,
    zztaccountheader-od_limit TO lwa_account-od_limit,
    zztaccountheader-od_issue_date TO lwa_account-od_issue_date.
    INSERT zztaccountheader CLIENT SPECIFIED FROM lwa_account .
    CLEAR lwa_account.
    ENDIF.
    rgss
    anver
    if hlped mark points

  • Internal table with work area

    hi all,
    data: BEGIN OF it_summ OCCURS 0.
      INCLUDE STRUCTURE yapn_summary.
      data: END OF it_summ.
    data : wa_demo1 type yapn_summary.
    clear wa_demo1.
            wa_demo1-sumr = 'hai'.
    append wa_Demo1 to it_summ.
    WRITE: it_summ-sumr.
    its not get output..
    i want to display for hai using it_summ.
    donot use work area.
    how to change it.?
    reply me soon,
    s.suresh.

    You can't write out an internal table - you can only write out a line (or components of a line) of an internal table.  So you MUST use a work area.  If you use OCCURS 0 then you've a table with a headerline, and so don't need a workarea.  However, later versions of ABAP discourage tables with headerline, and it is preferred to define a specific work area.  So, either:
    data: BEGIN OF it_summ OCCURS 0.
    INCLUDE STRUCTURE yapn_summary.
    data: END OF it_summ.
    clear it_summ.
    it_summ-sumr = 'hai'.
    append wa_Demo1 to it_summ.
    LOOP AT it_summ.
      WRITE: it_summ-sumr.
    ENDLOOP.
    Now, you see here that at some points it_summ refers to the table, and at others to the header-line.  This is ambiguous, and therefore BAD.  It's better to define the table and work area seperately.
    data: it_summ TYPE STANDARD TABLE OF yapn_summary WITH NON-UNIQUE KEY table_line.
    data : wa_demo1 type yapn_summary.
    clear wa_demo1.
    wa_demo1-sumr = 'hai'.
    append wa_Demo1 to it_summ.
    LOOP AT it_summ INTO wa_demo1.
      WRITE: wa_demo1-sumr.
    ENDLOOP.
    matt

  • Smartform Table; Internal table to work area

    Hi,
    I have created smartform with one table,in that internal table values are not moving into workarea,can anyone solve my issue.

    Hi Bose,
    If you are populating internal table values in progarm and passing this internal table to smartforms
    here is the syntax and declaration to follow
    data : itab_final type standard table of type_final (some type) with header line .
    Pass this under tables in your Z program,
    CALL FUNCTION  'smartform name'
           EXPORTING
              archive_index      = toa_dara
              archive_parameters = arc_params
              vbdkl              = vbdkl
              vbdpl              = vbdpl
              makt               = makt
              qals               = qals
              vbco3              = vbco3
            TABLES
              g_final            = g_final
            EXCEPTIONS
              FORMATTING_ERROR   = 1
              INTERNAL_ERROR     = 2
              SEND_ERROR         = 3
              USER_CANCELED      = 4
              OTHERS             = 5.
    In Smartforms,
    Declare this internal table in form interface under tables as,
    G_FINAL     TYPE     Z_TT_FINAL_COA(table type)
    And work area in global data as,
    WA_G_FINAL     TYPE     ZFINAL_COA (structure)
    Now it can be used used in table control  under data column as
    G_FINAL          INTO                  WA_G_FINAL
    Regards,
    Sagar.

  • Table and Work Area option

    Using se16, I am opening a certain database table and it is asking me for the "work area".
    What I would like to do is, I want to see the data of VN_TNAPR (or any table) regardless of work area and all at the same time on one screen/table. I have lots of table that ask for that work area.
    How to solve this? Any tcode?
    see image: http://i1104.photobucket.com/albums/h336/809836724/sd/databrowserAug172011-2x.jpg

    Hai Anwar,
    In our system when i run with BLANK
    All fields which define the
    area have initial values.
    Check Input Values
    Click continue
    But no output data came in the Table.
    Could you please share for what requirement you are using this Table.
    Regards,
    Mani

  • Error: you cannot create an internal table as work area

    Hi, My code is as follows and when i perform a check it gives the above mentioned error in the select statement.
    TYPES: BEGIN OF t_vbrk,
            vbeln            TYPE vbrk-vbeln,
            vtweg            TYPE vbrk-vtweg,
          END OF t_vbrk.
    DATA vbrktab TYPE TABLE OF t_vbrk.
    SELECT      vbeln
                    vtweg
             FROM   vbrk
             INTO  vbrktab
             FOR ALL ENTRIES IN xxcvb
             WHERE  vbeln       = xxcvb-vbeln.
          INSERT TABLE vbrktab.
        ENDSELECT.
    where xxcvb is another internal table with some key values.

    Hi
    I don't know how you've defined XXCVB, but u should write:
    TYPES: BEGIN OF T_VBRK,
             VBELN TYPE VBRK-VBELN,
             VTWEG TYPE VBRK-VTWEG,
           END OF T_VBRK.
    DATA: VBRKTAB    TYPE TABLE OF T_VBRK,
          WA_VBRKTAB TYPE T_VBRK.
    SELECT VBELN VTWEG FROM VBRK INTO TABLE VBRKTAB
      FOR ALL ENTRIES IN XXCVB
         WHERE VBELN = XXCVB-VBELN.
    LOOP AT VBRKTAB INTO WA_VBRKTAB.
    ENDLOOP.
    Max

  • Internal Table and Structures

    Hi,
    I am a beginer. I know how to create a structure and how to create an internal table using ABAP/4. My problem is, i don't understand where to use internal table and structure, also i find myself very confused about the explicit work areas.
    Plese someone show me a program by explaining all of this clearly.

    Hi
    Internal tables are the core of ABAP. They are like soul of a body. For any program we use
    internal tables extensively. We can use Internal tables like normal data base tables only, but the
    basic difference is the memory allocated for internal tables is temporary. Once the program is
    closed the memory allocated for internal tables will also be out of memory.
    But while using the internal tables, there are many performance issues to be considered. i.e which
    type of internal table to be used for the program..like standard internal table, hashed internal
    table or sorted internal table etc..
    Internal tables
    Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. The data is stored line by
    line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data
    objects, they save the programmer the task of dynamic memory management in his or her programs. You should use internal tables
    whenever you want to process a dataset with a fixed structure within a program. A particularly important use for internal tables is for
    storing and formatting data from a database table within a program. They are also a good way of including very complicated data
    structures in an ABAP program.
    Like all elements in the ABAP type concept, internal tables can exist both as data types and as data objects A data type is the abstract
    description of an internal table, either in a program or centrally in the ABAP Dictionary, that you use to create a concrete data object. The
    data type is also an attribute of an existing data object.
    Internal Tables as Data Types
    Internal tables and structures are the two structured data types in ABAP. The data type of an internal table is fully specified by its line type,
    key, and table type.
    Line type
    The line type of an internal table can be any data type. The data type of an internal table is normally a structure. Each component of the
    structure is a column in the internal table. However, the line type may also be elementary or another internal table.
    Key
    The key identifies table rows. There are two kinds of key for internal tables - the standard key and a user-defined key. You can specify
    whether the key should be UNIQUE or NON-UNIQUE. Internal tables with a unique key cannot contain duplicate entries. The uniqueness
    depends on the table access method.
    If a table has a structured line type, its default key consists of all of its non-numerical columns that are not references or themselves
    internal tables. If a table has an elementary line type, the default key is the entire line. The default key of an internal table whose line type
    is an internal table, the default key is empty.
    The user-defined key can contain any columns of the internal table that are not references or themselves internal tables. Internal tables
    with a user-defined key are called key tables. When you define the key, the sequence of the key fields is significant. You should remember
    this, for example, if you intend to sort the table according to the key.
    Table type
    The table type determines how ABAP will access individual table entries. Internal tables can be divided into three types:
    Standard tables have an internal linear index. From a particular size upwards, the indexes of internal tables are administered as trees. In
    this case, the index administration overhead increases in logarithmic and not linear relation to the number of lines. The system can access
    records either by using the table index or the key. The response time for key access is proportional to the number of entries in the table.
    The key of a standard table is always non-unique. You cannot specify a unique key. This means that standard tables can always be filled
    very quickly, since the system does not have to check whether there are already existing entries.
    Sorted tables are always saved sorted by the key. They also have an internal index. The system can access records either by using the
    table index or the key. The response time for key access is logarithmically proportional 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. When you define the table, you must specify whether
    the key is to be unique or not. Standard tables and sorted tables are known generically as index tables.
    Hashed tables have no linear index. You can only access a hashed table using its key. The response time is independent of the number of
    table entries, and is constant, since the system access the table entries using a hash algorithm. The key of a hashed table must be unique.
    When you define the table, you must specify the key as UNIQUE.
    Generic Internal Tables
    Unlike other local data types in programs, you do not have to specify the data type of an internal table fully. Instead, you can specify a
    generic construction, that is, the key or key and line type of an internal table data type may remain unspecified. You can use generic
    internal tables to specify the types of field symbols and the interface parameters of procedures . You cannot use them to declare data
    objects.
    Internal Tables as Dynamic Data Objects
    Data objects that are defined either with the data type of an internal table, or directly as an internal table, are always fully defined in
    respect of their line type, key and access method. However, the number of lines is not fixed. Thus internal tables are dynamic data objects,
    since they can contain any number of lines of a particular type. The only restriction on the number of lines an internal table may contain are
    the limits of your system installation. The maximum memory that can be occupied by an internal table (including its internal administration)
    is 2 gigabytes. A more realistic figure is up to 500 megabytes. An additional restriction for hashed tables is that they may not contain more
    than 2 million entries. The line types of internal tables can be any ABAP data types - elementary, structured, or internal tables. The
    individual lines of an internal table are called table lines or table entries. Each component of a structured line is called a column in the
    internal table.
    Choosing a Table Type
    The table type (and particularly the access method) that you will use depends on how the typical internal table operations will be most
    frequently executed.
    Standard tables
    This is the most appropriate type if you are going to address the individual table entries using the index. Index access is the quickest
    possible access. You should fill a standard table by appending lines (ABAP APPEND statement), and read, modify and delete entries by
    specifying the index (INDEX option with the relevant ABAP command). The access time for a standard table increases in a linear relationship
    with the number of table entries. If you need key access, standard tables are particularly useful if you can fill and process the table in
    separate steps. For example, you could fill the table by appending entries, and then sort it. If you use the binary search option with key
    access, the response time is logarithmically proportional to the number of table entries.
    Sorted tables
    This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERT statement. Entries
    are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add
    them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always
    uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the
    table key in the WHERE condition.
    Hashed tables
    This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index.
    The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always
    have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for
    processing large amounts of data.
    Creating Internal Tables
    Like other elements in the ABAP type concept, you can declare internal tables as abstract data
    types in programs or in the ABAP Dictionary, and then use them to define data objects.
    Alternatively, you can define them directly as data objects. When you create an internal table as a
    data object, you should ensure that only the administration entry which belongs to an internal
    table is declared statically. The minimum size of an internal table is 256 bytes. This is important if an
    internal table occurs as a component of an aggregated data object, since even empty internal
    tables within tables can lead to high memory usage. (In the next functional release, the size of the
    table header for an initial table will be reduced to 8 bytes). Unlike all other ABAP data objects, you
    do not have to specify the memory required for an internal table. Table rows are added to and
    deleted from the table dynamically at runtime by the various statements for adding and deleting
    records.
    You can create internal tables in different types.
    You can create standard internal table and then make it sort in side the program.
    The same way you can change to hashed internal tables also.
    There will be some performance issues with regard to standard internal tables/ hashed internal
    tables/ sorted internal tables.
    Internal table types
    This section describes how to define internal tables locally in a program. You can also define internal tables globally as data types in the
    ABAP Dictionary.
    Like all local data types in programs , you define internal tables using the TYPES statement. If you do not refer to an existing table type
    using the TYPE or LIKE addition, you can use the TYPES statement to construct a new local internal table in your program.
    TYPES <t> TYPE|LIKE <tabkind> OF <linetype> [WITH <key>]
    [INITIAL SIZE <n>].
    After TYPE or LIKE, there is no reference to an existing data type. Instead, the type constructor occurs:
    <tabkind> OF <linetype> [WITH <key>]
    The type constructor defines the table type <tabkind>, the line type <linetype>, and the key <key> of the internal table <t>.
    You can, if you wish, allocate an initial amount of memory to the internal table using the INITIAL SIZE addition.
    Table type
    You can specify the table type <tabkind> as follows:
    Generic table types
    INDEX TABLE
    For creating a generic table type with index access.
    ANY TABLE
    For creating a fully-generic table type.
    Data types defined using generic types can currently only be used for field symbols and for interface parameters in procedures . The generic
    type INDEX TABLE includes standard tables and sorted tables. These are the two table types for which index access is allowed. You cannot
    pass hashed tables to field symbols or interface parameters defined in this way. The generic type ANY TABLE can represent any table. You
    can pass tables of all three types to field symbols and interface parameters defined in this way. However, these field symbols and
    parameters will then only allow operations that are possible for all tables, that is, index operations are not allowed.
    Fully-Specified Table Types
    STANDARD TABLE or TABLE
    For creating standard tables.
    SORTED TABLE
    For creating sorted tables.
    HASHED TABLE
    For creating hashed tables.
    Fully-specified table types determine how the system will access the entries in the table in key operations. It uses a linear search for
    standard tables, a binary search for sorted tables, and a search using a hash algorithm for hashed tables.
    Line type
    For the line type <linetype>, you can specify:
    Any data type if you are using the TYPE addition. This can be a predefined ABAP type, a local type in the program, or a data type from the
    ABAP Dictionary. If you specify any of the generic elementary types C, N, P, or X, any attributes that you fail to specify (field length, number
    of decimal places) are automatically filled with the default values. You cannot specify any other generic types.
    Any data object recognized within the program at that point if you are using the LIKE addition. The line type adopts the fully-specified data
    type of the data object to which you refer. Except for within classes, you can still use the LIKE addition to refer to database tables and
    structures in the ABAP Dictionary (for compatibility reasons).
    All of the lines in the internal table have the fully-specified technical attributes of the specified data type.
    Key
    You can specify the key <key> of an internal table as follows:
    [UNIQUE|NON-UNIQUE] KEY <col1> ... <col n>
    In tables with a structured line type, all of the components <coli> belong to the key as long as they are not internal tables or references,
    and do not contain internal tables or references. Key fields can be nested structures. The substructures are expanded component by
    component when you access the table using the key. The system follows the sequence of the key fields.
    [UNIQUE|NON-UNIQUE] KEY TABLE LINE
    If a table has an elementary line type (C, D, F, I, N, P, T, X), you can define the entire line as the key. If you try this for a table whose line
    type is itself a table, a syntax error occurs. If a table has a structured line type, it is possible to specify the entire line as the key. However,
    you should remember that this is often not suitable.
    [UNIQUE|NON-UNIQUE] DEFAULT KEY
    This declares the fields of the default key as the key fields. If the table has a structured line type, the default key contains all non-numeric
    columns of the internal table that are not and do not contain references or internal tables. If the table has an elementary line type, the
    default key is the entire line. The default key of an internal table whose line type is an internal table, the default key is empty.
    Specifying a key is optional. If you do not specify a key, the system defines a table type with an arbitrary key. You can only use this to
    define the types of field symbols and the interface parameters of procedures . For exceptions, refer to Special Features of Standard Tables.
    The optional additions UNIQUE or NON-UNIQUE determine whether the key is to be unique or non-unique, that is, whether the table can
    accept duplicate entries. If you do not specify UNIQUE or NON-UNIQUE for the key, the table type is generic in this respect. As such, it can
    only be used for specifying types. When you specify the table type simultaneously, you must note the following restrictions:
    You cannot use the UNIQUE addition for standard tables. The system always generates the NON-UNIQUE addition automatically.
    You must always specify the UNIQUE option when you create a hashed table.
    Initial Memory Requirement
    You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following
    addition:
    INITIAL SIZE <n>
    This size does not belong to the data type of the internal table, and does not affect the type check. You can use the above addition to
    reserve memory space for <n> table lines when you declare the table object.
    When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each
    are then allocated.
    You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The
    space occupied, depending on the line width, is 16 <= <n> <= 100.
    It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and
    need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for
    deep-structured internal tables where the inner table only has a few entries (less than 5, for example).
    To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the
    length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB.
    Examples
    TYPES: BEGIN OF LINE,
    COLUMN1 TYPE I,
    COLUMN2 TYPE I,
    COLUMN3 TYPE I,
    END OF LINE.
    TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.
    The program defines a table type ITAB. It is a sorted table, with line type of the structure LINE and a unique key of the component
    COLUMN1.
    TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.
    TYPES: BEGIN OF LINE,
    COLUMN1 TYPE I,
    COLUMN2 TYPE I,
    COLUMN3 TYPE I,
    END OF LINE.
    TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.
    TYPES: BEGIN OF DEEPLINE,
    FIELD TYPE C,
    TABLE1 TYPE VECTOR,
    TABLE2 TYPE ITAB,
    END OF DEEPLINE.
    TYPES DEEPTABLE TYPE STANDARD TABLE OF DEEPLINE
    WITH DEFAULT KEY.
    The program defines a table type VECTOR with type hashed table, the elementary line type I and a unique key of the entire table line. The
    second table type is the same as in the previous example. The structure DEEPLINE contains the internal table as a component. The table
    type DEEPTABLE has the line type DEEPLINE. Therefore, the elements of this internal table are themselves internal tables. The key is the
    default key - in this case the column FIELD. The key is non-unique, since the table is a standard table.
    Internal table objects
    Internal tables are dynamic variable data objects. Like all variables, you declare them using the DATA statement. You can also declare static
    internal tables in procedures using the STATICS statement, and static internal tables in classes using the CLASS-DATA statement. This
    description is restricted to the DATA statement. However, it applies equally to the STATICS and CLASS-DATA statements.
    Reference to Declared Internal Table Types
    Like all other data objects, you can declare internal table objects using the LIKE or TYPE addition of the DATA statement.
    DATA <itab> TYPE <type>|LIKE <obj> [WITH HEADER LINE].
    Here, the LIKE addition refers to an existing table object in the same program. The TYPE addition can refer to an internal type in the
    program declared using the TYPES statement, or a table type in the ABAP Dictionary.
    You must ensure that you only refer to tables that are fully typed. Referring to generic table types (ANY TABLE, INDEX TABLE) or not
    specifying the key fully is not allowed (for exceptions, refer to Special Features of Standard Tables).
    The optional addition WITH HEADER line declares an extra data object with the same name and line type as the internal table. This data
    object is known as the header line of the internal table. You use it as a work area when working with the internal table (see Using the
    Header Line as a Work Area). When you use internal tables with header lines, you must remember that the header line and the body of the
    table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate
    this by placing brackets after the table name (<itab>[]). Otherwise, ABAP interprets the name as the name of the header line and not of the
    body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested
    in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.
    TYPES VECTOR TYPE SORTED TABLE OF I WITH UNIQUE KEY TABLE LINE.
    DATA: ITAB TYPE VECTOR,
    JTAB LIKE ITAB WITH HEADER LINE.
    MOVE ITAB TO JTAB. <- Syntax error!
    MOVE ITAB TO JTAB[].
    The table object ITAB is created with reference to the table type VECTOR. The table object JTAB has the same data type as ITAB. JTAB also
    has a header line. In the first MOVE statement, JTAB addresses the header line. Since this has the data type I, and the table type of ITAB
    cannot be converted into an elementary type, the MOVE statement causes a syntax error. The second MOVE statement is correct, since
    both operands are table objects.
    Declaring New Internal Tables
    You can use the DATA statement to construct new internal tables as well as using the LIKE or TYPE addition to refer to existing types or
    objects. The table type that you construct does not exist in its own right; instead, it is only an attribute of the table object. You can refer to
    it using the LIKE addition, but not using TYPE. The syntax for constructing a table object in the DATA statement is similar to that for defining
    a table type in the TYPES statement.
    DATA <itab> TYPE|LIKE <tabkind> OF <linetype> WITH <key>
    [INITIAL SIZE <n>]
    [WITH HEADER LINE].
    As when you define a table type , the type constructor
    <tabkind> OF <linetype> WITH <key>
    defines the table type <tabkind>, the line type <linekind>, and the key <key> of the internal table <itab>. Since the technical attributes of
    data objects are always fully specified, the table must be fully specified in the DATA statement. You cannot create generic table types (ANY
    TABLE, INDEX TABLE), only fully-typed tables (STANDARD TABLE, SORTED TABLE, HASHED TABLE). You must also specify the key and whether
    it is to be unique (for exceptions, refer to Special Features of Standard Tables).
    As in the TYPES statement, you can, if you wish, allocate an initial amount of memory to the internal table using the INITIAL SIZE addition.
    You can create an internal table with a header line using the WITH HEADER LINE addition. The header line is created under the same
    conditions as apply when you refer to an existing table type.
    DATA ITAB TYPE HASHED TABLE OF SPFLI
    WITH UNIQUE KEY CARRID CONNID.
    The table object ITAB has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a
    unique key with the key fields CARRID and CONNID. The internal table ITAB can be regarded as an internal template for the database table
    SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key.

  • Difference between Field symbols and work area for Internal tables

    Hi,
    In ECC versions we all know that we need to declare the internal tables without headerline, and for handling the internal tables we need to use exclusive work areas.
    Currently i have an issue that we have been asked to use field symbols instead of work areas...can any one help me how to use the field symbols and also let me know how it will improve the performance of the program..
    Thanks and Regards,
    Kathir

    Hi
    DATA: WA TYPE ITAB.
    LOOP AT ITAB INTO WA.
    IF WA-FIELD = .....
    ENDIF.
    ENDLOOP.[(code]
    FIELD-SYMBOLS <WA> TYPE ANY.
    LOOP AT ITAB ASSIGNING <WA>.
    ENDLOOP.
    Now the problem is you can't know the name of the fields of the table at runtime, so you can't write:
    IF <WA>-FIELD = .....
    ENDIF.
    Anyway you can create a field-symbols strcturated like the table:
    [code]FIELD-SYMBOLS <WA> TYPE ITAB.
    LOOP AT ITAB ASSIGNING <WA>.
      IF <WA>-FIELD = .....
      ENDIF.
    ENDLOOP.
    I don't know which are the differences for the performance between to use a field-symbol and to use a structure as work-area.
    The differnce between the field-symbols and work-area is the field-symbol is assigned directly to the record, so u don't need to do a MODIFY statament to change something:
    LOOP AT ITAB INTO WA.
      WA-FIELD =
      MODIFY ITAB FROM WA.
    ENDLOOP.
    LOOP AT ITAB ASSIGNING <WA>.
      <WA>-FIELD =
    ENDLOOP.
    These two pieces of abap code do the same action, so probably the field-symbol improve the performance because it do an access directly to the record without to use an external structure as workarea.
    Max

  • Difference between tables statement and work area

    Hi
    i would like know the difference between these statement.
    tables: vttk.
    data :itab type standard table of vttk,
             wa_itab like line of vttk.
    what will happen with the table statement keyword ???
    whether any difference between the ouput created through tables and wa_itab statement???

    Hi
    HI,
    INTERNAL Table and it's background:
    ===================================
    Internal table acts as a container which is used to store the record sets. That is used to store the data fetched from the database table.
    So due to performance reason every time access to database would not be so good and decrease the performance. So you just select the data from the database and store it in the intermediate table. This table is called INTERNAL TABLE. So it's an replica of the database. The design foes like this,
    PRESENTATION SERVER <> APPLICATION SERVER <>
    DATABASE SERVER.
    So everytime gain accessing to database results in high resource usage and bad permformance.
    So always play around with internal tables. So obviously the whenever you access the data in the INTERNAL TABLE, the application server will be used.
    WORK AREA:
    ==========
    When ever you loop at the internal table, the current record should be stored in a temporary work place. That is called WORK AREA.
    LOOP AT ITAB INTO WORKAREA.
    ENDLOOP.
    ITAB :An internal table
    WORKAREA:An instance of internal table
    Go thru the link below
    Internal tables
    appending internal tables.
    <b>Reward if usefull</b>

  • Internal speakers and headphones are not working

    I have hp g6 2231tx os Windows 8, brought it a month ago..now it's internal speakers and headphones are not working..I enabled in playback device from sound mixer and reinstalled drivers but still not working..it's because of hardware or software??

    Hi,
    It could be either Hardware or Software related, so try the following and let me know.
    Download the IDT Audio installer on the link below and save it to your Downloads folder.
    http://ftp.hp.com/pub/softpaq/sp58501-59000/sp58517.exe
    When done, open windows Control Panel, open Device Manager and open up Sound, Video and Game Controllers.  Right click the IDT device and select Uninstall - you should also get a prompt to remove the current driver, tick the box to allow this and then proceed with the uninstall.
    When complete, shut down the notebook, unplug the AC Adapter and then remove the battery.  Hold  down the Power button for 30 seconds.  Re-insert the battery and plug in the AC Adapter.
    Tap away at the esc key as you start the notebook to launch the Start-up Menu and then select f10 to enter the bios menu.  Press f5 to load the defaults ( this is sometimes f9, but the menu at the bottom will show the correct key ), use the arrow keys to select 'Yes' and hit enter.  Press f10 to save the setting and again use the arrow keys to select 'Yes' and hit enter.
    Let Windows fully load - it will automatically load an audio driver, but just let this complete.  Then open your Downloads folder, right click on the IDT installer and select 'Run as Administrator' to start the installation.  When this has completed, right click the speaker icon in the Taskbar and select Playback Devices.  Left click 'Speakers and Headphones' once to highlight it and then click the Set Default button - check if you now have audio.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

Maybe you are looking for

  • I purchased a new Iphone 5s but I can not get the voice mail to work. How do I set up voice mail?

    How can I set up voicemail on my new Iphone 5s? When I touch the icon I get a message for a 10 digit # to call another phone with a mailbox. How can I set up a mailbox on my phone?

  • Need to upload using lsmw

    hi, LSMW it's only navigation part for direct/batch input method. So why do abapers do the LSMW to upload? regards raghu

  • What Happened To The MacBook

    What happened to the macbook? Why isn't the macbook in the timeline. Just the macbook pro and macbook air are in the timeline.

  • Roaming between 4400 and 5500 controllers

    Hi, we are planning to do an AP migration, but there is a doubt for this. Actually we have a 4402 controller with 1120 APs both of which are marked as EoL products, we want to jump over the new 2600 APs and 5508 Controller for increase signal coverag

  • Dynamic/Static LOV

    Hi, Im havin a little trouble trying to do the following: I have a LOV that does a query, but besides the query I want also to have an static option on the LOV that represents all the options, any idea how can I achieve this? thanks