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

CURSOR - FETCH Error -- Invalid interruption of a database selection.

former_member206396
Active Participant
0 Likes
678

Hi SDNs,

When i fetch multiple records using fetch cursor command, getting short dump...

error:

Invalid interruption of a database selection.

Code as follows:

declaration :

DATA: BEGIN OF T_BSIS OCCURS 100.

INCLUDE STRUCTURE BSIS.

DATA: END OF T_BSIS.

DO.

OPEN CURSOR C_NEW FOR

SELECT * FROM BSIS

WHERE BUKRS EQ P_BUKRS

AND HKONT EQ P_SAKNR

AND GJAHR EQ P_GJAHR

AND BELNR IN P_BELNR

AND MONAT IN S_MONAT

AND XOPVW EQ 'X'.

DO.

IF FLAG NE 'X'.

FETCH NEXT CURSOR C_NEW INTO TABLE T_BSIS PACKAGE SIZE 100. " WA_BSIS.

IF SY-SUBRC <> 0.

CLOSE CURSOR C_NEW.

FLAG = 'X'.

ELSE.

FILL = SY-DBCNT.

*--- PROTOCOL -


LOOP AT T_BSIS.

PERFORM SAVE_PROTOCOL USING T_BSIS-BELNR T_BSIS-GJAHR

1 'BSIS' CHAR_S 1.

ENDLOOP.

SORT T_BSIS BY MANDT BUKRS BELNR GJAHR.

IF SY-TFILL EQ 0.

EXIT.

ENDIF.

LOOP AT T_BSIS.

PERFORM BSEG_UPDATE.

PERFORM BSIS_UPDATE.

ENDLOOP.

ENDIF.

IF FLAG = 'X'.

EXIT.

ENDIF.

ENDIF.

ENDDO.

*

PERFORM WRITE_LIST_PROTOCOL.

COMMIT WORK.

ENDDO.

Here syntax is OK, unable to get why the its going to short dump. Could any one please help me out..

Thanks

Ram.

2 REPLIES 2
Read only

Former Member
0 Likes
404

Rama,

refer:

Just go through the following link:

As Sooness pointed out, SELECT-ENDSELECT dumps only the first time. Try re-executing it and it will work fine.

Meanwhile, it is always better to use INTO TABLE OF instead of SELECT-ENDSELECT, as this minimizes database hits.

Regards

Amit.

Read only

former_member206396
Active Participant
0 Likes
404

solved