Abap ile mail gönderme
Merhaba abap ile mail gönderme işlemi yapabileceğiniz kodlar aşağıdaki gibidir.
*
Değişken tanımları
DATA
: LT_MAILSUBJECT
TYPE
SODOCCHGI1.
DATA
: LT_MAILRECIPIENTS
TYPE
STANDARD
TABLE
OF SOMLREC90
WITH
HEADER
LINE
.
DATA
: LT_MAILTXT
TYPE
STANDARD
TABLE
OF SOLI
WITH
HEADER
LINE
.
*
Recipients
LT_MAILRECIPIENTS-REC_TYPE =
'U'
.
LT_MAILRECIPIENTS-RECEIVER =
'sheetal@gmail.com'
.
APPEND
LT_MAILRECIPIENTS .
CLEAR
LT_MAILRECIPIENTS .
* Konu
.
LT_MAILSUBJECT-OBJ_NAME =
'TEST'
.
LT_MAILSUBJECT-OBJ_LANGU = SY-LANGU.
LT_MAILSUBJECT-OBJ_DESCR =
'Mail Subject'
.
*
Mail Contents
LT_MAILTXT =
'This is a test mail'
.
APPEND
LT_MAILTXT.
CLEAR
LT_MAILTXT.
*
Maili gönder
CALL
FUNCTION
'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = LT_MAILSUBJECT
TABLES
OBJECT_CONTENT = LT_MAILTXT
RECEIVERS = LT_MAILRECIPIENTS
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
EQ
0.
COMMIT
WORK
.
SUBMIT
RSCONN01
WITH
MODE
=
'INT'
AND
RETURN
.
ENDIF
.