Open SQL in Release 3.0
Partial or complete specification of the WHERE condition at
runtime when calling SELECT
Specification of the name of the database table or of the view at
runtime when calling SELECT , INSERT , UPDATE ,
MODIFY and DELETE
Return of DUPREC errors from INSERT ... FROM TABLE itab
Union of solution sets for SELECT with FOR ALL ENTRIES in
itab
Reading database lines by packets in SELECT with PACKAGE
SIZE n
Explicit cursor processing
Select list with aggregate
functions in SELECT
INTO list for SELECT and FETCH
ABAP_MODIFICATION_1 Partial or complete specification of the
WHERE condition at runtime when calling
SELECT
The WHERE condition can be stored partially or entirely in an
internal table. This means you can construct WHERE conditions
dynamically at runtime. In contrast to a RANGES
table, an internal table stores a WHERE condition in textual
form. The internal table can then be accessed using
SELECT ... WHERE
(itab) or SELECT ... WHERE sql_cond AND (itab) . itab
refers to the name of the internal table and sql_cond to the
statically specified part of the WHERE condition.
Examples and further information may be found in the documentation for
the WHERE clause .
ABAP_MODIFICATION_2 Specification of the name of the database table
or of the view at runtime when calling SELECT
, INSERT , UPDATE
, MODIFY and
DELETE
The name of a database table or a view can be supplied dynamically as
the contents of a field. Instead of specifying the table name directly
in the source code, a field name in brackets is given. The contents of
this field are interpreted as the table name.
Examples and further information may be found in the documentation for
the FROM clause .
ABAP_MODIFICATION_3 Return of DUPREC errors from
INSERT ... FROM TABLE itab
In cases where one or several lines cannot be inserted because lines
with the specified keys already exist, a runtime error always occurred
in the past. The addition ... ACCEPTING DUPLICATE KEYS has the
effect of setting the return code SY-SUBRC to 4 rather than
aborting the process. The remaining lines are then added after the
command has been executed.
Further information may be found in the documentation of the command
INSERT .
ABAP_MODIFICATION_4 Union of solution sets for
SELECT with FOR ALL ENTRIES in itab
A SELECT command with ... FOR ALL ENTRIES IN itab WHERE
sql_cond forms the union of solution sets of all SELECT
commands that result if the fields of the internal table itab
referenced in the WHERE condition were to be replaced by the
actual values of a table line. This variant is very useful if, for
example, an internal table is filled with pre-specified
primary keys . All corresponding database
lines can be selected with a single SELECT command. This
technique avoids the need for a loop containing a SELECT SINGLE ...
for each line of the internal table.
Examples and further information may be found in the documentation for
the WHERE clause .
ABAP_MODIFICATION_5 Reading database lines by packets in
SELECT with PACKAGE SIZE n
SELECT ... INTO TABLE itab PACKAGE SIZE n places the selected
lines into the internal table in packets of n lines rather than
all at once. Each new packet overwrites the contents of itab .
This is a good way of making sure that the internal table does not get
too big. If PACKAGE SIZE is used with SELECT ... APPENDING
TABLE itab , the previous contents of itab are preserved and
each new packet is added at the end of the table.
Examples and further information may be found in the documentation for
the INTO clause .
ABAP_MODIFICATION_6 Explicit cursor processing
The commands OPEN CURSOR , FETCH and CLOSE CURSOR
enable nested processing of one or several database tables without the
need to keep redefining the datasets. By using the addition WITH
HOLD , you can open a cursor which is then preserved across
database commits .
Examples and further information may be found in the documentation for
the ABAP commands OPEN CURSOR ,
FETCH and CLOSE
CURSOR .
ABAP_MODIFICATION_7 Select list with
aggregate functions in
SELECT
Apart from SELECT * , SELECT COUNT( * ) and SELECT
SINGLE * , you can specify the aggregate functions MIN , MAX
, SUM , COUNT and AVG , and also fields of the
database table in the select list. Specifying DISTINCT causes
duplicate lines to be removed automatically from the solution set.
Examples and further information may be found in the documentation for
the SELECT clause .
ABAP_MODIFICATION_8 INTO list for SELECT
and FETCH
If the SELECT clause specifies a list, the INTO clause
can include a list of ABAP fields of equal length to be used as
the target area.
Examples and further information may be found in the documentation for
the INTO clause .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved