<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic define internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014978#M712504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;  How to define internal table for standard sap tables?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Nov 2007 04:09:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-15T04:09:51Z</dc:date>
    <item>
      <title>define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014978#M712504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;  How to define internal table for standard sap tables?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:09:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014978#M712504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014979#M712505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data : itab type standard table of mara occurs 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:13:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014979#M712505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014980#M712506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
data : it_tab type standard table of mara, " Internal table
         wa_tab type mara.                        " Work area
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:17:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014980#M712506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014981#M712507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data : it_tab type table of &amp;lt;standard table&amp;gt;  " Internal table&lt;/P&gt;&lt;P&gt;          wa_tab type &amp;lt;standard table&amp;gt;          " work area&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:19:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014981#M712507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014982#M712508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Using Standard SAP Tables,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: i_itab type standard table of  &amp;lt;standard table&amp;gt; occcurs 0.&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;otherwise, if u want to use particular fields of  SAP tables&lt;/P&gt;&lt;P&gt;then declare structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: Begin of  ty_itab,&lt;/P&gt;&lt;P&gt;        field1 like standard table-field1,&lt;/P&gt;&lt;P&gt;        field2 like standard table-field2,&lt;/P&gt;&lt;P&gt;        end of ty_itab.&lt;/P&gt;&lt;P&gt;data:i_itab type standard table of  ty_itab,&lt;/P&gt;&lt;P&gt;       wa_itab like line of i_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think it will be helpful...rewards if useful..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:29:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014982#M712508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014983#M712509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : it_tab type table of &amp;lt; the table name &amp;gt; " Internal table declaration&lt;/P&gt;&lt;P&gt;            wa_tab type &amp;lt; the table name &amp;gt; " its work area&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:34:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014983#M712509</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014984#M712510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal tables are the core of ABAP. They are like soul of a body. For any program we use &lt;/P&gt;&lt;P&gt;internal tables extensively. We can use Internal tables like normal data base tables only, but the &lt;/P&gt;&lt;P&gt;basic difference is the memory allocated for internal tables is temporary. Once the program is &lt;/P&gt;&lt;P&gt;closed the memory allocated for internal tables will also be out of memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But while using the internal tables, there are many performance issues to be considered. i.e which &lt;/P&gt;&lt;P&gt;type of internal table to be used for the program..like standard internal table, hashed internal &lt;/P&gt;&lt;P&gt;table or sorted internal table etc..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data &lt;/P&gt;&lt;P&gt;objects, they save the programmer the task of dynamic memory management in his or her programs. You should use internal tables &lt;/P&gt;&lt;P&gt;whenever you want to process a dataset with a fixed structure within a program. A particularly important use for internal tables is for &lt;/P&gt;&lt;P&gt;storing and formatting data from a database table within a program. They are also a good way of including very complicated data &lt;/P&gt;&lt;P&gt;structures in an ABAP program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;data type is also an attribute of an existing data object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal Tables as Data Types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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, &lt;/P&gt;&lt;P&gt;key, and table type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;structure is a column in the internal table. However, the line type may also be elementary or another internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;whether the key should be UNIQUE or NON-UNIQUE. Internal tables with a unique key cannot contain duplicate entries. The uniqueness &lt;/P&gt;&lt;P&gt;depends on the table access method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;is an internal table, the default key is empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The user-defined key can contain any columns of the internal table that are not references or themselves internal tables. Internal tables &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;this, for example, if you intend to sort the table according to the key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table type determines how ABAP will access individual table entries. Internal tables can be divided into three types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Standard tables have an internal linear index. From a particular size upwards, the indexes of internal tables are administered as trees. In &lt;/P&gt;&lt;P&gt;this case, the index administration overhead increases in logarithmic and not linear relation to the number of lines. The system can access &lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;very quickly, since the system does not have to check whether there are already existing entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorted tables are always saved sorted by the key. They also have an internal index. The system can access records either by using the &lt;/P&gt;&lt;P&gt;table index or the key. The response time for key access is logarithmically proportional to the number of table entries, since the system &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;the key is to be unique or not. Standard tables and sorted tables are known generically as index tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;When you define the table, you must specify the key as UNIQUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generic Internal Tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;generic construction, that is, the key or key and line type of an internal table data type may remain unspecified. You can use generic &lt;/P&gt;&lt;P&gt;internal tables to specify the types of field symbols and the interface parameters of procedures . You cannot use them to declare data &lt;/P&gt;&lt;P&gt;objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal Tables as Dynamic Data Objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;respect of their line type, key and access method. However, the number of lines is not fixed. Thus internal tables are dynamic data objects, &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;the limits of your system installation. The maximum memory that can be occupied by an internal table (including its internal administration) &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;than 2 million entries. The line types of internal tables can be any ABAP data types - elementary, structured, or internal tables. The &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Choosing a Table Type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table type (and particularly the access method) that you will use depends on how the typical internal table operations will be most &lt;/P&gt;&lt;P&gt;frequently executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Standard tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the most appropriate type if you are going to address the individual table entries using the index. Index access is the quickest &lt;/P&gt;&lt;P&gt;possible access. You should fill a standard table by appending lines (ABAP APPEND statement), and read, modify and delete entries by &lt;/P&gt;&lt;P&gt;specifying the index (INDEX option with the relevant ABAP command). The access time for a standard table increases in a linear relationship &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;access, the response time is logarithmically proportional to the number of table entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorted tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add &lt;/P&gt;&lt;P&gt;them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always &lt;/P&gt;&lt;P&gt;uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the &lt;/P&gt;&lt;P&gt;table key in the WHERE condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hashed tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;processing large amounts of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creating Internal Tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like other elements in the ABAP type concept, you can declare internal tables as abstract data &lt;/P&gt;&lt;P&gt;types in programs or in the ABAP Dictionary, and then use them to define data objects. &lt;/P&gt;&lt;P&gt;Alternatively, you can define them directly as data objects. When you create an internal table as a &lt;/P&gt;&lt;P&gt;data object, you should ensure that only the administration entry which belongs to an internal &lt;/P&gt;&lt;P&gt;table is declared statically. The minimum size of an internal table is 256 bytes. This is important if an &lt;/P&gt;&lt;P&gt;internal table occurs as a component of an aggregated data object, since even empty internal &lt;/P&gt;&lt;P&gt;tables within tables can lead to high memory usage. (In the next functional release, the size of the &lt;/P&gt;&lt;P&gt;table header for an initial table will be reduced to 8 bytes). Unlike all other ABAP data objects, you &lt;/P&gt;&lt;P&gt;do not have to specify the memory required for an internal table. Table rows are added to and &lt;/P&gt;&lt;P&gt;deleted from the table dynamically at runtime by the various statements for adding and deleting &lt;/P&gt;&lt;P&gt;records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create internal tables in different types.&lt;/P&gt;&lt;P&gt;You can create standard internal table and then make it sort in side the program.&lt;/P&gt;&lt;P&gt;The same way you can change to hashed internal tables also.&lt;/P&gt;&lt;P&gt;There will be some performance issues with regard to standard internal tables/ hashed internal &lt;/P&gt;&lt;P&gt;tables/ sorted internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This section describes how to define internal tables locally in a program. You can also define internal tables globally as data types in the &lt;/P&gt;&lt;P&gt;ABAP Dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;using the TYPE or LIKE addition, you can use the TYPES statement to construct a new local internal table in your program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES &amp;lt;t&amp;gt; TYPE|LIKE &amp;lt;tabkind&amp;gt; OF &amp;lt;linetype&amp;gt; [WITH &amp;lt;key&amp;gt;]&lt;/P&gt;&lt;P&gt;[INITIAL SIZE &amp;lt;n&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After TYPE or LIKE, there is no reference to an existing data type. Instead, the type constructor occurs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;tabkind&amp;gt; OF &amp;lt;linetype&amp;gt; [WITH &amp;lt;key&amp;gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type constructor defines the table type &amp;lt;tabkind&amp;gt;, the line type &amp;lt;linetype&amp;gt;, and the key &amp;lt;key&amp;gt; of the internal table &amp;lt;t&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can, if you wish, allocate an initial amount of memory to the internal table using the INITIAL SIZE addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can specify the table type &amp;lt;tabkind&amp;gt; as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generic table types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INDEX TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For creating a generic table type with index access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ANY TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For creating a fully-generic table type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data types defined using generic types can currently only be used for field symbols and for interface parameters in procedures . The generic &lt;/P&gt;&lt;P&gt;type INDEX TABLE includes standard tables and sorted tables. These are the two table types for which index access is allowed. You cannot &lt;/P&gt;&lt;P&gt;pass hashed tables to field symbols or interface parameters defined in this way. The generic type ANY TABLE can represent any table. You &lt;/P&gt;&lt;P&gt;can pass tables of all three types to field symbols and interface parameters defined in this way. However, these field symbols and &lt;/P&gt;&lt;P&gt;parameters will then only allow operations that are possible for all tables, that is, index operations are not allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fully-Specified Table Types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STANDARD TABLE or TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For creating standard tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORTED TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For creating sorted tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HASHED TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For creating hashed tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fully-specified table types determine how the system will access the entries in the table in key operations. It uses a linear search for &lt;/P&gt;&lt;P&gt;standard tables, a binary search for sorted tables, and a search using a hash algorithm for hashed tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the line type &amp;lt;linetype&amp;gt;, you can specify:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;of decimal places) are automatically filled with the default values. You cannot specify any other generic types.&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;structures in the ABAP Dictionary (for compatibility reasons).&lt;/P&gt;&lt;P&gt;All of the lines in the internal table have the fully-specified technical attributes of the specified data type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can specify the key &amp;lt;key&amp;gt; of an internal table as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[UNIQUE|NON-UNIQUE] KEY &amp;lt;col1&amp;gt; ... &amp;lt;col n&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In tables with a structured line type, all of the components &amp;lt;coli&amp;gt; belong to the key as long as they are not internal tables or references, &lt;/P&gt;&lt;P&gt;and do not contain internal tables or references. Key fields can be nested structures. The substructures are expanded component by &lt;/P&gt;&lt;P&gt;component when you access the table using the key. The system follows the sequence of the key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[UNIQUE|NON-UNIQUE] KEY TABLE LINE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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, &lt;/P&gt;&lt;P&gt;you should remember that this is often not suitable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[UNIQUE|NON-UNIQUE] DEFAULT KEY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;define the types of field symbols and the interface parameters of procedures . For exceptions, refer to Special Features of Standard Tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The optional additions UNIQUE or NON-UNIQUE determine whether the key is to be unique or non-unique, that is, whether the table can &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;only be used for specifying types. When you specify the table type simultaneously, you must note the following restrictions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot use the UNIQUE addition for standard tables. The system always generates the NON-UNIQUE addition automatically.&lt;/P&gt;&lt;P&gt;You must always specify the UNIQUE option when you create a hashed table.&lt;/P&gt;&lt;P&gt;Initial Memory Requirement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following &lt;/P&gt;&lt;P&gt;addition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INITIAL SIZE &amp;lt;n&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;reserve memory space for &amp;lt;n&amp;gt; table lines when you declare the table object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;are then allocated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;space occupied, depending on the line width, is 16 &amp;lt;= &amp;lt;n&amp;gt; &amp;lt;= 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It only makes sense to specify a concrete value of &amp;lt;n&amp;gt; if you can specify a precise number of table entries when you create the table and &lt;/P&gt;&lt;P&gt;need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for &lt;/P&gt;&lt;P&gt;deep-structured internal tables where the inner table only has a few entries (less than 5, for example).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To avoid excessive requests for memory, large values of &amp;lt;n&amp;gt; are treated as follows: The largest possible value of &amp;lt;n&amp;gt; is 8KB divided by the &lt;/P&gt;&lt;P&gt;length of the line. If you specify a larger value of &amp;lt;n&amp;gt;, the system calculates a new value so that n times the line width is around 12KB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COLUMN1 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN2 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN3 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;COLUMN1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COLUMN1 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN2 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN3 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF DEEPLINE,&lt;/P&gt;&lt;P&gt;FIELD TYPE C,&lt;/P&gt;&lt;P&gt;TABLE1 TYPE VECTOR,&lt;/P&gt;&lt;P&gt;TABLE2 TYPE ITAB,&lt;/P&gt;&lt;P&gt;END OF DEEPLINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES DEEPTABLE TYPE STANDARD TABLE OF DEEPLINE&lt;/P&gt;&lt;P&gt;WITH DEFAULT KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;second table type is the same as in the previous example. The structure DEEPLINE contains the internal table as a component. The table &lt;/P&gt;&lt;P&gt;type DEEPTABLE has the line type DEEPLINE. Therefore, the elements of this internal table are themselves internal tables. The key is the &lt;/P&gt;&lt;P&gt;default key - in this case the column FIELD. The key is non-unique, since the table is a standard table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal tables are dynamic variable data objects. Like all variables, you declare them using the DATA statement. You can also declare static &lt;/P&gt;&lt;P&gt;internal tables in procedures using the STATICS statement, and static internal tables in classes using the CLASS-DATA statement. This &lt;/P&gt;&lt;P&gt;description is restricted to the DATA statement. However, it applies equally to the STATICS and CLASS-DATA statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reference to Declared Internal Table Types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like all other data objects, you can declare internal table objects using the LIKE or TYPE addition of the DATA statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA &amp;lt;itab&amp;gt; TYPE &amp;lt;type&amp;gt;|LIKE &amp;lt;obj&amp;gt; [WITH HEADER LINE].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;program declared using the TYPES statement, or a table type in the ABAP Dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You must ensure that you only refer to tables that are fully typed. Referring to generic table types (ANY TABLE, INDEX TABLE) or not &lt;/P&gt;&lt;P&gt;specifying the key fully is not allowed (for exceptions, refer to Special Features of Standard Tables).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The optional addition WITH HEADER line declares an extra data object with the same name and line type as the internal table. This data &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;this by placing brackets after the table name (&amp;lt;itab&amp;gt;[]). Otherwise, ABAP interprets the name as the name of the header line and not of the &lt;/P&gt;&lt;P&gt;body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested &lt;/P&gt;&lt;P&gt;in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES VECTOR TYPE SORTED TABLE OF I WITH UNIQUE KEY TABLE LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ITAB TYPE VECTOR,&lt;/P&gt;&lt;P&gt;JTAB LIKE ITAB WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MOVE ITAB TO JTAB. &amp;lt;- Syntax error!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE ITAB TO JTAB[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;cannot be converted into an elementary type, the MOVE statement causes a syntax error. The second MOVE statement is correct, since &lt;/P&gt;&lt;P&gt;both operands are table objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declaring New Internal Tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;a table type in the TYPES statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA &amp;lt;itab&amp;gt; TYPE|LIKE &amp;lt;tabkind&amp;gt; OF &amp;lt;linetype&amp;gt; WITH &amp;lt;key&amp;gt;&lt;/P&gt;&lt;P&gt;[INITIAL SIZE &amp;lt;n&amp;gt;]&lt;/P&gt;&lt;P&gt;[WITH HEADER LINE].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As when you define a table type , the type constructor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;tabkind&amp;gt; OF &amp;lt;linetype&amp;gt; WITH &amp;lt;key&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;defines the table type &amp;lt;tabkind&amp;gt;, the line type &amp;lt;linekind&amp;gt;, and the key &amp;lt;key&amp;gt; of the internal table &amp;lt;itab&amp;gt;. Since the technical attributes of &lt;/P&gt;&lt;P&gt;data objects are always fully specified, the table must be fully specified in the DATA statement. You cannot create generic table types (ANY &lt;/P&gt;&lt;P&gt;TABLE, INDEX TABLE), only fully-typed tables (STANDARD TABLE, SORTED TABLE, HASHED TABLE). You must also specify the key and whether &lt;/P&gt;&lt;P&gt;it is to be unique (for exceptions, refer to Special Features of Standard Tables).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;You can create an internal table with a header line using the WITH HEADER LINE addition. The header line is created under the same &lt;/P&gt;&lt;P&gt;conditions as apply when you refer to an existing table type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB TYPE HASHED TABLE OF SPFLI&lt;/P&gt;&lt;P&gt;WITH UNIQUE KEY CARRID CONNID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table object ITAB has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a &lt;/P&gt;&lt;P&gt;unique key with the key fields CARRID and CONNID. The internal table ITAB can be regarded as an internal template for the database table &lt;/P&gt;&lt;P&gt;SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014984#M712510</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014985#M712511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through the following example, which creates an internal table for mast table with selected fields.&lt;/P&gt;&lt;P&gt;                                                                                types: begin of ty_mast,&lt;/P&gt;&lt;P&gt;         matnr type matnr,&lt;/P&gt;&lt;P&gt;         stlal type stalt,&lt;/P&gt;&lt;P&gt;         stlan type stlan,&lt;/P&gt;&lt;P&gt;         werks type werks_d,&lt;/P&gt;&lt;P&gt;       end of ty_mast.&lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;P&gt;data: t_mast type standard table of ty_mast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_mast will be your internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz reward if useful..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2007 04:42:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014985#M712511</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-15T04:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014986#M712512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 05:43:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table/m-p/3014986#M712512</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-04-13T05:43:09Z</dc:date>
    </item>
  </channel>
</rss>

