ABAP Keyword Documentation → ABAP - Quick Reference
OPEN CURSOR - Quick reference
Other versions: 7.31 | 7.40 | 7.54
Syntax
OPEN CURSOR [WITH HOLD] @dbcur FOR
[WITH
+cte1 AS subquery[,
+cte2 AS subquery
...]]
SELECT { ...
FROM ... }
| { FROM ...
FIELDS ... }
[[FOR ALL ENTRIES IN itab] WHERE
sql_cond]
[GROUP BY ...] [HAVING sql_cond]
[ORDER BY ...]
[UP TO n ROWS]
[OFFSET o]
[BYPASSING BUFFER]
[CONNECTION con|(con_syntax)].
Effect
ABAP SQL statement. Opens a
database cursor for
the selection defined using SELECT
and associates a cursor variable dbcur
with this database cursor.
Additions
-
WITH +cte
Introduces a common table expression+cte
. -
WITH HOLD
Leaves the cursor open in the case of an explicitly triggered database commit or database rollback. -
[FIELDS] ...
Defines a selection set. -
FROM ...
Specifies the database table(s). -
[FOR ALL ENTRIES IN itab] WHERE sql_cond
Specifies a condition for the results set. -
GROUP BY ... [HAVING sql_cond]
Groups rows and sets a condition on the grouped rows. -
ORDER BY ...
Sorts the results set. -
OFFSET, UP TO
Restricts the results set. -
BYPASSING BUFFER, CONNECTION
ABAP-specific additions.