‎2008 Jun 30 7:21 AM
hi gurus,
how can we download and upload multiple files.
thanks
deepak
‎2008 Jun 30 7:36 AM
Deepak,
For ex declare two internal tables and then upload the data into those tables separately using the upload function module.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\ROUTING\ROUTINGHEADER.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = HTAB
*Uploads Routing Sequence Details
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\ROUTING\Sequence.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = STAB
K.Kiran.
‎2008 Jun 30 7:25 AM
‎2008 Jun 30 7:32 AM
Hi Deepak,
Use UPLOAD_FILES for file Transfer from PC or Appl. Server in Internal Table
Functionality
The function module reads the file from the presentation or application server, and transfers the data to the internal table FILE_ALL.
Parameters
I_TRUNCLEN
I_FILETYPE
I_XPC
FILE_ALL
TAB_FILE
See the following example which works for tab delimited files.
Tables: rlgrap,RF02B.
TYPES : BEGIN OF ty_mara,
matnr LIKE mara-matnr,
mbrsh LIKE mara-mbrsh,
mtart LIKE mara-mtart,
maktx LIKE makt-maktx,
meins LIKE mara-meins,
END OF ty_mara.
data :it_rlgrap type table of rlgrap WITH HEADER LINE.
data : i_xpc type RF02B-BANKXFPR value 'X'.
DATA : it_mara TYPE TABLE OF ty_mara WITH HEADER LINE.
data : asc type RLGRAP-FILETYPE value 'ASC'.
PARAMETERS : p_text type rlgrap-filename default '<path>'.
it_rlgrap-filename = p_text.
append it_rlgrap.
CALL FUNCTION 'UPLOAD_FILES'
EXPORTING
* I_TRUNCLEN = ' '
i_filetype = asc
i_xpc = i_xpc
tables
file_all = it_mara
tab_file = it_rlgrap.
loop at it_mara.
write : it_mara-matnr.
endloop.
Regards,
Jagadish
‎2008 Jun 30 7:36 AM
Deepak,
For ex declare two internal tables and then upload the data into those tables separately using the upload function module.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\ROUTING\ROUTINGHEADER.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = HTAB
*Uploads Routing Sequence Details
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\ROUTING\Sequence.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = STAB
K.Kiran.
‎2008 Jun 30 7:55 AM
Hi DEEPAK.
For uploading/Dowloading multiple files,
we can use:
Presentation Server:
GUI_UPLOAD AND GUI_DOWNLOAD function modules.
And also UPLOAD_FILES.
Reward points if you find this information usefull.
Regards Harsh.
‎2008 Jun 30 7:55 AM
Hi Deepak,
For uploading multiple fiels we can use the function module:
CALL FUNCTION UPLOAD_FILES
All the files from the presentation or application server are read and put into the internal table of type FILE_ALL.
And now you can access these files from that internal table just as any other internal table contents.
Hope this help you.
Regards,
Chandra Sekhar
Edited by: Chandrasekhar Gandla on Jun 30, 2008 8:56 AM
‎2008 Jun 30 8:23 AM
Hi Deepak,
Try this way:
Upload:
Pass different file names and itab.....
FORM file_at_application
USING file_name TYPE rlgrap-filename.
DATA:
l_file_name TYPE rlgrap-filename.
OPEN DATASET l_file_name
FOR OUTPUT
IN TEXT MODE ENCODING DEFAULT.
LOOP AT itab
INTO wa.
TRANSFER wa TO l_file_name.
ENDLOOP.
CLOSE DATASET l_file_name.
ENDFORM.
download:
Pass different file names and itab.....
FORM file_at_presentation
USING file_name TYPE rlgrap-filename.
DATA:
l_file_name TYPE rlgrap-filename.
* Download file.......
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file_NAME
filetype = 'ASC'
TABLES
data_tab = itab.Regards
Adil
Edited by: Syed Abdul Adil on Jun 30, 2008 9:45 AM
‎2008 Jun 30 8:33 AM
hi deepak,
in regards to presentation server u can use..
GUI_DOWNLOAD
GUI_UPLOAD
for file path...
F4_FILENAME
in regards to application server u can use..
DATA:
w_fname(60) VALUE '.\'.
to upload........
OPEN DATASET w_fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
TRANSFER w_string TO w_fname.
CLOSE DATASET w_fname.
to download.........
OPEN DATASET w_fname FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET w_fname INTO w_string.
IF sy-subrc <> 0.
EXIT.
ENDIF. " IF SY-SUBRC <> 0
ENDDO. " DO
CLOSE DATASET w_fname.
with luck,
pritam.
‎2008 Jun 30 9:16 AM
hi do one thing..
schedule multiple jobs using submit statement ...paralally ...then it is possible..easily..
‎2008 Jun 30 5:53 PM