ABAP study Note 3-internal table

Source: Internet
Author: User

1. Types and definitions of internal tables:
(1). Any table: any table type. This type can only be defined when parameters are passed.
Example: Form XXX using/changing type any table.
(2). Any table includes two types: index table and hashed table.
1. index table: including standard table and sorted table
A. Standard table: Actually, it is a linear table, and accessing the internal table through the key is linear search. That is to say, as the table record increases, the time overhead of table operations also increases accordingly.
Definition method: types/data: Like/type standard table.
B. Sorted table: as the name suggests, the records in the table are arranged in a certain order. The primary way to access a table is the key defined in the table. If the key is not unique, select the one with the smallest index. You can also use index to access the sorting table. If you want to insert a record through index, the system will automatically check whether your inserted position is correct. Therefore, it takes longer to insert data to a standard table than to insert data to a standard table. Therefore, select a key as much as possible to operate the sorting table.
Definition method: types/data: Like/type sorted table.
2. hashed table: You can operate a hash table only with the key you defined, but not with the index. Therefore, a hash table must define a unique key. Note: All statements about using index to operate a table cannot be used to operate a hash table. For example, sort or loop.
Definition method: types/data: Like/type hashed table.
2. Internal table operations:
(1). Create:
A. Define a structure, and then type/like this structure
For example:
Types: Begin,
...
...,
...
End.
Data Type standard table
With NON-UNIQUE default key
Initial size
With header line.
B. Type/like system table or database table or structure
Data Type standard table of <System Table Name>
Initial size
With header line.
(2). Add data:
A. append: directly add data to the table
1. append [wa to | initial line to] itab [assigning | reference into DREF].
2. append lines of itab1 [from idx1] [To idx2] To itab2.
3. append [wa to] itab sorted by F [assigning
B. insert data into the table:
1. insert [wa into | initial line into] itab [index idx] [assigning | reference into DREF].
2. insert [wa into | initial line into] Table itab [assigning | reference into DREF].
3. insert lines of itab1 [from idx1] [To idx2] into itab2 [index idx3].
4. insert lines of itab1 [from idx1] [To idx2] into Table itab2.
C. Add the same field sum to the table:
Basic Form
Collect [wa into] itab.
Extras:
1... assigning
2... reference into DREF
3... sorted by F
(3). delete data:
1. Delete itab.
2. Delete table itab with table key k1 = V1... kn = Vn.
3. Delete table itab [from Wa].
4. Delete itab index idx.
5. Delete itab from idx1 to idx2.
6. Delete itab where logexp.
7. Delete adjacent duplicates from itab.
(4). modify data:
1. Modify itab [from Wa] [index idx] [assigning | reference into DREF] [transporting F1... FN].
2. Modify Table itab [from Wa] [assigning | reference into DREF] [transporting F1... FN].
3. Modify itab [from Wa] transporting F1... FN where cond.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.