Table 1 ABAP Basics





Type in the table

 

There are three types abap the table:

  1. Standard table (this table is used in the most general ABAP programs)

  • Each line data system for generating a logical index table, coding maintains its own internal line number (Index) of. Key table is not unique, and not sorted automatically according to the table key, support and access through index access keys in two ways. After the specified location may be inserted into or when there are rows filling standard table, internal procedures addressing operation can be performed by a keyword table or index. In the table when the insert or delete operation, each data row in memory the same physical location , the system rearranging only the index value of each data row. When the index is often used to access the table on the choice of the standard table.
    Frequently reads bisection inner, high efficiency.
    Method definitions: TYPES / DATA: BEGIN OF gt_data like STANDARD TABLE OF MARA.

  • 2. Sort the table (To specify a KEY value)
    is also a logical index, except that the table is always sorted in ascending order according to their key after the table is now stored, within their own internal sort table also maintains a number of line numbers, table or unique key can not be unique, support access through index access and key in two ways. If the key is often used to access the data, or to automatically sort the data, use the sort table.
    Method definitions: TYPES / DATA: LIKE / TYPE SORTED TABLE OF.

  • 3. hash table (to specify a KEY value) of
    the hash table generated by a hash table key function to identify and quickly access table rows, table hash table key is not sequential, the value must be unique only in the table to access the hash table by table key. The time required to address a line of data regardless of the number of rows in the table. If the inner table is very large and you want to use a primary key access, use hash tables.
    Method definitions: TYPES / DATA: LIKE / TYPE HASHED TABLE OF.

  • Various types within a table filled many access methods (index access key access):
    standard table is mainly indexed access,
    internal sorting table is mainly Key access,
    and within the hash table can only be accessed via Key:

image174

When you define sorting table and hash tables, be sure to specify the type of index keywords (can be specified WITH KEY DEFAULT KEY), but otherwise compile.

 

The DEFAULT KEY : default standard Key row structure all byte-type (x, xstring, xsequence) type and character-type (c, d, n, t, string, clike) type all fields, all other types are ignored ; If the line structure as well as the sub-structure, all of the aforementioned type field substructure will also be extracted as part of the Key; inner field types do not become part of the Key default; if not byte- type, character-type type field, the default is no Key ,:

  • 4.INDEX / ANY TABLE Universal inner

In addition to the above three types of standards, there are general types , i.e., the index table ( the INDEX TABLE ), and option table ( the ANY TABLE ),
a general type definition type can be used, but can not be used to declare a target in the table, because it does not specify any clear table type, so the system can not determine its mode of operation. Generic type specified in the type field may also be used symbols and interface parameters, which may be able to determine the actual type at runtime.

image176

Guess you like

Origin www.cnblogs.com/rainysblog/p/12079464.html