‎2009 Aug 04 11:42 AM
Can any one please give me an example use of FM "GUI_UPLOAD" which to upload a EXCEL file????? (not .txt)
‎2009 Aug 04 12:12 PM
‎2009 Aug 04 2:17 PM
Hi Wizi,
Welcome to SCN
Please Search in SCN before Posting
check below example,
for excel to internal table try this function module,
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = ','
i_line_header = p_head
i_tab_raw_data = it_raw
i_filename = p_upl
TABLES
i_tab_converted_data = t_indata
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
Edited by: suresh suresh on Aug 4, 2009 3:17 PM
‎2009 Aug 05 1:23 PM
Use one of the below FM
TEXT_CONVERT_XLS_TO_SAP
ALSM_EXCEL_TO_INTERNAL_TABLE
‎2009 Aug 06 3:51 AM
Dear chenna,
tnx 4 your prompt reply.... but it gives me a weird output with lot of symbols.
others - apreciate your response. but i spesifically asked for FM "GUI_UPLOAD".... pls help me with it if you can.
cheers
‎2009 Aug 06 7:34 AM
Try in this way
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = tfile
FILETYPE = 'ASC'
TABLES
DATA_TAB = your internal table to store the data
endif.
‎2009 Aug 06 7:48 AM
Use the forum search option [GUI_UPLOAD FOR EXCEL|https://forums.sdn.sap.com/search.jspa?threadID=&q=GUI_UPLOADFOREXCEL&objID=c42&dateRange=all&numResults=15&rankBy=10001]) or sdn wiki/code gallery ([UPLOAD EXCEL|https://wiki.sdn.sap.com/wiki/dosearchsite.action?searchQuery.queryString=upload+Excel&searchQuery.spaceKey=conf_global]) - Same question already answered many time
GUI_UPLOAD doesnt perform such conversion (Excel, Word, PDF) and wont give you a suitable result, use one of the FM mentioned above or [office integration|http://help.sap.com/saphelp_47x200/helpdata/en/21/b53138e1ba11d2bdbe080009b4534c/frameset.htm] or OLE or convert your Excel sheet to a simpler format : txt, csv, xml.
Regards,
Raymond
‎2009 Aug 06 8:03 AM
subhajit - it says "cannot interpret data in file" when i change the filetype into "ASC".
Raymond - okey mate thanx. i thought i could use "GUI_UPLOAD" for excel files as well.
thanx for all your answers.
cheers
anushka
Edited by: wizkid0319 on Aug 6, 2009 12:33 PM
‎2009 Aug 06 8:23 AM
Hi,
Refer to the given code:
DATA: lv_filetype(10) TYPE c,
lv_gui_sep TYPE c,
lv_file_name TYPE string.
lv_filetype = 'ASC'.
lv_gui_sep = 'X'.
lv_file_name = pa_dfile. "file path
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_itab.
The file should be a tab delimited file. this will work only for that.
Regards,
Rajesh kumar
‎2009 Aug 06 8:29 AM
rajesh....
basically u r asking me to use a simple .TXT , .CSV .... kind of a file to upload rather than a EXCEL file rite???
but what i have is a EXCEL file.
If it is possible to do for a EXCEL file as well pls let me know?????
or else is it really impossible to do it for a EXCEL file using FM "GUI_UPLOAD" ????
cheers
anushka
‎2009 Aug 06 8:31 AM
Hi Anushka,
No need to use GUI_UPLOAD as it will not solve your purpose, use the below code, it will work for sure.
You can use the below code to upload excel into internal table
DATA: lv_file_name TYPE rlgrap-filename.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = ''
i_tab_raw_data = tb_file_data
i_filename = lv_file_name<file name>
TABLES
i_tab_converted_data = <internal table with data>
EXCEPTIONS
conversion_failed = 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.
Regards,
Manish