Entering content frame

OPEN CURSOR Statement (open_cursor_statement) Locate the document in its SAP Library structure

An OPEN CURSOR statement (open_cursor_statement) generates the result table defined under the specified name with a DECLARE CURSOR statement.

Syntax

<open_cursor_statement> ::= OPEN <result_table_name>

Explanation

Existing result tables are implicitly deleted when a result table is generated with the same name.

All result tables generated within the current transaction are implicitly deleted at the end of the transaction using the ROLLBACK statement.

All result tables are implicitly deleted at the end of the session using the RELEASE statement. A CLOSE statement can be used to delete them explicitly beforehand.

If the name of a result table is identical to that of a base table, view table (see table), or a synonym, these tables cannot be accessed as long as the result table exists.

At any given time when a result table is processed, there is a position which may be before the first row, on a row, after the last row, or between two rows. After generating the result table, this position is before the first row of the result table.

The search strategy used determines how the search is carried out. When the OPEN CURSOR statement is executed, the system searches for all the rows in the result table and generates the result table physically. When a FETCH statement is executed, the system searches for the next relevant row in the result table but does not store it physically. This must be considered for the time behavior of open cursor statements and fetch statements.

If the result table is empty, the return code 100 – row not found - is set.

 

Leaving content frame