SAP上传Excel文档字符限制处理
abap中有多個函數處理上傳的excel文檔中的數據,記錄數據的信息(行、列、值)。
如,函數KCD_EXCEL_OLE_TO_INT_CONVERT:
? data: lt_data_in_file type table of kcde_cells,
? ? ? ? ls_data_in_file type kcde_cells.
?
? call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
? ? exporting
? ? ? filename ? ? ? ? ? ? ? ?= g_file "上傳文件名(如:C:\Users\Chen\Upload.xlsx)
? ? ? i_begin_col ? ? ? ? ? ? = 1
? ? ? i_begin_row ? ? ? ? ? ? = 1
? ? ? i_end_col ? ? ? ? ? ? ? = 256
? ? ? i_end_row ? ? ? ? ? ? ? = 65535
? ? tables
? ? ? intern ? ? ? ? ? ? ? ? ?= lt_data_in_file
? ? exceptions
? ? ? inconsistent_parameters = 1
? ? ? upload_ole ? ? ? ? ? ? ?= 2
? ? ? others ? ? ? ? ? ? ? ? ?= 3.
* ?IF sy-subrc <> 0.
* ? ?MESSAGE e160.
* ?ENDIF.
我們將數據以行、列、值的方式存儲在內表lt_data_in_file中。
這里需要注意的是:這里的值存儲的文本長度為32。
所以當你上傳的數據值長度超過32的時候,它就自動截取32個文本;
下面這個函數ZALSM_EXCEL_TO_INTERNAL_TABLE,可以接收50個上傳字符:
? data: lt_data_in_file type table of ? ? ? ? ?zalsmex_tabline,
? ? ? ? ls_data_in_file type ? ? ? ? ? ? ? ? ? zalsmex_tabline.
?
? call function 'ZALSM_EXCEL_TO_INTERNAL_TABLE'
? ? exporting
? ? ? filename ? ?= p_file ?"上傳文件名
? ? ? i_begin_col = '1'
? ? ? i_begin_row = '1'
? ? ? i_end_col ? = '256'
? ? ? i_end_row ? = '10000'
? ? tables
? ? ? intern ? ? ?= lt_data_in_file.
* ?if sy-subrc <> 0.
** Implement suitable error handling here
* ?endif.
?
總結
以上是生活随笔為你收集整理的SAP上传Excel文档字符限制处理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【PP主数据】工作中心介绍
- 下一篇: 文本文件、Excel文件上传下传