09-26-2006 7:15 AM
Hi,
There are around 1 crore records in a table. I want to download all the 1 crore record in a file. For this i want to extract 2,50,000 in each select using package size of 250000. Then would download 2,50,000 to a file. In next loop , again would extract and download 2,50000 records . Similarly would be creating files for 250000 records each.
But the problem is that, when i use select package size ... endselect, within that i m using a function module, because of which there is a commit work being exectuted and hence i m getting a short dump and the second loop is not getting executed.
Please let me know the solution asap.
09-26-2006 7:34 AM
09-26-2006 7:48 AM
Hi!
You can write some files with open dataset, transfer, close dataset on application server without commit work.
Later (after the select) you can read them and copy to PC with download function module (and delete the temporary files with delete dataset).
Regards,
Christian
09-26-2006 8:03 AM
Plz send me ur code, wht u written. then only i can answer to you.
regards
Justin
09-26-2006 8:18 AM
Hi,
I had similar problem in my requirement .
Use open cursor with hold logic to overide
commit work implicitly.
use following code
<b>OPEN CURSOR WITH HOLD GV_DB_CURSOR FOR
SELECT * FROM ZCOXPRIHST</b>
WHERE BUKRS IN S_BUKRS
AND BUDAT IN S_BUDAT.
DO.
FETCH NEXT CURSOR GV_DB_CURSOR
INTO TABLE IT_ZCOX
PACKAGE SIZE GC_SIZE. "Packet size 250000
IF SY-SUBRC NE 0.
CLOSE CURSOR GV_DB_CURSOR.
EXIT.
ENDIF.
loop at it_zcox.
*download data
endloop.
free it_zcox.
enddo.
Try above logic this may solve your problem.
Regards,
amole
09-26-2006 2:32 PM
Hi,
Thanks for the suggestion. Could you please suggest as to how to decalare GV_DB_CURSOR in the program.
09-26-2006 2:47 PM
Hi,
I have used your code piece, and in this code I am using a packet size of 100. When I execute it it gives the following error " DBIF_RSQL_INVALID_CURSOR " . Could you please help on this as to why this error has come?
The code I have used is as below:
data : itab like vbak occurs 0 with header line.
data : gc_size(4) type c value '100'.
data : fmname type string,
fmname1 type string,
count type c.
DATA: GV_DB_CURSOR TYPE CURSOR.
fmname = 'C:\I16\GL\test1.txt'.
OPEN CURSOR WITH HOLD GV_DB_CURSOR FOR
SELECT * FROM vbak .
DO.
count = count + 1.
concatenate fmname count into fmname1.
FETCH NEXT CURSOR GV_DB_CURSOR
INTO TABLE itab
PACKAGE SIZE GC_SIZE. "Packet size 250000
IF SY-SUBRC NE 0.
CLOSE CURSOR GV_DB_CURSOR.
EXIT.
ENDIF.
*loop at itab.
*download data
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = fmname
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
FILELENGTH =
tables
data_tab = itab
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*endloop.
free itab.
enddo.
09-27-2006 10:01 AM
09-27-2006 10:08 AM
Hi,
do write follwing code inside do enddo.
COMMIT WORK
ROLLBACK WORK
CALL SCREEN
CALL DIALOG
just check dump analysis in st22 for possible cause
of error
REGARDS
AMOLE