美文网首页
内表下载至excel,中文变成#号

内表下载至excel,中文变成#号

作者: Mmm_余安 | 来源:发表于2021-01-12 09:19 被阅读0次

我们是英文系统,在我调用ws_download和gui_download的时候内表的中文在excel里都变成了#

中文变成#

尝试增加列宽行高,不行
更改Codepage参数,乱码

最后尝试一个很好用的的函数,解决了这个问题,而且还不会有弹窗

弹窗
PARAMETERS: p_path  LIKE rlgrap-filename.
"文件名.xlsx  就不会有弹窗
  CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
    EXPORTING
*     I_FIELD_SEPERATOR          =
      i_line_header  = 'X'
      i_filename     = p_path
*     I_APPL_KEEP    = ' '
    TABLES
      i_tab_sap_data = gt_tab
* CHANGING
*     I_TAB_CONVERTED_DATA       =
* EXCEPTIONS
*     CONVERSION_FAILED          = 1
*     OTHERS         = 2
    .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ELSE.
    MESSAGE 'successful!' TYPE 'S'.
  ENDIF.

附上文件路径的F4帮助

AT SELECTION-SCREEN OUTPUT.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
  PERFORM frm_path_f4.
FORM frm_path_f4 .
  DATA: lv_text      TYPE string,                    "message
        lv_filename  TYPE string,                    "download file name
        lv_path      TYPE string,                    "download file path
        lv_title     TYPE string ,                   "title
        lv_fullpath  TYPE string,                    "full path
        l_init_fname TYPE string.
  lv_title      = text-002.
  " lv_title_name = text-003.

  CONCATENATE 'Info loan-文件' sy-datum '.xlsx' INTO l_init_fname.
"l_init_fname有值可以直接选到文件夹,没有值得时候需要手动给
  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      window_title      = lv_title      " 保存'
      default_file_name = l_init_fname " 客户合作伙伴导入模板
    CHANGING
      filename          = lv_filename
      path              = lv_path
      fullpath          = lv_fullpath.
  p_path = lv_fullpath.
ENDFORM.

相关文章

网友评论

      本文标题:内表下载至excel,中文变成#号

      本文链接:https://www.haomeiwen.com/subject/uplsaktx.html