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: 

To send mail outside SAP

Former Member
0 Kudos

Hi all,

I just want to understand that do we need to associate the exchange server to the SAP system to send the mail outsise. Please suggest.

Thanks,

Annup

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, you do, Its called SAPconnect. You can use transaction SCOT in R/3 system. See your basis team about setting this up.

Regards,

Rich Heilman

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, you do, Its called SAPconnect. You can use transaction SCOT in R/3 system. See your basis team about setting this up.

Regards,

Rich Heilman

0 Kudos

Once your basis team has it setup, then in your ABAP code just do something like this. That's it.

Also, you must make sure that your user id has a valid email address attached to it. Transaction SU01



report zrich_0003 .

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 = 'someone@somewhere.com'.
  mailrec-rec_type  = 'U'.
  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.


Regards,

Rich Heilman

0 Kudos

Dear Rich,

Thanks for your help.

Regds,

Anup