Get Example source ABAP code based on a different SAP table
• UP TO ROWS DELETE dbtab • ORDER BY DELETE dbtab • OFFSET DELETE dbtab • WHERE DELETE dbtab
DELETE dbtab>, cond> Short Reference >
ABAP_SYNTAX ... $[WHERE sql_cond>$] $[db_hints>$] $[ORDER BY ... $[OFFSET o$]$] $[UP TO n ROWS$] ...>
ABAP Addition 1 ... WHERE sql_cond> 2 ... db_hints> 3 ... $[ORDER BY ... $[OFFSET o$]$] $[UP TO n ROWS$]>
What does it do? In the variant DELETE FROM target> of the statement DELETE>>, these additions determine the rows to be deleted.
ABAP Addition
What does it do? The addition WHERE> determines which rows in a DDIC database table BEGIN_SECTION VERSION 5 OUT or view END_SECTION VERSION 5 OUT are deleted. Those rows are deleted for which the logical expression sql_cond>> is true. The logical expression sql_cond> is subject to the restriction that no subqueries can be evaluated on the DDIC database table to be changed. If there is no database row that satisfies the WHERE> condition, no rows are deleted and sy-subrc> is set to 4. If no WHERE> condition is specified, all rows are deleted or as many rows as specified by the addition UP TO>. Implicit AB_SQL client handling> applies. In a client-specific target, only rows in the current client are deleted by default. The client column > of a client-dependent target cannot be specified in the WHERE> condition. The addition USING>> can be used to switch implicit client handling to different clients.
Latest notes:
If DDIC database tables or DDIC views are accessed using generic table buffering>, the buffered area must be specified completely in the WHERE> condition. If not, buffering is bypassed.
If DDIC database tables or DDIC views are accessed using single record buffering, the equality conditions joined using AND> in the WHERE> condition must be specified for all key fields of the primary key. If not, buffering is bypassed. NON_V5_HINTS
Instead of USING>, the obsolete addition CLIENT SPECIFIED>> can also be used outside ABAP_STRICT_777 strict mode from ABAP_RELEASE ABAP_777 / . It disables implicit client handling and the client column can be used in the WHERE> condition as an operand. ABAP_HINT_END
ABAP_EXAMPLE_VX5 In the following example, all today's flights of an airline in which no seats are occupied are deleted from the DDIC database table SFLIGHT>>. See also the example for dtab-source>>. ABEXA 00215 ABAP_EXAMPLE_END
ABAP Addition
What does it do? In the variant DELETE FROM TARGET>, db_hints>> can be used to specify database hints>.
ABAP Addition ROWS$]>
What does it do? The addition ORDER BY> is used to sort the rows defined by the WHERE> condition. The addition OFFSET> is used to delete only rows from the counter o>. The addition UP TO> restricts the number of rows to delete to n>. The addition OFFSET> can only be specified together with ORDER BY>. The addition ORDER BY> cannot be specified without OFFSET> or UP TO>. If the addition UP TO> is specified without ORDER BY>, it is not possible to define which of the possible rows are deleted. n> and o> expect host variables>, host expressions>, or literals> with the type i>, which can represent all non-negative numbers of the value range of i> except its maximum value +2,147,483,647. If 0 is specified for n>, this maximum value is used. If 0 is specified for o>, the addition OFFSET> is ignored. Only the types b>, s>, i>, or int8> can be specified. If n> or o> is specified as a literal or constant, the value 0 is not allowed. The addition ORDER BY> has the same syntax and semantics> as in the SELECT>> statement, with the difference that it is not possible to sort explicitly by the client column> in the DELETE> statement. The SELECT>-specific restrictions, on the other hand, are ignored. BEGIN_SECTION VERSION 5 OUT The additions OFFSET> and UP TO> cannot be used when accessing DDIC projection views>. END_SECTION VERSION 5 OUT