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: 

Sending email from a report program

Former Member
0 Kudos
63

Hi,

I have a requirement to update a z table.If the update is successful, commit work should be done.

If the update is not successful an error has to be reported.

All the errors reported in the program should be sent through an email to a particular addresse.

How to send the email from the report program?

1 REPLY 1

former_member386202
Active Contributor
0 Kudos
34

Hi,

Use following FM to send a mail

  • Call Function Module to sen the mail

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = ls_doc_change "Attribute of new document

put_in_outbox = gc_chk "Flag: Move document to outbox after send

commit_work = gc_chk "Execute explicit commit works at end of function module

TABLES

packing_list = gt_pack_list "Information about structure of data tables

contents_hex = gt_attach "Obsolete - see CONTENTS_HEX

contents_txt = gt_message "ASCII contents of object and attachments

receivers = gt_reciever "Document recipients with send attributes

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.

"#EC NEEDED

  • Mail Successfully Delivered

ENDIF.

Regards,

Prashant