Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Email notification functionality to info IT/ Faciliites

anupam_srivastava2
Participant
0 Kudos

hi All

I have to undertake configuration hire an employee into Company. This hiring action should then trigger an automatic e-mail to the specified contacts within Facilities and IT.

Also have to make an employee a leaver of Company and this again should trigger an automatic e-mail to the specified contact within Facilities and IT.

Does any body has any idea how should I proceed.

rgds

AJ

1 REPLY 1

Former Member
0 Kudos

To program of hiring employee you can add code to send email to some address.

To send email you can use the Functional module:

1. SO_OBJECT_SEND

2. SO_DOCUMENT_SEND_API1

Ex:

REPORT Z34332_MAIL.
****************************************
* Check the mail in T-code SBWP
* To check the send mail status T-Code SOST
***********************************************

data: it_packing_list type table of SOPCKLSTI1,
wa_packing-list like line of it_packing_list,
it_receivers type table of SOMLRECI1,
wa_receivers like line of it_receivers,
it_mailbody type table of SOLISTI1,
wa_mailbody like line of it_mailbody.

data: la_doc type SODOCCHGI1.
* mail header
la_doc-OBJ_DESCR = 'HI'.

* Describe the body of the message
CLEAR wa_packing-list.
REFRESH it_packing_list.
wa_packing-list-transf_bin = space.
wa_packing-list-head_start = 1.
wa_packing-list-head_num = 0.
wa_packing-list-body_start = 1.
* DESCRIBE TABLE gt_mara LINES wa_packing-list-body_num.
wa_packing-list-body_num = 1.
wa_packing-list-doc_type = 'RAW'.
APPEND wa_packing-list to it_packing_list.

* Add the recipients email address
CLEAR wa_receivers.
REFRESH it_receivers.
wa_receivers-receiver = 'PCSDEVL'.
wa_receivers-rec_type = 'U'.
wa_receivers-com_type = 'INT'.
wa_receivers-notif_del = 'X'.
wa_receivers-notif_ndel = 'X'.
APPEND wa_receivers to it_receivers.

* Mail Body
CLEAR wa_mailbody.
REFRESH it_mailbody.
wa_mailbody-line = 'How are you.'.
APPEND wa_mailbody to it_mailbody.


CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = la_doc
PUT_IN_OUTBOX = 'X'
* SENDER_ADDRESS = SY-UNAME
* SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
tables
packing_list = it_packing_list
* OBJECT_HEADER =
* CONTENTS_BIN =
CONTENTS_TXT = it_mailbody
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_receivers
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 <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.