06-16-2011 8:30 AM
Hello ,
I made the following treatment but ai get a dump
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT * FROM BSEG .
DO.
REFRESH TB_BSEG .
FETCH NEXT CURSOR S_CURSOR
INTO TABLE TB_BSEG
PACKAGE SIZE 100.
IF SY-SUBRC NE 0 .
CLOSE CURSOR S_CURSOR.
EXIT .
ENDIF.
CALL FUNCTION 'DB_COMMIT'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = P_FICH
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
FILETYPE = 'BIN'
APPEND = 'X' " use append option
CHANGING
DATA_TAB = TB_BSEG.
CALL FUNCTION 'DB_COMMIT'.
ENDDO.
CLOSE CURSOR S_CURSOR .
DUMP :
Causes
Error in the ABAP Application Program
The current ABAP program "ZMM_EXTRACT_BSEG" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Unable to perform database selection fully.
Es ist eine Ausnahme aufgetreten, die weiter unten näher erläutert wird.
Die Ausnahme, der die Klasse 'CX_SY_OPEN_SQL_DB' zugeordnet ist,
wurde nicht abgefangen und führte deshalb zu einem Laufzeitfehler.
Der Grund für die Ausnahme ist:
One of the database selections included a database Commit.
The selection was then supposed to continue. Before a
database commit, however, all outstanding database selections
must be concluded.
Possible causes in the application program:
While a read process from a database cursor is taking place
(within a loop SELECT/LOOP/EXEC SQL or before a FETCH command),
one of the following statements is used:
- MESSAGE (apart from MESSAGE S...)
- COMMIT WORK
- ROLLBACK WORK
- BREAK-POINT
- WAIT
- CALL FUNCTION ... DESTINATION (synchronous RFC)
- CALL FUNCTION ... STARTING NEW TASK
- RECEIVE RESULTS
- CALL DIALOG
- CALL SELECTION-SCREEN
- CALL TRANSACTION
- CALL SCREEN, or any other statement that results in the display of a
new screen
Whenever a program runs in debugging mode, a "COMMIT WORK" can
possibly be triggered during database selection. This abnormal
termination can also occur in debugging mode even with a correct
program.
06-16-2011 8:36 AM
It's likely that the GUI_DOWNLOAD call causes the cursor to be interrupted. Also, why do you need to call DB_COMMIT, as you seem to only read data, but not update anything.
thomas
06-16-2011 8:41 AM
06-16-2011 8:41 AM
Hi ,
The issues seems to be because of the Method to download the data to file , which is executed during data selection.
I would suggest to first select all data and then download the data into local file.
As mentioned in the dump , the issue is CALL FUNCTION statement , during data selection .
The method being used, in turn calls the FM GUI_DOWNLOAD and hence the dump.
Regards,
Arun
06-16-2011 8:48 AM
06-16-2011 8:56 AM
HI ,
All records into an internal tale will not be possible , so what i would suggest it to select data from BSEG based on Year and then keep appending it to the download file.
So May be some thing like.
WHILE 'YEAR' <= CURRENT YEAR
SELECT DATA FOR 'YEAR' INTO INTERNAL TABLE
DOWNLOAD THE DATA
ENDWHILE.
Hope this helps.
Reards
Arun
06-16-2011 9:11 AM
Hi,
1st comment out all (both) DB_COMMITs and comment out the GUI_DOWNLOAD method.
If all works fine, reactivate GUI_DOWNLOAD method. If a dump occurs, is it in 2nd loop or later?
Regards,
Klaus
06-16-2011 9:16 AM
06-16-2011 9:20 AM
You may tell the system to not close the cursor at a database commit, by adding keywords FOR HOLD to OPEN CURSOR (have a look at the ABAP documentation)
06-16-2011 10:12 AM
Hi,
As per my understanding, you dont want to download the whole table in one single run.
If i am correct, then fill your internal table with the data by specifying the YEAR range in the selection screen.
Then download it.
Appending the complete BSEG data to an internal table might not be possible, since this will create an overflow dump for internal table.
So what i suggest is to download the data in part by part.
@Sandra,
He is using the WITH HOLD addition with OPEN CURSOR.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT * FROM BSEG .
Regards
HM
06-16-2011 11:03 AM
Try to use
SELECT.
--logic to transfer data to file.
ENDSELECT
Try to use DATASET
Teguh Wisesa
Edited by: Mohammad Teguh Wisesa on Jun 16, 2011 12:05 PM
06-16-2011 9:18 AM
Hi,
You are dealing with huge amount of data here.
I suggest as before, fetch data for a particular condition as 'Year' like suggested above.
ANd append them to an internal table.
Then download that internal table ,once you have the entire data with you.
You can first tackle problem of getting data and then deal with downloading.
and yes... no commits required please remove.
Edited by: sap_wiz on Jun 16, 2011 1:49 PM
10-21-2013 7:35 AM
HEY,GUYS,
I WANNA KNOW IF YOU'VE SOLVED THAT PROBLEM SINCE I MET THIS TOO.