ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → ABAP SQL → ABAP SQL - Reads → SELECT clauses → SELECT - INTO, APPENDING
SELECT - extended_result
Other versions:
7.31 | 7.40 | 7.54
Syntax
... EXTENDED RESULT @oref ...
Effect
The EXTENDED RESULT
addition of the INTO
clause can be used to provide an extended result of the current
main query in a result object. After EXTENDED RESULT
you must specify an
object reference variable oref
of static type for the documented class
CL_OSQL_EXTENDED_RESULT as a
host variable, which points to an object of the class. The reference variable must be prefixed with the escape character @
.
The following applies for use of EXTENDED RESULT
:
- The reference variable must not be initial and the object generation must be carried out before execution of the ABAP SQL statement. Parameters specifying which values the extended result should include must be passed to the instance constructor of class CL_OSQL_EXTENDED_RESULT.
-
If possible, the result object is supplied with the requested values at first database access.
- If a loop is opened with the statements
SELECT
orWITH
, the result object is supplied once at entry into the loop.
- If the
INTO
clause afterFETCH
is used for the results set of a database cursor that is opened with OPEN CURSOR, the result object is filled once in the firstFETCH
statement.
-
After the ABAP SQL statement is closed, the required values can be read using the instance methods of
the class. If the result object does not then contain any results, or no valid results, an exception of the class CX_OSQL_EXTENDED_RESULT is raised.
Note
The addition EXTENDED RESULT
can currently only be used for access to
cached views of the SAP HANA database.
Example
Excerpt from the executable example SAP HANA, Cached Views.
DATA(extended_result) =
NEW cl_osql_extended_result( iv_cached_view = abap_true ).
SELECT carrid,
MAX( fldate ) AS max_fldate ,
MIN( price ) AS min_price,
SUM( seatsocc ) AS sum_seatsocc
FROM demo_cds_cached_view
GROUP BY carrid
%_HINTS HDB 'RESULT_CACHE'
INTO TABLE @DATA(result)
EXTENDED RESULT @extended_result.