Chinaunix首页 | 论坛 | 博客
  • 博客访问: 462228
  • 博文数量: 199
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1902
  • 用 户 组: 普通用户
  • 注册时间: 2020-05-14 13:25
个人简介

代码5S

文章分类

全部博文(199)

文章存档

2021年(5)

2020年(194)

我的朋友

分类:

2020-05-20 13:22:13

原文地址:SAP发送工作台快件 作者:qdbarry

REPORT  z_barry_send_express_mail.

PARAMETERS: p_uname(40TYPE 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(1TYPE 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
 
 
 
或者使用简单方法,只能发送文本:
REPORT  zrs08199  .
 
DATA: ztext LIKE soli OCCURS 0 WITH HEADER LINE .
PARAMETERS: uname LIKE usr02-bname .
 
START-OF-SELECTION .
  EDITOR-CALL FOR ztext.
  CALL FUNCTION 'RS_SEND_MAIL_FOR_SPOOLLIST'
    EXPORTING
      mailname  = 'aaa'
      mailtitel = 'bbb'
      user      = uname
    TABLES
      text      = ztext
    EXCEPTIONS
      error     = 1
      OTHERS    = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
阅读(807) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~