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

To send email

Former Member
0 Likes
834

Hi,

Can anyone please let me know whether there are any function module to send an email to SAP Inbox?

Thanks..

Uma.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
800

Yes, there is.

Try this. It will send a mail to your inbox.



report zrich_0003 .

* For API
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 = 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.

Regards,

Rich Heilman

Hi,

Can anyone please let me know whether there are any function module to send an email to SAP Inbox?

Thanks..

Uma.

7 REPLIES 7
Read only

former_member194669
Active Contributor
0 Likes
800

Hi,

Check this

aRs

Read only

Former Member
0 Likes
800

Hi

Check the fun modules

UWSP_SEND_MAIL_TO_WEB

SO_NEW_DOCUMENT_ATT_SEND_API1

to send mails to the respective mail Ids

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
801

Yes, there is.

Try this. It will send a mail to your inbox.



report zrich_0003 .

* For API
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 = 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.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
800

Hi

Check the fun modules

UWSP_SEND_MAIL_TO_WEB

SO_NEW_DOCUMENT_ATT_SEND_API1

to send mails to the respective mail Ids

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

Former Member
0 Likes
800

Hi

Check the fun modules

UWSP_SEND_MAIL_TO_WEB

SO_NEW_DOCUMENT_ATT_SEND_API1

to send mails to the respective mail Ids

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

hermanoclaro
Participant
0 Likes
800

Hi,

There were a lot of usefull answers above, but I would like to add something. You haven't said if you need to send attachment and no one posted a function to do that here, so, here it goes (using the parameters I needed):

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = e_document_data

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = t_packing_list

contents_bin = t_xml

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.

vg_erro = c_flag.

ELSE.

MESSAGE s007 WITH text-010.

ENDIF.

You can get more info looking in the FM, but these are the parameters I needed to send a e-mail with attachment.

Regards,

-h

Read only

piyush_mathur
Active Participant
0 Likes
800

Hi Uma ,

Use this function

SO_NEW_DOCUMENT_ATT_SEND_API1

If my answer is usefull to you, please reward points.

Thanks

Piyush Mathur