... itab [FROM idx1] [TO idx2] [WHERE log_exp]... .
1. ... FROM idx1
2. ... TO idx2
3. ... WHERE log_exp
To delete several lines at once, you have to specify at least one of the additions FROM, TO, or WHERE. You can only use the additions FROM and TO with standard tables and sorted tables.
If you specify several of the additions, the rows are deleted that result from the intersection of the individual additions.
... FROM idx1
If you specify FROM, all the table rows from the table
index idx1 onwards are included.
idx1 must be a data object with type i. If
the value of idx1 is less than or equal to 0, a runtime error occurs. If the value is greater than the number of table rows, no rows are deleted.
... TO idx2
If you specify TO, only the table rows up to table index
idx2 are included. idx2
must be a data object with type i. If the values of
idx2 is less than or equal to 0, a runtime error occurs. If the value is greater than the
number of table rows, it is set to the number of rows. If idx2 is less than idx1, no rows are deleted.
... WHERE log_exp
You can specify any logical expression
log_exp after WHERE, for which the first operand of each individual comparison is a
component of the internal table. This enables all logical expression
with the exception of IS ASSIGNED,
ISREQUESTED, and IS SUPPLIED. The dynamic specification
of components using character-type data objects in parentheses is not supported here. All rows for which the logical expression is true are deleted.
Whereas in standard tables, every row of the internal table is checked for the logical expression of the WHERE addition, in
sorted tables and
hashed tables (as of release 7.0), it
is possible to use AND queries to optimize access by checking
at least the starting component of the table key for equality with the logical expression. Access is
also optimized if the logical expression contains additional queries linked with AND using any operators.
Deletes all rows of an internal table from row 4. The result is the same as in the example for APPEND ... SORTED BY.
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid.
DATA: BEGIN OF seats,
fldate TYPE sflight-fldate,
seatsocc TYPE sflight-seatsocc,
seatsmax TYPE sflight-seatsmax,
seatsfree TYPE sflight-seatsocc,
END OF seats.
DATA seats_tab LIKE STANDARD TABLE OF seats.
SELECT fldate seatsocc seatsmax
FROM sflight
INTO TABLE seats_tab
WHERE carrid = p_carrid AND
connid = p_connid.
LOOP AT seats_tab INTO seats.
seats-seatsfree = seats-seatsmax - seats-seatsocc.
MODIFY seats_tab INDEX sy-tabix FROM seats.
ENDLOOP.
ENDLOOP.
SORT seats_tab BY seatsfree DESCENDING.
DELETE seats_tab FROM 4.