2007 Jul 19 4:21 AM
Hi SAP Guru,
I was trying out the function ALSM_EXCEL_TO_INTERNAL_TABLE under SE37.
My intention is to upload an excel workbook with multiple sheets.
I encountered exception, sy-subrc = 2 and it returns UPLOAD_OLE
in here:-
CALL METHOD OF worksheet 'Cells' = h_cell1
EXPORTING #1 = i_end_row #2 = i_end_col.
m_message.
What's is missing?
2007 Jul 19 4:28 AM
Check out the sample example below
parameters : p_ifname type rlgrap-filename.
data : it_data type table of alsmex_tabline initial size 0,
is_data type alsmex_tabline.
* Flatfile internal table.
types : begin of ty_tab,
zuonr type bsid-zuonr,
end of ty_tab.
data : it_tab type table of ty_tab initial size 0,
is_tab type ty_tab.
*&--------------------------------------------------------------*
*& Form upload_data_excel
*&--------------------------------------------------------------*
* text
*---------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*---------------------------------------------------------------*
form upload_data_excel.
* If Input file name is not initial.
if not p_ifname is initial.
* Upload EXCEL data into internal table
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_ifname
i_begin_col = 1
i_begin_row = 1
i_end_col = 256
i_end_row = 65356
tables
intern = it_data
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endif.
* Append EXCEL Data into a internal table
loop at it_data into is_data.
at new row.
clear is_tab.
endat.
if is_data-col = '001'.
move is_data-value to is_tab-zuonr.
endif.
at end of row.
append is_tab to it_tab.
endat.
clear : is_data.
endloop.
Regards
Gopi
2007 Jul 19 4:29 AM
2007 Jul 19 4:31 AM
Hi Colin,
1. i do not think that the function module allows uploading of data in sheets other than the first
2. make sure the parameters you specified exist in the excel file
ie: ensure that the end row and column are not past any limit and that they are larger than the start row and col specified
2007 Jul 19 7:34 AM
Where can I find an Upload for multiple worksheet within a workbook?