赛跑网

 找回密码
 注册
查看: 5923|回复: 4

[ABAP问题] 发送中文邮件时附件出现乱码

[复制链接]
发表于 2013-3-13 19:00:09 | 显示全部楼层 |阅读模式
1赛跑币
  我用SO_DOCUMENT_SEND_API1发送中文邮件时,附件中的中文都会变成乱码?这个问题怎么解决呢?

附部分代码:
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = lv_obj_descr.         "mail title
      w_doc_data-sensitivty = 'F'.

*     Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.

*     Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.

      DESCRIBE TABLE it_attach LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  'CSV'.               "execl mode
      t_packing_list-obj_descr  =  lv_obj_descr.         "mail name
*      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.

*     Add the recipients email address
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-express = 'X'.
*      t_receivers-notif_del = 'X'.
*      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.

      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = w_doc_data
          put_in_outbox              = 'X'
*          sender_address             = ''
*          sender_address_type        = ''
          commit_work                = 'X'
*        IMPORTING
*          sent_to_all                = w_sent_all
        TABLES
          packing_list               = t_packing_list
          contents_bin               = it_attach
          contents_txt               = it_message
          receivers                  = t_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.





上一篇:CO-PC 成本核算单中的贷方如何解释
下一篇:过账时自动带出固定资产编号??
本楼点评(0) 收起
 楼主| 发表于 2013-3-15 17:34:14 | 显示全部楼层
使用类
  cl_bcs_convert=>string_to_solix(
          EXPORTING
            iv_string   = it_attach-line
            iv_codepage = '4110'          "suitable for MS Excel, leave empty  4103
            iv_add_bom  = 'X'               "for other doc types
          IMPORTING
            et_solix  = l_binary       "(of type solix_tab)
            ev_size   = size ).
记住有时候程序会因为 codepage 不同而达不到效果,比如产生html附件就要用4103.
本楼点评(0) 收起
回复

使用道具 举报

 楼主| 发表于 2013-3-18 17:02:06 | 显示全部楼层
本帖最后由 布拉德与朔太郎 于 2013-3-18 17:04 编辑

自己顶一个!!版主到时间帮忙确定最佳回复。
本楼点评(0) 收起
回复

使用道具 举报

发表于 2013-3-19 08:52:33 | 显示全部楼层
清晨看帖顺便拿分
本楼点评(0) 收起
回复

使用道具 举报

发表于 2013-3-19 09:40:28 | 显示全部楼层
好复杂了,我也赚个币赶紧溜吧
本楼点评(0) 收起
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|联系我们|赛跑网 ( 苏ICP备14021163号-4QQfsq

GMT+8, 2026-8-3 18:23 , Processed in 0.208938 second(s), 38 queries .

Powered by 91SAP X3.4

© 2001-2023 91sap Team.

快速回复 返回顶部 返回列表