Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OPEN CURSOR & FETCH NEXT CURSOR?

Former Member
0 Likes
3,659

Hi All,

What is the exact purpose of OPEN CURSOR & FETCH NEXT CURSOR?

What should happen for below code.

IF NOT l_use_fae IS INITIAL.

OPEN CURSOR WITH HOLD viqmelst_cursor FOR

SELECT * FROM viqmelst

WHERE qmnum IN r_qmnum

AND qmart IN r_qmart

AND herkz IN r_herkz

AND equnr IN r_equnr

AND tplnr IN r_tplnr

AND aufnr IN r_aufnr

AND matnr IN r_matnr

AND mawerk IN r_mawerk

AND kunum IN r_kunum

AND AUSWIRK IN R_AUSWIRK

AND iloai EQ iwoa_c_x

AND qmdab NE '00000000' "n759927

AND qmdab LE x_qmdab

AND stat EQ p_status

ORDER BY qmnum.

FETCH NEXT CURSOR viqmelst_cursor

INTO CORRESPONDING FIELDS OF TABLE iselc

PACKAGE SIZE xpackage_size.

When im trying to execute the above code, fetch statement sy-subrc is 4.

Pls let me know why..? As per the above select, I have a data in the database table.

Puppy.

1 ACCEPTED SOLUTION
Read only

naveen_inuganti2
Active Contributor
0 Likes
1,255

Hi,

I have small experiance in this area.

So as of my knowledge this FETCH CURSOR will not you give result with debugging mode.

It will throughs dump, if you try to debugg that..loop(Hope you know that fetch cursor works like a loop).

--Naveen Inuganti

3 REPLIES 3
Read only

Former Member
0 Likes
1,255

Hi,

You can check below link for detail explanation.

Thanks,

Asit Purbey.

Read only

sarbajitm
Contributor
0 Likes
1,255

check the following link:

http://help.sap.com/abapdocu/en/ABAPINTO_CLAUSE.htm

http://help.sap.com/abapdocu/en/ABENOPEN_CURSOR_ABEXA.htm

Regards.

Sarbajit

Edited by: Sarbajit Majumdar on Mar 18, 2009 3:16 PM

Edited by: Sarbajit Majumdar on Mar 18, 2009 3:31 PM

Edited by: Sarbajit Majumdar on Mar 18, 2009 3:36 PM

Edited by: Sarbajit Majumdar on Mar 18, 2009 3:36 PM

Read only

naveen_inuganti2
Active Contributor
0 Likes
1,256

Hi,

I have small experiance in this area.

So as of my knowledge this FETCH CURSOR will not you give result with debugging mode.

It will throughs dump, if you try to debugg that..loop(Hope you know that fetch cursor works like a loop).

--Naveen Inuganti