06-01-2010 1:31 PM
Dear all, I have following problem...
I do a open cursor and fetch... than after 100000 records I need to save some data in a other table with insert.
when I do the commit work it will close all open database cursors...and the fetch will dump.
Is there not a command or Function Module which only close the database cursor which I did the insert ?
Or a commit work without closing database cursor.
OPEN CURSOR DBCURSOR FOR
SELECT * FROM Z1
WHERE f1 EQ P_F1
and f2 eq P_F2
ORDER BYf1 f2 f3.
CLEAR DB_INDEX.
DO.
FETCH NEXT CURSOR DBCURSOR INTO WA1.
IF SY-SUBRC EQ 0.
IF DB_INDEX GE 100000.
INSERT Z1 from it1.
**** commit work ****
CLEAR DB_INDEX.
refresh it1.
ENDIF.
ADD 1 TO DB_INDEX.
APPEND WA1 TO IT1.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE CURSOR DBCURSOR.
06-01-2010 5:30 PM
06-01-2010 1:40 PM
I don't think so. Whenever a COMMIT WORK is encountered all the DB cursors are closed.
Why do you need to do a COMMIT after the INSERT? You can COMMIT the DB changes in a single shot after your CLOSE CURSOR statement.
06-01-2010 5:30 PM
06-01-2010 6:13 PM
thx, it was the with hold and I forgot only the native sql statement so when I was using FM DB_COMMIT
it was working, thanks a lot