cancel
Showing results for 
Search instead for 
Did you mean: 

upload file

Former Member
0 Kudos

hi all

can anyone plz suggest the logic for uploading multiple files from desktop using function module upload or gui_upload.

the files are tab delimited. and can be more that 2 or 3 or 4.

so can anyone please suggest the logic for this

thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

put file names in internal table and loop it around upload function

regards

Former Member
0 Kudos

hi

i do no know the file names. user can upload any tab delimited file. so plz can you suggest the logic for that.

it will be great help.

thanks

andreas_mann3
Active Contributor
0 Kudos

Hi,

1) CL_GUI_FRONTEND_SERVICES->DIRECTORY_LIST_FILES
2) loop at file_table
     CL_GUI_FRONTEND_SERVICES->GUI_UPLOAD
    
     loop at DATA_TAB into wa.
3)     append wa to itab,
     endloop.
   endloop.      

Andreas

Former Member
0 Kudos

yes andreas is right

and there are many thread for same query

so please search forum once

regards

Former Member
0 Kudos

Directly u cant achive multiple file upload..

but indirectly u can do like this..

In this also u hv to select file one by one..but the thing is if u select one file it will automatically show the popup for next file...and goes on..one u press cancel the process stops...all the file names with full path in stored in itab...using that u can loop & upload...

regards

gv

REPORT ZZGV099 .

TYPES:BEGIN OF WRK_CHAR,

ZZCHAR(256) TYPE C,

END OF WRK_CHAR.

DATA : ITAB01 TYPE STANDARD TABLE OF WRK_CHAR,

H_ITAB01 LIKE LINE OF ITAB01.

PARAMETERS : P_FNAME LIKE RLGRAP-FILENAME. "UP LOAD FILE

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME .

PERFORM FILENAME_SLS .

************************************************************************

    • START-OF-SELECTION

************************************************************************

START-OF-SELECTION.

LOOP AT ITAB01 INTO H_ITAB01.

WRITE : / H_ITAB01-ZZCHAR.

ENDLOOP.

FORM FILENAME_SLS.

DATA : WRK_DEF_PATH(256).

DO.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_PATH = WRK_DEF_PATH

MASK = ',.txt,.txt.'

MODE = 'O'

TITLE = 'Upload file selection'

IMPORTING

FILENAME = P_FNAME

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF SY-SUBRC = 3.

EXIT.

ELSEIF SY-SUBRC = 0.

H_ITAB01-ZZCHAR = P_FNAME.

APPEND H_ITAB01 TO ITAB01.

ENDIF.

IF WRK_DEF_PATH IS INITIAL.

CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'

EXPORTING

FULL_NAME = P_FNAME

IMPORTING

  • STRIPPED_NAME = wrk_DEF_PATH

FILE_PATH = WRK_DEF_PATH

  • EXCEPTIONS

  • X_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

ENDDO.

ENDFORM. " FILENAME_SLS