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

DBIF_RSQL_INVALID_CURSOR Error while using SELECT ENDSELECT

Former Member
0 Likes
4,284

Moderator message: continues from

Hello Experts,

I am having an ABAP report that selects data from BKPF in batches using SELECT ENDSELECT statement with PACKAGE SIZE option.

First select passes fine, on reaching the ENDSELECT and doing the 2nd  iteration SELECT statement is creating a DUMP: DBIF_RSQL_INVALID_CURSOR.

I checkd some links and SCN posts. There is no COMMIT . BREAK-POINT in between.

Can you please help?

Thanks,

LT

Message was edited by: Matthew Billingham . Urgency information removed.

15 REPLIES 15
Read only

rajkumarnarasimman
Active Contributor
0 Likes
3,073

Hi Linda,

I hope DBIF_RSQL_INVALID_CURSOR is a common error. We have more number of notes applicable for the above error. Can you please share the dump screenshot.  Using that we able to know the program name at where the dump occurs, based on that we can move forward to clear the error.


Regards


Rajkumar Narasimman.

Read only

0 Likes
3,073

hello Raj,

Many thanks for replying back.

My program is a custom abap report. This report reads data dfrom BKPF and writes it to a TXT file using GUI_DOWNLOAD.

In  ST22 it says

Category as: ABAP Programming Error

Exception: CX_SY_OPEN_SQL_DB

On reading some posts, I replaced my SELECT ENDSELECT with CURSOR  OPEN CURSOR  WITH HOLD.

Even now I am getting same dump.

Any clues...?

Thanks,

Linda

Read only

0 Likes
3,073

Hi Linda,

The Exception CX_SY_OPEN_SQL_DB occurs when the cursor is not closed

.

Please find the following note.

http://service.sap.com/sap/support/notes/815147

Regards

Rajkumar Narasimman

Read only

0 Likes
3,073

Hi Linda,

the errors occurs as soon as your process is interrupted between select and endselect. An interruption occurs i.e. with an RFC call, a message display (just any screen display), a commit work. This list may be incomplete.

Check what you are doing between SELECT and ENDSELECT.

You may first select only the key fields of your fill selection and in a second step process packages by selecting all required data. Note that you never need a select *. Select the fields you really need into corresponding fields of table will be OK and much faster.

Regards,

Clemens

Read only

Arun_Prabhu_K
Active Contributor
0 Likes
3,073

Hello Linda Thomas.

     Please paste your code here for better analysis.

Regards.

Read only

0 Likes
3,073

Hello Arun.

As suggested, I have added the code.Please check.

Thanks

Read only

Former Member
0 Likes
3,073

Hello All,

Given below is the code part I have tried.. Both select Endselect and Cursor version also. Both code is dumping

Here the SELECT_AND_SPLIT routine will internally call the FM: GUI_DOWNLOAD for writing the contents if itab to txt file.


Thanks,

LT

Read only

0 Likes
3,073

Linda Thomas,

     Why do you use OPEN CURSOR, FETCH NEXT CURSOR, CLOSE CURSOR?

     You can directly write

     SELECT ..... from BKPF INTO CORRESPONDING FIELDS OF TABLE gt_bkpf

          where bukrs in s_bukrs and budat in s_budat

Read only

0 Likes
3,073

Hello Arun,

I need to extract more than 4 billion records from BKPF.

so the only option is to fetch it in pieces..

Thanks,

LT

Read only

0 Likes
3,073

If possible, split the select the statement based on budat.

For instance,

SELECT ..... from BKPF INTO CORRESPONDING FIELDS OF TABLE gt_bkpf

          where bukrs in s_bukrs and budat in s_budat and budat < ='20131231'.


SELECT ..... from BKPF APPENDING CORRESPONDING FIELDS OF TABLE gt_bkpf

          where bukrs in s_bukrs and budat in s_budat and budat >= '20140101'.

Read only

0 Likes
3,073

The problem is given by the use of GUI_DOWNLOAD between SELECT....ENDSELECT.

You have to avoid it.

You got 4 bilion rows?
Then you can do

      select bukrs belnr gjhar into table gt_bkpf where <your conditions>

     Loop at gt_bkpf

          select single bkpf with keys

          gui_download

     endloop.

Surely it's not the best performance solution or the prettiest one available but this should works.

Read only

matt
Active Contributor
0 Likes
3,073

Four billion records and gui_download do not really go together. Better to write to the application server and then transfer to wherever the data is needed.

Read only

0 Likes
3,073

Can you check your SELECT_AND_SPLIT form looking for any commit trigger, as only native SQL commit are ignored due to the WITH HOLD option (as your call of DB_COMMIT) but you may have called some FM that execute a full COMMIT WORK or even some implicit database commit ?

Regards,
Raymond

Read only

0 Likes
3,073

Hi Linda,

GUI_DOWNLOAD interruots the dtabase selection because a remote connection to the client PC via SAP GUI is established.

Use OPEN DATASET and TRANSFER to store the data on the server.

Regards

Clemens

Read only

matt
Active Contributor
0 Likes
3,073

Please do not start a new thread on pretty much the same topic. This, (as well as saying that your request is urgent/important) is likely to get your thread rejected.

I've allowed it on this occasion, since you've already got a discussion going on this,