发送Email

REPORT  z_barry_send_express_mail.

PARAMETERS: p_uname(40) TYPE c DEFAULT 'BAITZ' .

DATA: it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
      it_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
      gd_sent_all(1) TYPE c,
      gd_doc_data LIKE sodocchgi1 .

START-OF-SELECTION.
  PERFORM send_email .

*&---------------------------------------------------------------------*
*& Form SEND_EMAIL_MESSAGE
*&---------------------------------------------------------------------*
FORM send_email .

  APPEND 'asfasfadsf' TO it_contents.
  APPEND 'asfasdfasfafasfa' TO it_contents.

  gd_doc_data-obj_langu = sy-langu.
  gd_doc_data-obj_descr = '此处填主题'.

  CLEAR it_packing_list.
  REFRESH it_packing_list.
  it_packing_list-transf_bin = space.
  it_packing_list-head_start = 1.
  it_packing_list-head_num = 0.
  it_packing_list-body_start = 1.
  DESCRIBE TABLE it_contents LINES it_packing_list-body_num.
  it_packing_list-doc_type = 'RAW'.
  APPEND it_packing_list.

  CLEAR it_receivers.
  REFRESH it_receivers.
  it_receivers-receiver = p_uname.
  it_receivers-rec_type = 'B'.
  it_receivers-com_type = 'INT'.
  it_receivers-notif_del = 'X'.
  it_receivers-notif_ndel = 'X'.
  it_receivers-express  = 'X'.
  APPEND it_receivers.

  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = gd_doc_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    IMPORTING
      sent_to_all                = gd_sent_all
    TABLES
      packing_list               = it_packing_list
      contents_txt               = it_contents
      receivers                  = it_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.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    "send_email

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值