Created
May 11, 2016 03:22
-
-
Save rijdz/b5f91e85d08da8178dc434277199c138 to your computer and use it in GitHub Desktop.
[SAP-ABAP] Procedure Send Email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REPORT ZBPC_EMAIL_001. | |
DATA : LV_EMAIL(241). | |
DATA : LT_MESSAGE TYPE TABLE OF SOLISTI1, | |
LS_MESSAGE TYPE SOLISTI1, | |
LT_ATTACH TYPE TABLE OF SOLISTI1, | |
LS_ATTACH TYPE SOLISTI1, | |
LT_RECEIVERS TYPE TABLE OF SOMLRECI1, | |
LS_RECEIVERS TYPE SOMLRECI1, | |
LS_DOC_DATA TYPE SODOCCHGI1. | |
DEFINE MC_APPEND_MSG. | |
CLEAR &1. | |
CONCATENATE &3 &4 &5 INTO &1 | |
SEPARATED BY space. | |
CONDENSE &1. | |
APPEND &1 to &2. | |
END-OF-DEFINITION. | |
"set up doc_data | |
LS_DOC_DATA-SENSITIVTY = 'F'. "Fill the document data and get size of attachment | |
LS_DOC_DATA-DOC_SIZE = 150 * 255. "Populate the subject/generic message attributes | |
LS_DOC_DATA-OBJ_LANGU = SY-LANGU. | |
LS_DOC_DATA-OBJ_NAME = 'SAPRPT'. | |
"header | |
CONCATENATE 'Test Notif Error BPC' '' INTO LS_DOC_DATA-OBJ_DESCR SEPARATED BY SPACE. | |
"set up message | |
MC_APPEND_MSG LS_MESSAGE LT_MESSAGE '<h3>Hello, This is BPC Bot</h3>' '' ''. | |
MC_APPEND_MSG LS_MESSAGE LT_MESSAGE '<p class="lead">I will generate email everytime there are error in Process Chain.</p>' '' ''. | |
"set up receivers | |
LS_RECEIVERS-RECEIVER = 'name@domain.com'. | |
LS_RECEIVERS-REC_TYPE = 'U'. | |
LS_RECEIVERS-COM_TYPE = 'INT'. | |
LS_RECEIVERS-NOTIF_DEL = 'X'. | |
LS_RECEIVERS-NOTIF_NDEL = 'X'. | |
APPEND LS_RECEIVERS TO LT_RECEIVERS. | |
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1' | |
EXPORTING | |
DOCUMENT_DATA = LS_DOC_DATA | |
DOCUMENT_TYPE = 'HTM' " To get the notification in HTML format | |
COMMIT_WORK = 'X' | |
TABLES | |
OBJECT_CONTENT = LT_MESSAGE | |
RECEIVERS = LT_RECEIVERS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment