SAP DELETE WHERE ABAP Statements

Get Example source ABAP code based on a different SAP table
  



DELETE dbtab - cond

Short Reference
• WHERE DELETE dbtab


ABAP Syntax ... WHERE sql_cond.


What does it do? The WHERE addition uses a logical expression sql_cond to specify which rows are deleted from the database table. The same rules apply to the logical expression sql_cond as to the WHERE condition of the SELECT statement, with the exception that subqueries cannot be evaluated in the database table to be changed. If there is no row in the database that fulfills the WHERE condition, a row is not deleted and sy-subrc is set to 4. If a WHERE condition is not specified, all rows are deleted.



Example ABAP Coding
All of an airline's flights that are scheduled for today and in which no seats are occupied are deleted from database table SFLIGHT (also see the example for dtab-source). PARAMETERS p_carrid TYPE sflight-carrid.

DELETE FROM sflight
WHERE carrid = p_carrid AND
fldate = sy-datum AND
seatsocc = 0.

Return to menu