sapdev logo background
sapdev logo sapdev logo
Comments

ABAP DELETE DBTAB Statement syntax, information and example SAP source code



Return to Statement index



DELETE dbtab

Short Reference

ABAP Syntax DELETE { {FROM target [WHERE sql_cond ]}
| { target FROM source } }.

What does it do? The statement DELETE deletes one or more rows from the database table specified in target . The rows that are to be deleted are declared either in a WHERE condition sql_cond or with data objects in source .

System Fields
The statement DELETE sets the values of the system fields
sy-subrc and sy-dbcnt .

sy-subrc Meaning
0When the WHERE condition was declared, at least one row was deleted. When a work area in source was declared, the declared row was deleted. In the declaration of an internal table in source
, all declared rows were deleted or the internal table is empty. If no conditions were declared, all rows were deleted.
4When a WHERE condition or a work area in source was declared, no rows were deleted. When an internal table in source was declared, not all of the specified rows were deleted. If no conditions were specified, no rows were deleted, since the database table was already empty.

The statement DELETE sets sy-dbcnt to the number of deleted rows. If an overflow occurs because the number or rows is greater than 2,147,483,647, sy-dbcnt is set to -1.

Latest notes: The rows are deleted permanently from the database table in the next database commit . Until that point, they can still be undone using a database rollback
The statement DELETE sets a
database lock until the next database commit or rollback. If used incorrectly, this can produce a deadlock
.
The number of rows that can be deleted from the tables of a database within a database LUW is limited, since a database system can only manage a limited amount of locks and data in the rollback area.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




DELETE_DATASET_SYNTAX
DELETE_DBTAB_OBSOLETE




comments powered by Disqus