ABAPEXEC_CURSOR - EXEC CURSOR
BAL_S_LOG - Application Log: Log header data Fill RESBD Structure from EBP Component StructureThis documentation is copyright by SAP AG.
EXEC SQL - OPEN, CLOSE, FETCH
In Native SQL, similar statements for reading data using adatabase cursor as inOpen SQL can be specified.
Syntax
EXEC SQL.
OPEN dbcur FOR SELECT ...
ENDEXEC.
Effect
Opens a database cursor dbcur. For dbcur, aflat character-typehost variable can be specified.
Syntax
EXEC SQL.
FETCH NEXT dbcur INTO ...
ENDEXEC.
Effect
Reads data using an open database cursor dbcur.
Syntax
EXEC SQL.
CLOSE dbcur
ENDEXEC.
Effect
Closes an opened database cursor dbcur.
If no row can be read using FETCH, sy-subrc is set to 4 by ENDEXEC. The systemfield sy-dbcnt is set, after a FETCH statement, to the number of rows read up to that point using the respective cursor.
Note
Whether the database cursor on the database is implicitly closed after the extraction of the last rowof the result set or not, depends on the database system used. For this reason, it is advisable to explicitly use the CLOSE dbcur statement.
Example
Reading several rows from the database table SPFLI using cursor handling and host variables in Native SQL. If rows were found, sy-subrc is set to 0 and sy-dbcnt is increased by one for each row read.
PARAMETERS p_carrid TYPE spfli-carrid.
DATA: connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto.
EXEC SQL.
OPEN dbcur FOR
SELECT connid, cityfrom, cityto
FROM spfli
WHERE mandt = :sy-mandt AND
carrid = :p_carrid
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT dbcur INTO :connid, :cityfrom, :cityto
ENDEXEC.
IF sy-subrc <> 0.
EXIT.
ELSE.
...
ENDIF.
ENDDO.
EXEC SQL.
CLOSE dbcur
ENDEXEC.
TXBHW - Original Tax Base Amount in Local Currency ROGBILLS - Synchronize billing plans
This documentation is copyright by SAP AG.
Length: 3367 Date: 20120522 Time: 053214 triton ( 86 ms )






