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

Commit work inside Open cursor : Please help

Former Member
0 Likes
351

Hi Friends,

I'm using open cursor for performance purpose as I'be to pull a large no. of records. Inside the do -enddo, I've to update a Ztable. So, after using the insert statement, I put " commit work" but it started giving dump because it resets the cursor. To avoid that I used the function module "DB_commit" but it's not updating the records in Ztable. code is like this.

OPEN CURSOR WITH HOLD lv_bsak_dbcur1 FOR

SELECT bukrs augbl auggj kostl prctr gsber aufnr

lifnr umskz augdt gjahr belnr buzei budat bldat cpudt

waers bschl shkzg mwskz dmbtr wrbtr sgtxt saknr

zfbdt zterm zbd3t zlsch hbkid rebzg rebzj rebzz fistl

geber bstat FROM bsak

WHERE gjahr IN r_gjahr

ORDER BY bukrs augbl auggj kostl prctr gsber aufnr.

DO.

REFRESH it_bsak.

FETCH NEXT CURSOR lv_bsak_dbcur1

APPENDING CORRESPONDING FIELDS OF TABLE it_bsak

PACKAGE SIZE iv_fetch_batch_size.

IF NOT sy-subrc IS INITIAL.

CLOSE CURSOR lv_bsak_dbcur1.

EXIT.

ENDIF.

IF NOT it_bsak IS INITIAL.

*

*

some process to form fina table

*

*

insert ztable from table it_final.

if sy-subrc is initial.

call function "DB_commit".

endif.

if I'll use "commit work", it'll give dump.

Please advise as what to do so that Dump can be avoided & records cab updated as well.

Thanks:

Gaurav

1 REPLY 1
Read only

Former Member
0 Likes
294

Moderator message - Cross post locked Rob