从前端加载具有80个以上字符的单元格值的xls [英] Load xls with cell values of 80+ characters from frontend
问题描述
我需要通过SAPGUI读取excel文件(不是批量读取,不是从服务器读取)。
仅一个工作表/文件,而不是一个csv文件。
I need to read excel files via SAPGUI (not in batch, not from server). Only one sheet/file, not a csv file.
我知道有几个功能模块可以执行此操作,但是它们仅限于以下单元格大小:每个单元格32或40或50个字符。
I am aware of a few function modules that do that, but they are restricted to cell sizes of 32 or 40 or 50 characters per cell.
是否存在允许我读取具有较长单元格的excel文件的功能模块或类/方法?
较长的意思是:字符串或由调用方定义或至少80。
Are there function modules or classes/methods that allow me to read excel files with longer cells? Longer means: either String or defined by the caller or at least 80.
编辑
我在单元格大小不是那么重要的其他项目中成功使用了ALSM_EXCEL_TO_INTERNAL_TABLE。该模块读入结构ALSMEX_TABLINE,该结构将数据限制为50个字符。
I used ALSM_EXCEL_TO_INTERNAL_TABLE successfully in other projects where cell size is not that important. This module reads into a structure ALSMEX_TABLINE that restricts data to 50 characters.
KCD_EXCEL_OLE_TO_INT_CONVERT读入具有32个字符/单元格的表。
KCD_EXCEL_OLE_TO_INT_CONVERT reads into a table with 32 characters / cell.
推荐答案
您可以将 FILE_READ_AND_CONVERT_SAP_DATA
用于该目标。其输出表单元格限制为256个字符,这对您来说已经足够。代码示例如下:
You can use FILE_READ_AND_CONVERT_SAP_DATA
for that aim. Its output table cell is limited to 256 characters, which would be quite sufficient for you. Code sample is given below:
TYPES: tv_data(256) TYPE c,
BEGIN OF ts_data,
value_0001 TYPE tv_data,
...
value_0020 TYPE tv_data,
END OF ts_data,
tt_data TYPE TABLE OF ts_data.
DATA: lv_fname TYPE filename-fileintern,
pt_data TYPE tt_data.
lv_fname = 'C:\test.xls'.
CALL FUNCTION 'FILE_READ_AND_CONVERT_SAP_DATA'
EXPORTING
i_filename = lv_fname
i_servertyp = 'OLE2'
i_fileformat = 'XLS'
TABLES
i_tab_receiver = pt_data
EXCEPTIONS
file_not_found = 1
close_failed = 2
authorization_failed = 3
open_failed = 4
conversion_failed = 5
OTHERS = 6.
IF sy-subrc <> 0.
* error handling
ENDIF.
这篇关于从前端加载具有80个以上字符的单元格值的xls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!