2006 May 04 4:36 PM
Hi,
I'm using gui_download to read a file and then make an idoc. What i want is to know is it´s possible to read many files. for example i have a folder with some files and i want to read them and create a idoc for each one.
thanks,
Ricardo
Hi,
I'm using gui_download to read a file and then make an idoc. What i want is to know is it´s possible to read many files. for example i have a folder with some files and i want to read them and create a idoc for each one.
thanks,
Ricardo
2006 May 04 4:40 PM
Iits possible, You can use the CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG for selecting multiple files. Then loop at the file table and open the file using GUI_UPLOAD one by one.
Regards,
Ravi
Note : Please mark the helpful answers
2006 May 04 4:46 PM
2006 May 04 4:51 PM
Hi,
At the Process on value request of the file parameter on the selection screen call the method CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG where the user will be able to select multiple files and these will be returned to FILETABLE parameter.
Now in the program
loop at file table
call method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
PASS THE FILE NAME FROM THE FILE TABLE
PROCESS THE FILE DATA
CREATE THE IDOC.
ENDLOOP.
.
This would create one idoc per file.
Regards,
Ravi
Note : Please mark the helpful answers
2006 May 04 5:05 PM
hi,
use CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD in this way..
loop at it_file
CALL METHOD <b>CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD</b>
EXPORTING
FILENAME = it_file-file1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
CHANGING
DATA_TAB = ITAB1
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
NOT_SUPPORTED_BY_GUI = 17
ERROR_NO_GUI = 18
others = 19
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Process the data.
Create the new IDOC...
Endloop.
Regards,
Santosh
2006 May 04 5:27 PM