Hello All,
I have been receiving the Runtime error
DBIF_RSQL_INVALID _CURSOR in my Zobject.
On the Production as we are expecting 3 Million records i used the COMMIT WORK statement inside the loop, so that once the record # reaches 10,000 it can free the memory space (Before i added the COMMIT WORK statement i was receiving the DBIF_RSQL_SQL_ERROR).
The main objective of this object is to delete the Orphan entries available in the table ZOMLT.
Code :
FORM DELETE_DATA.
DATA : CNTR TYPE I VALUE '0', "Total deleted records
CNTR1 TYPE I VALUE '0'. "Commit records
SORT ORPHAN_TAB BY MSG_ID.
WRITE :/ 'Message IDs of Orphan entries in ZOMLT'.
ULINE.
IF ORPHAN_TAB[] IS INITIAL.
WRITE :/ ' - None'.
ENDIF.
LOOP AT ORPHAN_TAB.
WRITE :/ ORPHAN_TAB-MSG_ID.
SELECT * FROM ZOMLT WHERE MSG_ID = ORPHAN_TAB-MSG_ID.
IF SY-SUBRC = '0'.
--> DELETE ZOMLT.
CNTR = CNTR + 1. "For total # of records
CNTR1 = CNTR1 + 1.
IF CNTR1 EQ 10000.
COMMIT WORK.
CLEAR CNTR1.
ENDIF.
so that after every 10,000 records deleted from ZOMLT we * are using COMMIT.
ENDIF.
ENDSELECT.
ENDLOOP.
Would be great to have the views to correct the above code.
Thank you,
- PSK