DELETE - Short form

Syntax

DELETE { dbtab | *dbtab } [VERSION vers].

Addition:

... VERSION vers

Effect

Without the VERSION addition, this statement is a short form of the following Open SQL statement for accessing a single database table dbtab:

DELETE dbtab FROM { dbtab | *dbtab }.

In the short form, you do not explicitly specify a work area. A table work area dbtab or *dbtab is implicitly used as a work area and must be declared using TABLES. If you use *dbtab instead of the name of the database table dbtab, the table dbtab is still accessed, but the additional table work area is used.

Addition

... VERSION vers

Effect

With the VERSION addition, the database table can be dynamically specified in the short form of DELETE if its name begins "T" and consists of no more than five characters. The database table is accessed whose name is made up of "T" and the contents of vers. For vers, you must specify a data object of type c with a maximum of four characters. The row contents are still assigned to the table work area of dbtab or dbtabc and its type is cast. The statement is not executed if the database table does not exist or does not comply with the naming conventions outlined above.

Note

The short form and the VERSION addition are not allowed in classes. Explicit work areas must be used instead. Rather than using the VERSION addition, you should, in Open SQL, dynamically specify the database table at its operand position.

Example

TABLES t100.
DATA vers TYPE c LENGTH 4.
...
vers = '100'.
...
t100-sprsl = 'E'.
t100-arbgb = 'BC'.
t100-msgnr = '100'.
DELETE t100 VERSION vers.

The Open SQL syntax to be used instead is:

DATA: wa TYPE t100,
      dbtab TYPE c LENGTH 5.
...
dbtab = 'T100'.
...
wa-sprsl = 'E'.
wa-arbgb = 'BC'.
wa-msgnr = '100'.
DELETE (dbtab) FROM wa.