Chinaunix首页 | 论坛 | 博客
  • 博客访问: 688533
  • 博文数量: 194
  • 博客积分: 7067
  • 博客等级: 少将
  • 技术积分: 2008
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-09 14:48
个人简介

我很好

文章分类

全部博文(194)

文章存档

2019年(1)

2018年(1)

2017年(3)

2015年(2)

2012年(2)

2011年(1)

2010年(27)

2009年(15)

2008年(142)

分类: WINDOWS

2008-04-14 13:46:51

REPORT ZSEND .

TABLES: KNA1.

* data for send function
DATA DOC_DATA  LIKE SODOCCHGI1.
DATA OBJECT_ID LIKE SOODK.
DATA OBJCONT   LIKE SOLI OCCURS 10 WITH HEADER LINE.
DATA RECEIVER  LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.

SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.
  WRITE:/ KNA1-KUNNR, KNA1-ANRED.

* send data internal table
  CONCATENATE KNA1-KUNNR KNA1-ANRED
                         INTO OBJCONT-LINE SEPARATED BY SPACE.

  APPEND OBJCONT.
ENDSELECT.

* insert receiver (sap name)
  REFRESH RECEIVER.
  CLEAR RECEIVER.
  MOVE: SY-UNAME TO RECEIVER-RECEIVER,
        'X'      TO RECEIVER-EXPRESS,
        'B'      TO RECEIVER-REC_TYPE.
  APPEND RECEIVER.

* insert mail description
  WRITE 'Sending a mail through abap'
                 TO DOC_DATA-OBJ_DESCR.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
     EXPORTING
          DOCUMENT_DATA              = DOC_DATA
     IMPORTING
          NEW_OBJECT_ID              = OBJECT_ID
     TABLES
          OBJECT_CONTENT             = OBJCONT
          RECEIVERS                  = RECEIVER
     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.

阅读(793) | 评论(0) | 转发(0) |
0

上一篇:函数列表

下一篇:SAP发送邮件(二)

给主人留下些什么吧!~~