1. UPDATE dbtab SET
f1 ... fn. or
UPDATE (dbtabname) SET f1 ... fn.
2. UPDATE dbtab FROM
wa. or
UPDATE (dbtabname) FROM wa.
3. UPDATE dbtab FROM
TABLE itab. or
UPDATE (dbtabname) FROM TABLE itab.
4.
UPDATE dbtab. or
UPDATE *dbtab.
Updates values in a database table (see Relational
Databases
). You can specify the name of the database table either directly in the form
dbtabor at runtime as
contents of the field dbtabname. In both cases, the table must be known to the ABAP Dictionary.
Normally, lines are updated only in the current client. Data can only be updated using a view
if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status
"No restriction".
UPDATE belongs to the Open SQL command set.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.See Open SQL and Unicode.
UPDATE dbtab SET f1
... fn. or
UPDATE (dbtabname) SET f1 ... fn.
1. ... WHERE
condition
2. ...
CLIENT SPECIFIED
3. ... CONNECTION con
Updates values in a database table. If there is no WHERE clause, all lines
(in the current client) are updated. If a WHERE condition
is specified, only thoserecords which satisfy the WHERE
condition are updated.
The SET clause f1
... fn
identifies the columns to be updated and assigns values to them. Four types of SET statements fi are supported:
Changing the discount to 3 percent for all customers in the current client:
UPDATE scustom SET discount = '003'.
The same example using a dynamic SET condition:
DATA: tabname TYPE STRING,
set_clause TYPE
STRING.
tabname = 'SCUSTOM'.
set_clause = 'DISCOUNT = ''003'' '.
UPDATE (tabname) SET (set_clause).
When the command has been executed, the system field SY-DBCNT contains the number of updated lines.
System values
1. ... CLIENT
SPECIFIED
2. ... CONNECTION con
Mass update of several lines in a database table. Here, the primary
key for identifying the lines to be updated and the values to be changed are taken from the lines
of the internal table itab. The lines of the internal
table must satisfy the same conditions as the work area wa
in addition 1 to variant 2.
The system field SY-DBCNT
contains the number of updated lines, i.e. the number of lines in the internal table
itab which have key values corresponding to lines in the database table.
The Return Code is set as follows:
If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0.
... CLIENT SPECIFIED
As with the variant UPDATE dbtab SET ....
... CONNECTION con
As with the variant UPDATE dbtab SET ....
UPDATE dbtab.
UPDATE *dbtab.
1. ... CLIENT
SPECIFIED
2. ... CONNECTION con
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas.See Cannot Use Short Forms and Cannot Use an Asterisk To Indicate a Work Area.
This variant is obsolete.
These are the SAP-specific forms of variant 2. They have the same effect as variant 2, except that you do not declare the work area explicitly. Instead, the program uses the table work area dbtab or *dbtab, declared in a TABLES statement.
is thus equivalent to:
After the statement has been executed, the system field SY-DBCNT contains the number of updated lines (0 or 1).
Changing the discount for the customer whose customer number is '00017777' to 3 percent (in the current client):
TABLES SCUSTOM.
SCUSTOM-ID = '00017777'.
SCUSTOM-DISCOUNT = '003'.
UPDATE SCUSTOM.
If a work area is not declared explicitly, the values for the line to be updated are also taken from
the table work area, dbtab, if the statement is included
in a FORM or FUNCTION , in which the table work area is obscured by a formal parameter or a local variable with the same name.
The Return Code is set as follows:
... CLIENT SPECIFIED
As with the variant UPDATE dbtab SET ....
... CONNECTION con
As with the variant UPDATE dbtab SET ....