Entering content frameOperations on Individual Lines Locate the document in its SAP Library structure

The following are typical operations involving single lines of a table:

Influence of the Table Type

When working with single table lines, we must distinguish between the operators that are possible for all table types, and those that are only possible with index tables. Index tables (standard and sorted tables) have an internal index, making linear access possible. Hashed tables have no linear index. Consequently, only key access is possible. The operations that are permitted for all table types do not use indexes. They can also be used in procedures or with field symbols , where the internal table type is not fully typed. These operations are known as generic operations.

The statements used to access lines of any type of table differ from those used to access index tables mainly through the TABLE addition following the corresponding keyword. For example, you would use MODIFY to change lines in index tables, but MODIFY TABLE to change lines in any type of table.

Access methods

There are two ways to access a single table entry:

Access Using a Work Area

When you access individual table entries using a work area, you are not working directly with the data in the table. Instead, you work with another data object as a work area. The work area is an interface to the entries in the internal table, and must be convertible into the line type of the internal table. The most efficient working method is to use a work area compatible with the line type of the internal table. When you read data from a table record, the data you are reading overwrites the current contents of the work area. You can then use this data in the program. When you write data to the internal table, this must first be placed in the work area. The system then transfers it from the work area to the appropriate table entry. Data transfer follows the rules of assigning data using MOVE.

This graphic is explained in the accompanying text

If the internal table has a header line, you can use it as the work area. The ABAP statements that you use to access individual table entries can use the header line implicitly as a work area.

Access Using Field Symbols

If you access an internal table using a field symbol , you do not need to copy the data into a work area. You can assign a line of an internal table to a field symbol. Ideally, the field symbol will have the same type as the line type of the internal table. Once you have assigned the entry to the field symbol, working with the field symbol has exactly the same effect as accessing the corresponding line directly.

This graphic is explained in the accompanying text

 

The following sections discuss operations for the different table types. After that comes a short section about accessing internal tables using field symbols and header lines.

Operations for all table types

Operations on Index Tables

Access Using Field Symbols

Using Header Lines as Work Areas

 

 

Leaving content frame