2014 Oct 05 2:07 PM
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.
2014 Oct 05 2:44 PM
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.
2014 Oct 05 2:59 PM
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
2014 Oct 05 3:20 PM
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
2014 Oct 05 4:56 PM
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
2014 Oct 06 4:34 AM
Hello Linda Thomas.
Please paste your code here for better analysis.
Regards.
2014 Oct 06 4:46 AM
Hello Arun.
As suggested, I have added the code.Please check.
Thanks
2014 Oct 06 4:46 AM
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
2014 Oct 06 4:59 AM
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
2014 Oct 06 5:09 AM
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
2014 Oct 06 5:30 AM
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'.
2014 Oct 06 9:19 AM
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.
2014 Oct 06 9:55 AM
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.
2014 Oct 06 10:07 AM
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
2014 Oct 06 1:18 PM
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
2014 Oct 06 10:57 AM
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,