Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

always error uploading excel file

Former Member
0 Likes
6,622

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,384

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

12 REPLIES 12
Read only

Former Member
0 Likes
3,385

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

Read only

Former Member
0 Likes
3,384

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

Read only

0 Likes
3,384

Did you use open office?

Read only

Former Member
0 Likes
3,384

I am using Micrsoft Office.

Read only

Former Member
0 Likes
3,384

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

Read only

Former Member
0 Likes
3,384

Hi,

Check whether the excel sheet is open while execution of the program.

Regards,

Deepika

Read only

Former Member
0 Likes
3,384

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

Read only

Former Member
0 Likes
3,384

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

Read only

Former Member
0 Likes
3,384

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

Read only

Former Member
0 Likes
3,384

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 body

after this Your internal table have all records from excel

Regards,

Apoorv

Read only

Former Member
0 Likes
3,384

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.

Read only

0 Likes
3,384

thank you for your replies