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.
 

猜你喜欢

转载自blog.csdn.net/zhongguomao/article/details/81189760
今日推荐