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

Former Member
0 Likes
867

Hello,

I have some problems..maybe you have suggestions...

I fill some internal table in a loop, which is included in an open cursor ...close cursor instruction.

Outside the loop, but in the same open cursor ...close cursor instruction, I move the records from the internal table into a database table.

Now..the purpose is to write a commit work to obtain the best performance.

I want that commit work to follow the insert into database table , but the cursor looses its index.

So I want to find a way to work with cursor and commit.

Please help .

Thank you.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
802

hello Anda,

There is no way by which you can write commit work inside OPEN CURSOR.

wat i will suggest is either use select statement and then COMMIT or COMMIT after close cursor.;

6 REPLIES 6
Read only

hymavathi_oruganti
Active Contributor
0 Likes
802

insert into dbtab statement automatically uses commit and i think there is no need to use explicit commit work.

Read only

Former Member
0 Likes
802

hii

pls try commit work and wait

it may helps but it is synchronous process

Read only

Former Member
0 Likes
804

hello Anda,

There is no way by which you can write commit work inside OPEN CURSOR.

wat i will suggest is either use select statement and then COMMIT or COMMIT after close cursor.;

Read only

Former Member
0 Likes
802

Hi Anda,

Please check the following extract on "Commit" command..maybe you can be more clear on the work of the command

COMMIT WORK closes all open database cursors, any attempt to continue a SELECT loop after a COMMIT WORK results in a runtime error. For the same reason, a FETCH after a COMMIT WORK on the now closed cursors also produces a runtime error. You must therefore ensure that any open cursors are no longer used after the COMMIT WORK.

Regards

Byju

Read only

0 Likes
802

Hi byju,

Open Cursor can be used after COMMIT WORK.

If the cursor you are opening is another one.

Read only

Former Member
0 Likes
802

try using FM

BAPI_TRANSACTION_COMMIT.

WAIT = 'X'.