ABAP Open/ Fetch Cursor

 The Open SQL 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 results set of the main query can be read with the statement FETCH.

If the addition WITH HOLD is specified, the database cursor is not closed by a database commit executed using Native SQL.

Syntax

OPEN CURSOR [WITH HOLD] @dbcur|@DATA(dbcur) FOR
  [WITH
    +cte1 AS ( SELECT subquery_clauses )[,
    +cte2 AS ( SELECT subquery_clauses )
    ...]]
  SELECT mainquery_clauses
  [UNION ...]
  [UP TO ...] [OFFSET ...]
  [abap_options].


Fetch cursor

The Open SQL statement FETCH extracts the requested rows (using the addition INTO or APPENDING) from the results set of the database cursor (associated with the cursor variable dbcur) from the current cursor position and assigns these rows to the data objects specified in the results set.

FETCH NEXT CURSOR dbcur INTO|APPENDING ....


Comments

Popular posts from this blog

FP_JOB_CLOSE throws an exception. (sy-subrc 2: system error)

rough notes