Skip to Content
0
Nov 29, 2006 at 11:35 AM

Function Module to send mail to external email id using SAP

1272 Views

Hi,

I am trying to send a mail to external id . For this I have used the FM 'SO_NEW_DOCUMENT_SEND_API1'. Using this FM, I m sending mail to my SAP id as well as my gmail id(say,mail2neha@gmail.com). i have got the SAP mail but i m not getting the mail on my gmail id. When i tried to debug this FM, i got to know that the rec_tab which is used as the internal table to hold the receivers address does not contain my gmail id as the length of external id is more than 12 characters, which is not permissible. So can anyone sugeest me, what is the solution for that?

Below is given code that i have used:

REPORT ZNG_TEST .

data: maildata type sodocchgi1.

data: mailtxt type table of solisti1 with header line.

data: mailrec type table of somlrec90 with header line.

start-of-selection.

clear: maildata, mailtxt, mailrec.

refresh: mailtxt, mailrec.

maildata-obj_name = 'TEST'.

maildata-obj_descr = 'Test'.

maildata-obj_langu = sy-langu.

mailtxt-line = 'This is a test'.

append mailtxt.

mailrec-receiver = 'mail2neha@gmail.com'.

mailrec-rec_type = 'U'.

append mailrec.

mailrec-receiver = sy-uname.

mailrec-rec_type = 'B'.

append mailrec.

call function 'SO_NEW_DOCUMENT_SEND_API1'

exporting

document_data = maildata

document_type = 'RAW'

put_in_outbox = 'X'

tables

object_header = mailtxt

object_content = mailtxt

receivers = mailrec

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.

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = 'X'

EXPORTING LIST TO MEMORY

AND RETURN.

I got the similar question posted in SDN and it has given some solution related to Tranasction SCOT. but i have no idea how to work with it.

Please tell me what is the possible solution to send mail to my external id?