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

Something about open cursor .

Former Member
0 Likes
324

Guys , I need an advice, I'm doing the following code, but I´n not sure if it can work or could be very slow , the thing is that que ti_referenc could have more than 1 million entries , what else is possible to do ?

LOOP AT ti_referenc.

OPEN CURSOR WITH HOLD cursor1 FOR

SELECT * FROM zpf_cob_doc_ext

WHERE referencia = ti_referenc-ref.

FETCH next cursor cursor1

APPENDING CORRESPONDING FIELDS OF TABLE it_zpf_cob_doc_ext

PACKAGE SIZE p_commit.

CLOSE CURSOR cursor1.

ENDLOOP.

thank you a lot.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
293

hi,

You can even add additional code as below ..

OPEN CURSOR WITH HOLD cursor1 FOR

SELECT * FROM zpf_cob_doc_ext

WHERE referencia = ti_referenc-ref.

DO.

FETCH next cursor cursor1

APPENDING CORRESPONDING FIELDS OF TABLE it_zpf_cob_doc_ext

PACKAGE SIZE p_commit.

IF sy-subrc <> 0.

CLOSE CURSOR cursor1.

EXIT.

ENDIF.

ENDDO.

1 REPLY 1
Read only

Former Member
0 Likes
294

hi,

You can even add additional code as below ..

OPEN CURSOR WITH HOLD cursor1 FOR

SELECT * FROM zpf_cob_doc_ext

WHERE referencia = ti_referenc-ref.

DO.

FETCH next cursor cursor1

APPENDING CORRESPONDING FIELDS OF TABLE it_zpf_cob_doc_ext

PACKAGE SIZE p_commit.

IF sy-subrc <> 0.

CLOSE CURSOR cursor1.

EXIT.

ENDIF.

ENDDO.