excel匯入內錶的長度限制的solution

2021-08-09 02:58:35 字數 2227 閱讀 8481

1、  'text_convert_xls_to_sap'單元格文字不能超過256個字元 

call function 'text_convert_xls_to_sap' 

exporting 

i_line_header              = 'x' 

i_tab_raw_data             = lt_raw 

i_filename                 = p_file 

tables 

i_tab_converted_data       = it_data 

exceptions 

conversion_failed          = 1 

others                     = 2 .

text_convert_csv_to_sap                     "cvs 

text_convert_tex_to_sap                     "tex 

text_convert_txt_to_sap                     "txt 

text_convert_xls_to_sap                     "xls 

text_convert_xml_to_sap                     "xml 

2、'alsm_excel_to_internal_table'單元格文字不能超過50個字元 

data: gt_upload type alsmex_tabline occurs 0 with header line. 

call function 'alsm_excel_to_internal_table' 

exporting 

filename    = p_file 

i_begin_col = '1' 

i_begin_row = '1' 

i_end_col   = '9' 

i_end_row   = '50000' 

tables 

intern      = gt_upload. 

3修改alsm_excel_to_internal_table的限制

alsm_excel_to_internal_table 是上載excel檔案的乙個函式,但是這個函式有兩個限制。 

一是每個cell只能匯入前50個字元,二是如果超過9999行,行號會初始化為從零開始 

其實解決起來很簡單,只要改一下結構 alsmex_tabline 的字段就行了,然後copy  alsm_excel_to_internal_table 為 zalsm_excel_to_internal_table ,並做少許改動即可。 

另外,如果要上載有開啟密碼保護的excel,只要修改一下ole的 open 語句即可。 

以及匯入指定的sheet等。

注意copy出來的函式的 global data 裡面應該有下列語句: 

type-pools: ole2. 

types: ty_d_itabvalue             type zalsmex_tabline-value, 

ty_t_itab                  type zalsmex_tabline   occurs 0, 

begin of ty_s_senderline, 

line(4096)               type c, 

end of ty_s_senderline, 

ty_t_sender                type ty_s_senderline  occurs 0. 

constants:  gc_esc              value '"'. 

另外可以嘗試

call function 'text_convert_xls_to_sap'

exporting

*     i_field_seperator    =

i_line_header        = 'x'

i_tab_raw_data       = it_raw

i_filename           = p_file

tables

i_tab_converted_data = it_datatab

exceptions

conversion_failed    = 1

others               = 2. 

excel匯入內錶的長度限制的solution

1 text convert xls to sap 單元格文字不能超過256個字元 call function text convert xls to sap exporting i line header x i tab raw data lt raw i filename p file tabl...

excel表的匯入

判斷匯入資訊是否與dw視窗中資訊重複 int n for n 1 to dw 1.rowcount string ls llk int ls count ls llk dw 1.getitemstring n,1 select count into ls count from cliendservi...

將excel表的資料匯入

import react from react import xlsx from xlsx class list extends react.component file.target 通過filereader物件讀取檔案 const filereader new filereader filere...