2009 Jul 30 2:56 AM
Hi gurus,
I am trying to learn how to upload excel files into internal tables and do further processing from there.
I am basing my code from [here|http://www.sapdev.co.uk/file/file_upexcelalt2.htm] . And I created a simple 3-column text file like they did in the example.
When I run the program, it always says "error upload OLE". In the debugger sy-subrc becomes 2 which means "Error Uploading OLE". I don't know what's wrong. I've tried other methods of uploading excel files, but they also produce "error upload OLE".
Our office workstations run Openoffice 3. And I created the excel file using Open Office in XLS format.
Am I doing anything wrong? Do I need to have Excel installed in my workstation? What should I do?
Thanks much
-Mozart
2009 Jul 30 3:21 AM
Hi,
I never had an error using the fm ALSM_EXCEL_TO_INTERNAL_TABLE. But im also using Microsoft Excel...May be you really need to install it
Hi,
I never had an error using the fm ALSM_EXCEL_TO_INTERNAL_TABLE. But im also using Microsoft Excel...May be you really need to install it
2009 Jul 30 3:21 AM
Hi,
I never had an error using the fm ALSM_EXCEL_TO_INTERNAL_TABLE. But im also using Microsoft Excel...May be you really need to install it
2009 Jul 30 4:03 AM
Hi,
I have used same code in my system & it is working.
I think there is some thing wrong in your creation of Excel File.
Thanks & regards,
ShreeMohan
2009 Jul 30 4:05 AM
2009 Jul 30 4:17 AM
2009 Jul 30 4:40 AM
Hi,
Try the following 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.
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_zhralcon_file.
Save the excel file as tabdelimited file and then execute the code.
it will help to solve your problem.
Regards,
Rajesh Kumar
2009 Jul 30 5:38 AM
Hi,
Check whether the excel sheet is open while execution of the program.
Regards,
Deepika
2009 Jul 30 5:43 AM
type-pools : truxs.
Internal table declaartion for excel file
data : it_raw type truxs_t_text_data.
Calling the function module to upload Excelsheet data to Internal table
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
I_FIELD_SEPERATOR = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_flname " our excel file
tables
i_tab_converted_data = it_upload " our inetrnal table
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.
Please go through it and you can get the excel file data into our Internaltable
Edited by: polisetty pramod on Jul 30, 2009 6:43 AM
2009 Jul 30 5:45 AM
Hi,
Since you are using Open Office Excel, try these FM's to upload them
text_convert_xls_to_sap
KCD_EXCEL_OLE_TO_INT_CONVERT
They work for open office applications.
Regards,
Vik
2009 Jul 30 5:55 AM
Hi mrpena,
to upload from excel use FM: ALSM_EXCEL_TO_INTERNAL_TABLE.
you create one selection screen, where you need to give the file path, starting row & end row of the excel sheet
& starting & end column of the excel sheet.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = po_file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '4'
i_end_row = '2'
tables
intern = i_file
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
in i_final internal table you will get all the data from excel . then you need to transfer all the data from i_final to sap structure.
Hope you understand this well.
Regards,
Tutun
2009 Jul 30 7:08 AM
hii Mrpena,
Plz check whether internal table and excel are of same sequence or not .. It should be in same sequence
just try following code. it might help
Data T_TAB LIKE STANDARD TABLE OF FS_TAB.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE1 TYPE IBIPPARMS-PATH OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FILE1.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
** I_FIELD_SEPERATOR =
*** I_LINE_HEADER =
I_TAB_RAW_DATA = T_TAB
I_FILENAME = P_FILE1
TABLES
I_TAB_CONVERTED_DATA = IT_DATA[] . "Your Internal Table bodyafter this Your internal table have all records from excel
Regards,
Apoorv
2009 Jul 30 10:30 AM
hi all.
installing Microsoft Office 2003 solved the problem. Inside the FM, you can see SAP calling EXCEL application. It seems when SAP reads the file, it first opens Excel, then copies from there.
2009 Jul 30 10:31 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |