Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Using Cursors

Hello,

Can anyone tell me how to use cursors. I have a table with 1 million records,

I need to process 100000 records each time my select statement executes, process those records ,and get the next 100000.

Thanks, points are awarded

Tags:
Former Member
Former Member replied

DATA: lv_cursor TYPE cursor.

OPEN CURSOR WITH HOLD lv_cursor

FOR SELECT * FROM <table>

WHERE ...

DO.

FETCH NEXT CURSOR lv_cursor

INTO TABLE itab

PACKAGE SIZE 100000.

IF sy-subrc <> 0.

CLOSE CURSOR lv_cursor.

EXIT.

ENDIF.

...

ENDDO.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question