Skip to Content
0
Former Member
Oct 10, 2008 at 09:05 AM

Function ALSM_EXCEL_TO_INTERNAL_TABLE

7042 Views

Hy guys , im using this function in order to read a excel file , however , I m Getting exception upload_ole = 2 , why is that ? , here some code :

FORM match_archivo USING p_archivo CHANGING archivo.

DATA:lt_files TYPE filetable,

l_file TYPE file_table,

l_title TYPE string,

l_subrc TYPE i,

l_usr_act TYPE i,

l_def_file TYPE string.

l_def_file = p_archivo.

CLEAR lt_files. REFRESH lt_files.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = ''

default_extension = '*.xls'

default_filename = '*.xls'

initial_directory = 'c:\'

multiselection = ' '

CHANGING

file_table = lt_files

rc = l_subrc

EXCEPTIONS

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

OTHERS = 5

.

IF sy-subrc EQ 0.

LOOP AT lt_files ASSIGNING <fs>.

fic_inl = <fs>.

EXIT.

ENDLOOP.

ELSE.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM.

----


  • FORM read_fi_in *

  • *

----


  • ........ *

----


FORM read_fi_in.

CLEAR: fic_inl1, var.

MOVE fic_inl TO fic_inl1 .

REPLACE '.' WITH '~' INTO fic_inl1.

IF sy-subrc EQ 0.

SET LOCALE LANGUAGE sy-langu.

TRANSLATE fic_inl1 TO UPPER CASE.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = fic_inl1

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '256'

i_end_row = '65536'

TABLES

intern = excel

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

IF sy-subrc = 0.

LOOP AT excel.

ENDLOOP.

ENDIF.

ENDIF.

ENDFORM.

thank you very much for your help .