Ansicht
Dokumentation

ABAPDELETE_SOURCE - DELETE SOURCE

ABAPDELETE_SOURCE - DELETE SOURCE

General Material Data   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

DELETE dbtab, source

Short Reference



... ${@wa$|@( expr )$}
  $| ${TABLE @itab$|@( expr )$} ...



Alternatives:

1. ... @wa$|@( expr )

2. ... TABLE @itab$|@( expr )

Effect

In the variant DELETE target FROM of the statement DELETE, a non-table-like data object can be specified after FROM, or an internal table after TABLE can be specified as a host variable or host expression. The content of the data objects determines which rows are deleted. Like every host variable, the name of the work area or internal table must be prefixed by the escape character @.

Note

Host variables without the escape character @ are obsolete. The escape character @ must be specified in the strict modes of the syntax check from Release .

Alternative 1

... @wa$|@( expr )


Effect

If a non-table-like work area is specified as a host variable @wa or host expression @( expr ), a row is searched in the DDIC database table whose primary key content is the same as that of the corresponding initial part of the work area. The content of the work area is not converted and is interpreted according to the structure of the DDIC database table or DDIC view. This row is deleted. The work area must meet the prerequisites for use in statements.

If there is no row in the database with the same content as the primary key, no row is deleted and sy-subrc is set to 4.

Notes

  • The work area wa should be declared with reference to the DDIC database table or DDIC view in ABAP Dictionary using the length of the primary key.
  • If a constructor expression is specified as a host expression for the work area wa, for which the data type is inferred using the # character, a structure consisting of the components of the primary key of the DDIC database table is created as the type.
  • If the DDIC database table or DDIC view is specified statically, a short form can be specified outside of classes. This means that the work area specified using FROM wa can be omitted if a table work area dbtab for the respective DDIC database table or the DDIC view is declared using the statement TABLES. The system then implicitly adds the addition FROM dbtab to the DELETE statement.

Example

Deletion of a carrier from the DDIC database table SCARR using a host expression.

Alternative 2

... TABLE @itab$|@( expr )


Effect

If an internal table is specified as a host variable @itab or host expression @( expr ), the system processes all rows of the internal table in accordance with the rules for the work area wa. The row type of the internal table must meet the prerequisites for use in statements.

If, for a row of the internal table, there is no row in the database with the same content as the primary key, the corresponding row is ignored and sy-subrc is set to 4. If the internal table is empty, no rows are deleted. However, sy-subrc is still set to 0. The system field sy-dbcnt is set to the number of rows that are actually deleted.

Notes

  • When an internal table is used, package-by-package processing causes some of the rows being deleted to still be visible to any read access running in parallel with DELETE.
  • If an internal table itab is specified using a host expression that is a constructor expression for which the data type is inferred using the # character, a structured standard table with an empty table key whose row type consists of the components of the primary key of the DDIC database table is created as the type.

Example

Deletion of all today's flights of an airline in which no seats are occupied from the DDIC database table SFLIGHT. The internal table from which the key values of the deleted rows are taken is obtained in a host expression using a method call. The client field must occur in the row structure of the internal table with the type sflight_key_tab to ensure that its components match the primary key of the DDIC database table. This example works in the same way as DELETE dbtab - cond, but it requires the database to be accessed twice.






General Material Data   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 6801 Date: 20240329 Time: 101309     sap01-206 ( 143 ms )