Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

multiple files

Former Member
0 Likes
1,730

hi gurus,

how can we download and upload multiple files.

thanks

deepak

1 ACCEPTED SOLUTION
Read only

kiran_k8
Active Contributor
0 Likes
1,212

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.

9 REPLIES 9
Read only

GauthamV
Active Contributor
0 Likes
1,212

hi,

use gui_download and gui_upload function modules.

Read only

Former Member
0 Likes
1,212

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

Read only

kiran_k8
Active Contributor
0 Likes
1,213

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.

Read only

Former Member
0 Likes
1,212

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.

Read only

Former Member
0 Likes
1,212

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

Read only

Former Member
0 Likes
1,212

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

Read only

Former Member
0 Likes
1,212

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.

Read only

Former Member
0 Likes
1,212

hi do one thing..

schedule multiple jobs using submit statement ...paralally ...then it is possible..easily..

Read only

Former Member
0 Likes
1,212

thanks all for your time.