Application Development and Automation 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: 
Read only

Function Module that generate a mail from the Program

Former Member
0 Likes
400

Hi guys,

I need a Function Module that generate a mail to a person

when the Program run

Regards,

Surjith

3 REPLIES 3
Read only

Former Member
0 Likes
378
  • Call the function module to send the mail

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_type = lc_raw

document_data = gs_doc_chng

put_in_outbox = gc_x

commit_work = gc_x

TABLES

object_header = gt_objhead

object_content = gt_objtxt

receivers = gt_reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

CASE sy-subrc.

WHEN 0.

SKIP.

FORMAT COLOR 3 ON.

WRITE:/ 'Mail has been sent successfully to below mentioned IDs:->'(005)

.

FORMAT COLOR 3 OFF.

WRITE:/ p_dlist.

WRITE:/ sy-uname.

WHEN 1.

WRITE: / 'Too many receivers specified !'(017).

WHEN 2.

WRITE: / 'No receiver got the document !'(018).

WHEN 4.

WRITE: / 'Missing send authority !'(016).

WHEN OTHERS.

WRITE: / 'Unexpected error occurred !'(019).

ENDCASE.

Read only

Former Member
0 Likes
378

Hi Surjith,

Please check the below link for more info.

<b>

Reward Points if Useful</b>

Regards

Gokul

Read only

0 Likes
378

Hi,

If u want to send a mail to SAP INBOX then u can use the FM's given below.

<b>Z_SEND_MAIL_PROGRAM_COMPLETE</b> - Send SAPOffice Mail stating that a program has completed.

<b>Z_SEND_SAPOFFICE_MAIL</b> - Send SAPOffice Mail to User.

Suppose in your scenario may be u want to send a mail to the user after completing the program execution. Then we can use these FM's to send a mail to the users.