OPEN CURSOR 
Basic form 2
OPEN CURSOR [WITH HOLD] c FOR SELECT ... . 
Effect
Opens a database cursor c in a database
table
 or view for a SELECT
statement. The variable 
c must be of the type CURSOR.
You can use any SELECT statement that returns a table,
but not a single record, as a result. When the cursor has been opened, the dataset specified with 
SELECT can be read with FETCH
until the cursor is closed. 
 
OPEN CURSOR belongs
to the Open SQL command set. 
 
If you attempt to open a cursor that has already been opened, you get a runtime error. 
 
The following events close a cursor:
- 
The CLOSE CURSOR statement.
 
- 
The Open SQL statement COMMIT WORK
 
- 
A database commit in Native SQL. In this case, a cursor opened with WITH HOLD is not closed.
 
- 
The Open SQL statement ROLLBACK WORK
 
- 
A database rollback in Native SQL
 
- 
A screen change, in particular the statements 
CALL SCREEN, CALL DIALOG,
CALL TRANSACTION, MESSAGE
 
- 
A Remote Function Call, in particular the statements 
CALL FUNCTION ... DESTINATION
, CALL FUNCTION
... STARTING NEW TASK
, CALL FUNCTION
... IN BACKGROUND TASK and WAIT. 
 
Example
Open the database cursor 
C1 in the database table SFLIGHT for a SELECT statement 
DATA: C1 TYPE CURSOR. 
 
OPEN CURSOR C1 FOR 
     SELECT * FROM SFLIGHT WHERE CARRID = 'LH '. 
Notes
- 
In the above example, the 
OPEN statement contains no INTO
clause. With cursor processing, you must always specify the target area for the selected data in the FETCH statement. 
 
- 
The OPEN CURSOR statement allows you to open several cursors
at the same time in a table. Unlike with SELECT, you thus have several independent access paths to this table. 
 
- 
Since you can open only a restricted number of cursors at the same time, you should close cursors that
are no longer required with CLOSE CURSOR. 
 
- 
Since the OPEN statement does not support authorization checks, you must program these yourself. 
 
Related
SELECT, FETCH and CLOSE. 
Additional help
Reading Data by Cursor