Ansicht
Dokumentation
ABAPDELETE_ITAB_KEY - DELETE ITAB KEY
ROGBILLS - Synchronize billing plans Vendor Master (General Section)This documentation is copyright by SAP AG.
DELETE itab, table_key
... TABLE itab ${ FROM wa $[USING KEY keyname$] $}
$| ${ WITH TABLE KEY $[keyname COMPONENTS$]
${comp_name1$|(name1)$} = operand1
${comp_name2$|(name2)$} = operand2
...
$} ...
Alternatives:
1. ... TABLE itab FROM wa $[USING KEY keyname$]
2. ... TABLE itab WITH TABLE KEY $[keyname COMPONENTS$] ...
Effect
Enter table key as a search key. The values of the search key can be declared either implicitly in a work area wa behind FROM or by listing the components of the table key explicitly behind TABLE KEY.
When the primary table key is used, the table categories are accessed as follows:
-
Linear scans are used for standard tables.
-
Binary scans are used for sorted tables.
-
The hash algorithm is used for hashed tables.
When the secondary table key is used, a binary scan is used in the
sorted key case and a
hash algorithm is used in the
hash key case.
Note
When deleting a line from a standard table using a secondary key, the entire runtime depends linearly
on the number of table lines. Although the lines to be deleted are found quickly, when updating the primary index, the entry to be deleted must be searched linearly.
Alternative 1
... TABLE itab FROM wa $[USING KEY keyname$]
Effect
For wa, a work area compatible to the row type of the internal table must be specified. This concerns functional operand positions. The first row of the internal table found, whose values in the columns of the table key used match those of the corresponding components of wa, is processed. If the key fields in wa are empty, no entries are processed.
If the USING KEY addition is not specified, the
primary table
key is used. If the USING KEY addition is specified, the table key specified in keyname is used.
If the primary table key is used to access a
standard table and the key is
empty, the first line of the internal table is deleted. If this is known statically, the syntax check produces a warning.
Notes
- When using the primary table key, it should be noted that this key can be the standard key, which can also have unexpected consequences:
- For structured line types, the standard key covers all character-like and byte-like components.
- The standard key of a standard table can be empty.
- Outside of classes, an obsolete short form is also possible where FROM wa can be omitted if the internal table has an identically named
header line
itab. The statement then uses the header line as the work area implicitly. Furthermore, USING KEY cannot be specified without FROM wa.
Example
Deletion of the table line that has the same value as the input key field carrid in the key field
carrid using a work area constructed using the value operator VALUE.
Example
This example demonstrates an inconvenient way of deleting all flight connections between two specified
cities using a secondary table key. In these cases, it is usually best to use a WHERE condition.
Alternative 2
... TABLE itab WITH TABLE KEY $[keyname COMPONENTS$] ...
Effect
Every component of the table key used must be executed, either directly as comp_name1 comp_name2 ..., or as a bracketed character-type data object name1 name2 ..., which contains the name of the component during the execution of the statement. comp_name1 comp_name2 ... are functional operand positions. name is not case-sensitive. If name only contains blank spaces, this component specification is ignored in the execution of the statement. A data object dobj1 dobj2 ..., that is compatible with the data type of the component or that can be converted to it, must be assigned to every component. The first row of the internal table found, whose values in the column of the table key used correspond with the values in the data object dobj1 dobj2 ... assigned, is processed. If it is necessary, the content of dobj1 dobj2 ... is converted to the data type of the component before the comparison.
If the addition COMPONENTS is not specified, the
primary table
key is used. If the addition COMPONENTS is specified, the table key specified in keyname is used.
Notes
-
The pseudo
component table_line can be specified as a component for tables with an unstructured row type, if their whole table entry is defined as a table key.
-
To avoid unexpected results after a conversion, dobj1 dobj2 ... must be compatible with the data type of the component.
No Customizing include may be specified as a component if it is empty.
Example
Deletion of the table line that has the same value as the input field carrid in the key field carrid by specifying the primary table key.
Example
Deletion of all flight connections between two specified cities using a secondary table key. In these
cases, it is usually best to use a WHERE condition.
RFUMSV00 - Advance Return for Tax on Sales/Purchases ABAP Short Reference
This documentation is copyright by SAP AG.
Length: 9851 Date: 20240426 Time: 055920 sap01-206 ( 148 ms )