SAP ABAP SYNTAX FOR DELETE PART TWO

Variant 2

DELETE dbtab.
DELETE *dbtab.
DELETE (dbtabname) ...

Additions

1. ... FROM wa
2. ... CLIENT SPECIFIED

Effect

These are SAP-specific short forms used to delete a single line of a database table. If the name of the database table is specified in the program, the primary key of the line to be deleted is taken from the specified work area - dbtab or *dbtab . If the name of the database table is not determined until runtime ( DELETE (dbtabname) ... ), the addition ... FROM wa is obligatory .

When the statement has been executed, the system field SY-DBCNT contains the number of deleted lines (0 or 1).

The return code value is set as follows:


SY-SUBRC = 0 The line was deleted.
SY_SUBRC = 4 No lines could be deleted, since no line exists with the primary key specified.

Example

Delete the booking with the booking number 3 for the Lufthansa flight 0400 on 28.02.1995 (in the current client):
 
TABLES SBOOK.
SBOOK-CARRID = 'LH'.
SBOOK-CONNID = '0400'.
SBOOK-FLDATE = '19950228'.
SBOOK-BOOKID = '00000003'.
 DELETE  SBOOK.

Addition 1

... FROM wa

Effect

Takes the primary key for the line to be deleted not from the table work area dbtab , but from the explicitly specified work area wa . Here, the key values from left to right are taken from wa according to the structure of the primary key in the table work area dbtab . The structure of wa is not taken into account. Therefore, the work area wa must be at least as wide as the primary key in the table work area dbtab and the alignment of the work area wa must correspond to the alignment of the primary key in the table work area. Otherwise, you get a runtime error.

Note

If a work area is not explicitly specified, the values for the line to be deleted are taken from the table work area dbtab , even if the statement appears in a subroutine or Funktionsbaustein where the table work area is stored in a formal parameter or a local variable of the same name.

Addition 2

... CLIENT SPECIFIED

Effect

As with variant 1. 


RELATED POST

SAP ABAP SYNTAX FOR DELETE PART ONE
SAP Authorization and ALE
Authorization and implementation of SAP
Mysap market place introduction

No comments :

Post a Comment