Ansicht
Dokumentation

ABAPDELETE_DBTAB - DELETE DBTAB

ABAPDELETE_DBTAB - DELETE DBTAB

CPI1466 during Backup   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

DELETE dbtab

Short Reference



DELETE ${ FROM target $[ connection$] $[ WHERE sql_cond$] $[db_hints$]
                                  $[ORDER BY ... $[OFFSET o$]$] $[UP TO n ROWS$]
$}
     $| ${ target $[ connection$] FROM source $}
       $[MAPPING FROM ENTITY$].



Variants:

1. DELETE FROM target ...

2. DELETE target FROM source.

3. ... MAPPING FROM ENTITY.

Effect

The statement DELETE deletes one or more rows from the DDIC database table or DDIC table view specified in target. The rows to be deleted can be specified as follows:

  • In a variant DELETE FROM target using conditions
  • In a variant DELETE target FROM using data objects in source

The addition connection can be used to specify a secondary connection.

System Fields

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

sy-subrc Meaning
0 In the variant DELETE FROM target, at least one row was deleted if a WHERE condition was specified and all or n rows were deleted if no condition was specified. In the variant DELETE target FROM, the specified row was deleted if a work area was specified in source and all specified rows were deleted if an internal table was specified in source or the internal table is empty.
4 In the variant DELETE FROM target, no row was deleted if a WHERE condition was specified or no row was deleted if no condition was specified, since the database table was already empty. In the variant DELETE target FROM, no row was deleted if a work area was specified in source or not all specified rows were deleted if an internal table was specified in source.

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.

Notes

  • The rows are deleted permanently from the DDIC database table in the next database commit. Until that point, they can still be undone using a database rollback The current isolation level defines whether the deleted data can no longer be read into other database LUWs before or only after the database commit.
  • 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.
  • The statement DELETE FROM dbtab has the statement DELETE FROM itab with identical syntax. If an internal table has the same name as a DDIC database table, a statement like this accesses the internal table.

Variant 1

DELETE FROM target ...


Effect

In the variant DELETE FROM target, either all rows are deleted or the rows to be deleted are restricted using a WHERE condition or additions ORDER BY, OFFSET, and UP TO.

Example

Deletion of a row in a DDIC database table. The row is specified using a WHERE condition.

Variant 2

DELETE target FROM source.


Effect

In the variant DELETE target FROM, either a row specified by a work area is deleted or multiple rows specified by an internal table are deleted.

Example

Deletion of a row in a DDIC database table. The row is specified using a work area.

Variant 3

... MAPPING FROM ENTITY.


Effect

The addition MAPPING FROM ENTITY is used to handle structures and internal tables that are typed with BDEF derived types. Find more information in the topic ABAP SQL Statements with MAPPING FROM ENTITY.






Vendor Master (General Section)   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 7950 Date: 20240328 Time: 115901     sap01-206 ( 102 ms )