on 09-23-2016 6:18 AM
Hello All ,
I want to upload excel file into internal table .
Which FM I have to use for F4 Search Help and for file upload ?
Regards ,
Rasika
Hello Premanand ,
Please prefer Following code for the same .
*&---------------------------------------------------------------------*
*& Report ZFILE_CREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZFILE_CREATE.
types: begin of ttab,
rec(1000) type c,
end of ttab.
types: begin of tdat,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of tdat.
data: itab type STANDARD TABLE OF ttab .
data: w_tab type ttab .
data: idat type STANDARD TABLE OF tdat .
data: w_dat type tdat .
data: file_str type string.
parameters: p_file type localfile.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
file_str = p_file.
CALL FUNCTION 'UPLOAD_XLS_FILE_2_ITAB'
EXPORTING
i_filename = p_file
tables
e_itab = idat
EXCEPTIONS
FILE_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT idat INTO w_dat .
WRITE :/1(10) w_dat-fld1 ,
12(5) w_dat-fld2 ,
20(5) w_dat-fld3 .
ENDLOOP.
Regards ,
Rasika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.