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

sending mail

Former Member
0 Likes
655

hai

what is the function module used for sending a mail to yahoo or gmail etcc.....

thx in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
632

Hi,

Please check this FM.

SO_NEW_DOCUMENT_ATT_SEND_API1

SO_OBJECT_SEND

Please check this link for sample code.

http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm

Regards,

Ferry Lianto

4 REPLIES 4
Read only

Former Member
0 Likes
633

Hi,

Please check this FM.

SO_NEW_DOCUMENT_ATT_SEND_API1

SO_OBJECT_SEND

Please check this link for sample code.

http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm

Regards,

Ferry Lianto

Read only

amit_khare
Active Contributor
0 Likes
632

Hi,

there are many function modules to send mails from SAp, depends on your requirements.

You may check the programs in this link also for reference.

Amit's program is a really good one.

Regards,

Amit

Read only

Former Member
0 Likes
632

Hi

use the function module <b>SO_NEW_DOCUMENT_ATT_SEND_API1</b>

/people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface

Regards

Sudheer

Read only

Former Member
0 Likes
632

Hi,

Check this sample code..

  • Declarations.

PARAMETERS: p_email(50) LOWER CASE.

DATA: document_data LIKE sodocchgi1.

DATA: t_content LIKE STANDARD TABLE OF solisti1.

DATA: s_content LIKE solisti1.

DATA: t_receivers LIKE STANDARD TABLE OF somlreci1.

DATA: s_receivers LIKE somlreci1.

START-OF-SELECTION.

  • Receivers.

s_receivers-receiver = p_email.

s_receivers-rec_type = 'U'.

s_receivers-express = 'X'.

APPEND s_receivers TO t_receivers.

  • Subject

document_data-obj_descr = 'New mail from Sap'.

  • Body

s_content = 'Hi,'.

APPEND s_content TO t_content.

CLEAR: s_content.

APPEND s_content TO t_content.

s_content = 'Test email from sap, please don''t reply to this email'.

APPEND s_content TO t_content.

CLEAR: s_content.

APPEND s_content TO t_content.

s_content = 'Thanks,'.

APPEND s_content TO t_content.

s_content = 'Naren.'.

APPEND s_content TO t_content.

  • Send the email.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = document_data

TABLES

object_content = t_content

receivers = t_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 e208(00) WITH 'Error in sending email :-(('.

ELSE.

MESSAGE s208(00) WITH 'Email sent )'.

ENDIF.

SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.

Thanks,

Naren