SAP ABAP 内部发邮件

REPORT zhelllo.
TABLES: usr02.
DATA: lt_pack_list TYPE swftpcklst WITH HEADER LINE,
      lt_contents  TYPE swftlisti1 WITH HEADER LINE,
      st_contents  TYPE swftlisti1 WITH HEADER LINE,
      lt_receivers TYPE somlreci1_t WITH HEADER LINE,
      it_contents TYPE swftlisti1 WITH HEADER LINE,
      value TYPE i VALUE 5,
      doc_data     LIKE sodocchgi1 .

SELECT-OPTIONS:
                s_uname FOR usr02-bname NO INTERVALS OBLIGATORY.

DO value TIMES.
  CONCATENATE
    ` ` '2'
    `` '3'
    `` '3'
    `` '4'
    `` '5'
    `` '6'
    `` '6'
    ``
    INTO st_contents .
  APPEND st_contents.
ENDDO.

APPEND `   错误明细` TO lt_contents.
APPEND `` TO lt_contents.

APPEND `` TO
lt_contents.
APPEND ` ` TO lt_contents.
APPEND `` TO lt_contents.
APPEND ``  TO lt_contents.
APPEND ``  TO lt_contents.
APPEND `` TO lt_contents.
APPEND ``  TO lt_contents.
APPEND `` TO lt_contents.
APPEND `` TO lt_contents.
APPEND `` TO lt_contents.

APPEND LINES OF st_contents TO lt_contents.

APPEND '
物料凭证年度采购订单项目采购申请项目错误信息

' TO lt_contents. APPEND ' ' TO lt_contents. doc_data-obj_langu = sy-langu. doc_data-obj_descr = '寄售物料自动移库程序关闭PR失败'. lt_pack_list-transf_bin = space. lt_pack_list-head_start = 1. lt_pack_list-head_num = 0. lt_pack_list-body_start = 1. DESCRIBE TABLE lt_contents LINES lt_pack_list-body_num. lt_pack_list-doc_type = 'HTML'. APPEND lt_pack_list. LOOP AT s_uname. lt_receivers-receiver = s_uname-low. lt_receivers-rec_type = 'B'. lt_receivers-com_type = 'INT'. lt_receivers-notif_del = 'X'. lt_receivers-notif_ndel = 'X'. lt_receivers-express = 'X'. APPEND lt_receivers. ENDLOOP. CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = doc_data put_in_outbox = 'X' commit_work = 'X' TABLES packing_list = lt_pack_list contents_txt = lt_contents receivers = lt_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.

你可能感兴趣的:(SAP ABAP 内部发邮件)