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

Use of commit for the asynchronous proxy call on the fetch Cursor loop

nidhiagarwal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,258

Hi members,

I need to fetch the data in packages from the HANA view ( with help of external view), I have used the Cursor statement to do so.

In  the Cursor fetch loop, i need to pass on that data to the asynchronous proxy method. I have to commit after sending the data to asynchronous proxy method. I tried it using the following approaches:

1. Using FM DB_COMMIT : the PI messages are still in the "message recorded,commit missing" status.

2. Using COMMIT WORK : The cursor is invalidated.

I can do the commit work after the Cursor loop, but this approach will keep all the messages in PI queue untill it gets the commit statement.

Please guide as how can this be resolved.

TRY.

       OPEN CURSOR WITH HOLD c FOR SELECT DISTINCT .....

                            FROM      ...

                            WHERE ...

       DO.

FETCH NEXT CURSOR  c INTO CORRESPONDING FIELDS OF TABLE lt_initiative PACKAGE SIZE gv_package_size.

:

:

--call to asynchronous PI message

" need to commit here



END DO.

close cursor c.

{ commit work here works fine}

Regards,

Nidhi

3 REPLIES 3
Read only

thomasgauweiler
Employee
Employee
0 Likes
986

Dear Nidhi,

this behavior is independent of the source of your select statement, it also would happen if you select a plain database table.

There is no way to keep an cursor open and doing a COMMIT WORK.

If your result set is not too large, you could do a SELECT ... INTO TABLE <itab> and then LOOP over the internal table.

Otherwise, you must explicited SELECT the data packages in sizes which you can process together and do an COMMIT WORK.

Best Regards, Thomas

Read only

nidhiagarwal
Product and Topic Expert
Product and Topic Expert
0 Likes
986

Hi Thomas,

Thanks for your inputs.

I have one question that the use of DB_COMMIT FM does not call any problem in the CURSOR, somehow it does not cause the commit for proxy messages also.

Any inputs on why is this behavior shown?

Regards,

Nidhi

Read only

0 Likes
986

Hi Nidhi,

How you solved this issue ...can you please guide.

It will be very helpful.

Thanks.