FETCH NEXT CURSOR c target.
Uses the cursor c to read the next line or lines
from the dataset of a database table determined by
OPEN CURSOR . The cursor must be a
variable of the type CURSOR and must be explicitly opened with
OPEN CURSOR . To specify the
target area into which you read the selected data, use
INTO clause target .
FETCH belongs to the Open SQL command
After each execution of the FETCH statement, the system field
SY-DBCNT contains the number of lines read so far.
The return code value is set as follows:
SY-SUBRC = 0
At least one line was read.
SY_SUBRC = 4
No line was read.
Output the passenger list for the Lufthansa flight 0400
DATA C TYPE CURSOR,
WA LIKE SBOOK.
OPEN CURSOR C FOR SELECT * FROM SBOOK
CARRID = 'LH ' AND
CONNID = '0400' AND
FLDATE = '19950228'
ORDER BY PRIMARY KEY.
FETCH NEXT CURSOR C INTO WA.
IF SY-SUBRC <> 0.
CLOSE CURSOR C. EXIT.
WRITE: / WA-BOOKID, WA-CUSTOMID, WA-CUSTTYPE,
WA-SMOKER, WA-LUGGWEIGHT, WA-WUNIT,
© SAP AG 1996