We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!
OPEN CURSOR $[WITH HOLD$] @dbcur$|@DATA(dbcur) FOR
$[WITH
+cte1 AS ( SELECT subquery_clauses )$[,
+cte2 AS ( SELECT subquery_clauses )
...$]$]
SELECT mainquery_clauses
$[UNION$|INTERSECT$|EXCEPT ...$]
$[UP TO ...$] $[OFFSET ...$]
$[abap_options$].
The statement OPEN CURSOR opens a database cursor for the result set of the main query defined after FOR and links a cursor variable dbcur with this database cursor. The result set of the main query can be read with the statement FETCH.
The main query is specified after FOR as follows:
The following can be specified for the cursor:
A row of the result set is always assigned to an opened database cursor as a cursor position. After the statement OPEN CURSOR, the database cursor is positioned in front of the first row of the result set.
In a program, a maximum of 17 database cursors can be open simultaneously across the interface. If an attempt is made to open more than 17 database cursors, the runtime error DBSQL_TOO_MANY_OPEN_CURSOR occurs. An open database cursor can be closed using the statement CLOSE CURSOR. In addition, any open database cursors are closed by database commits or database rollbacks if these occur after the first use of the cursor in a FETCH statement.
If a cursor variable dbcur of an open database cursor is assigned to another cursor variable or passed as a parameter, the latter is linked with the same database cursor at the same position. A cursor variable of an open database cursor can also be passed to externally called procedures to access the database cursor from there.
Opens two cursors for the DDIC database table SPFLI. For more information on how to use this function, see the example for FETCH.
... WITH HOLD
If the addition WITH HOLD is specified, the database cursor is not closed in a database commit executed using Native SQL.
The addition WITH HOLD can be used only in reads performed on the standard database. It cannot be specified together with the addition CONNECTION.
The addition WITH HOLD prevents the database cursor from being closed using an explicit database commit with the statement COMMIT CONNECTION and hence prevents an exception from being raised in the second FETCH statement. An exception is, however, raised after the statement COMMIT WORK.
Leave us your contact details and we will call you back. Fields marked with * are mandatory.
We offer holistic SAP solutions from a single source to shape digital change and develop new business areas.
Switzerland
Schaffhausen
Germany
Mannheim, Düsseldorf, Munich
USA
Haverhill
Greece
Thessaloniki