码迷,mamicode.com
首页 > 其他好文 > 详细

SAP中发送邮件

时间:2014-08-22 19:25:59      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   os   io   ar   art   

bubuko.com,布布扣
 1 DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
 2       docdata LIKE sodocchgi1,
 3       objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
 4       objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
 5       reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
 6       objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
 7 
 8 DATA: tab_lines TYPE i.
 9 
10 *----------------------------------------------------------------------*
11 
12 START-OF-SELECTION.
13   docdata-obj_descr = 发到邮件自动OBJ_DESCR.
14   docdata-obj_name = OBJ_NAME.
15   docdata-obj_langu = sy-langu.
16 
17   objtxt = 标题OBJTXT..
18   APPEND objtxt.
19 
20   objtxt = docdata-obj_descr.
21   APPEND objtxt.
22 
23   objtxt = 测试..
24   APPEND objtxt.
25 
26 * Write Packing List (Main)
27 * 3 has been fixed because OBJTXT has fix three lines
28   READ TABLE objtxt INDEX 3.
29 
30   docdata-doc_size = ( 3 - 1 ) * 255 + strlen( objtxt ).
31   CLEAR objpack-transf_bin.
32   objpack-head_start = 1.
33   objpack-head_num = 0.
34   objpack-body_start = 1.
35   objpack-body_num = 3.
36   objpack-doc_type = RAW.
37   APPEND objpack.
38 
39   reclist-receiver = ***."如果是发到工作台就填登陆用户名,如果是发到email就添email地址
40   reclist-receiver = tfhzy.
41   TRANSLATE reclist-receiver TO UPPER CASE.
42   reclist-rec_type = B."发到工作台
43 *RECLIST-REC_TYPE = ‘U‘."发到外部信箱
44   APPEND reclist.
45 
46   CALL FUNCTION SO_NEW_DOCUMENT_ATT_SEND_API1
47     EXPORTING
48       document_data                    = docdata
49 *   PUT_IN_OUTBOX                    = ‘ ‘
50       commit_work                      = X
51 * IMPORTING
52 *   SENT_TO_ALL                      =
53 *   NEW_OBJECT_ID                    =
54     TABLES
55       packing_list                     = objpack
56 *    OBJECT_HEADER                    = OBJHEAD
57 *   CONTENTS_BIN                     =
58       contents_txt                     = objtxt
59 *   CONTENTS_HEX                     =
60 *   OBJECT_PARA                      =
61 *   OBJECT_PARB                      =
62       receivers                        = reclist
63    EXCEPTIONS
64      too_many_receivers               = 1
65      document_not_sent                = 2
66      document_type_not_exist          = 3
67      operation_no_authorization       = 4
68      parameter_error                  = 5
69      x_error                          = 6
70      enqueue_error                    = 7
71      OTHERS                           = 8
72             .
73   IF sy-subrc <> 0.
74 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
75 *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
76   ENDIF.
View Code

不知为何,一直返回异常报错,sy-subrc = 6,猜测是权限的问题。

SAP中发送邮件

标签:des   style   blog   http   color   os   io   ar   art   

原文地址:http://www.cnblogs.com/ruingy/p/3929970.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!