CLOSE CURSOR @dbcur.
This ABAP SQL statement
CLOSE CURSOR closes the
initializes the cursor variable
dbcur, with which the database cursor is linked. The cursor variable
dbcur is a
host variable that must be declared using
the special predefined data type
cursor and that was opened using the statement
OPEN CURSOR or was assigned an open cursor.
- Since only a limited number of 17 database cursors can be open simultaneously in ABAP SQL, all database cursors no longer required should be closed.
Initializing a cursor variable using the
CLEARstatement is not enough to close a database cursor. If the value of the cursor variable in the program is known, the database cursor can be further processed using
- Once a database cursor has been closed, it can no longer be accessed. Other cursor variables that were associated with the database cursor are not initialized, but become invalid and accessing them would raise a handleable exception.
The name of the host variable
dbcurshould be prefixed with the escape character
@. If the associated statement
OPEN CURSORis checked in accordance with the strict mode from Release 7.50, the escape character
@must be specified.
Closes a previously opened and used database cursor.
DATA wa TYPE scarr. OPEN CURSOR WITH HOLD @DATA(dbcur) FOR SELECT * FROM scarr. WHILE sy-subrc = 0. FETCH NEXT CURSOR @dbcur INTO @wa. ENDWHILE. CLOSE CURSOR @dbcur.