首页 > 代码库 > SAP中发送邮件

SAP中发送邮件

 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 lines28   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_API147     EXPORTING48       document_data                    =http://www.mamicode.com/ docdata49 *   PUT_IN_OUTBOX                    = ‘ ‘50       commit_work                      = X51 * IMPORTING52 *   SENT_TO_ALL                      =53 *   NEW_OBJECT_ID                    =54     TABLES55       packing_list                     = objpack56 *    OBJECT_HEADER                    = OBJHEAD57 *   CONTENTS_BIN                     =58       contents_txt                     = objtxt59 *   CONTENTS_HEX                     =60 *   OBJECT_PARA                      =61 *   OBJECT_PARB                      =62       receivers                        = reclist63    EXCEPTIONS64      too_many_receivers               = 165      document_not_sent                = 266      document_type_not_exist          = 367      operation_no_authorization       = 468      parameter_error                  = 569      x_error                          = 670      enqueue_error                    = 771      OTHERS                           = 872             .73   IF sy-subrc <> 0.74 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO75 *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.76   ENDIF.
View Code

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

SAP中发送邮件