Application Development 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: 

Advice about a select *

Former Member
0 Kudos

Hi Guys , I´m using a open cursor statement, what happened about the following code : LOOP AT ti_referencias.

OPEN CURSOR WITH HOLD cursor1 FOR

SELECT * FROM zpf_cob_doc_ext

WHERE referencia = ti_referencias-ref

ORDER BY referencia ASCENDING.

DO.

FETCH NEXT CURSOR cursor1

INTO CORRESPONDING FIELDS OF TABLE it_zpf_cob_doc_ext

PACKAGE SIZE p_commit.

IF sy-subrc NE 0.

EXIT.

ENDIF.

ENDDO.

CLOSE CURSOR cursor1.

ENDLOOP.

it_zpf_cob_doc_ext

only keeps the last register , why ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Maybe you need


FETCH NEXT CURSOR cursor1
INTO CORRESPONDING FIELDS OF it_zpf_cob_doc_ext
PACKAGE SIZE p_commit.
append  it_zpf_cob_doc_ext.

or


FETCH NEXT CURSOR cursor1
APPENDING CORRESPONDING FIELDS OF TABLE it_zpf_cob_doc_ext
PACKAGE SIZE p_commit.

Edited by: Ramiro Escamilla on Apr 8, 2008 6:32 PM

1 REPLY 1

Former Member
0 Kudos

Maybe you need


FETCH NEXT CURSOR cursor1
INTO CORRESPONDING FIELDS OF it_zpf_cob_doc_ext
PACKAGE SIZE p_commit.
append  it_zpf_cob_doc_ext.

or


FETCH NEXT CURSOR cursor1
APPENDING CORRESPONDING FIELDS OF TABLE it_zpf_cob_doc_ext
PACKAGE SIZE p_commit.

Edited by: Ramiro Escamilla on Apr 8, 2008 6:32 PM