2007 Feb 14 11:02 AM
Hi Friends,
Can we use the gui_upload to get excel data into internal table? If possible how?
Thanks in advance.
2007 Feb 14 11:04 AM
Hi,
Save the Excel file as Text Tab DeLimited file and pass to the fun module, it will come into internal table
Regards,
Anji
Hi,
Save the Excel file as Text Tab DeLimited file and pass to the fun module, it will come into internal table
Regards,
Anji
2007 Feb 14 11:04 AM
Hi,
Save the Excel file as Text Tab DeLimited file and pass to the fun module, it will come into internal table
Regards,
Anji
2007 Feb 14 11:05 AM
Yes, you can.
Give the has_field_separator = 'X' when you use the fm GUI_UPLOAD.
Regards,
Ravi
2007 Feb 14 11:06 AM
2007 Feb 14 11:07 AM
HI,
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:test.csv'
FILETYPE = 'ASC'
TABLES
DATA_TAB = itab
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
OTHERS = 17.But it is better to use the function module 'ALSM_EXCEL_TO_INTERNAL_TABLE'
http://www.sapdevelopment.co.uk/file/file_upexcel2.htm
Regards
Sudheer
2007 Feb 14 11:18 AM
Hi,
Check the link below:
http://www.sapdevelopment.co.uk/file/file_upexcel.htm
It contains the sample code to Upload Excel document into internal table.
Hope this helps.
Reward if helpful.
Regards,
Sipra
2007 Feb 14 11:34 AM
Hi,
Use the following code without hassles. I used the following test program to upload a file to Application server in Dev. for testing purpose.
type-pools: truxs.
data: gv_file type string,
gv_filename type rlgrap-filename,
w_subrc type sy-subrc.
parameters: p_file type rlgrap-filename.
types: begin of ty_adnat_book,
col1(250) type c,
end of ty_adnat_book.
data: it_datatab type standard table of ty_adnat_book,
wa_datatab type ty_adnat_book.
data: it_raw type truxs_t_text_data.
At selection screen
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
field_name = 'P_FILE'
importing
file_name = p_file.
gv_file = p_file.
start-of-selection.
call function 'GUI_UPLOAD'
exporting
filename = gv_file
filetype = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = it_datatab
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
others = 17.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*----
Use the following code if you want to dump the file in Application server.
*--- upload the file to application server
gv_filename = text-T02.
call function '/BMC/OPEN_DATASET'
exporting
i_file_name = gv_filename
i_type = '0'
importing
o_return_code = w_subrc
O_MSG =
.
loop at it_datatab into wa_datatab.
transfer wa_datatab to gv_filename.
endloop.
close dataset gv_filename.
write 😕 'succ'.
Regards,
Vijay.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |