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 using abap

Former Member
0 Likes
430

Hello all,

I am using ole to send mail.The mail is sent properly but a popup appears before sending the mail saying that a program is trying to send mail on your behalf..and prompting for a yes or no.If yes is opted then the mail is sent . I want to suppress this popup,can anybody help?

Regards,

Niky.

Hello all,

I am using ole to send mail.The mail is sent properly but a popup appears before sending the mail saying that a program is trying to send mail on your behalf..and prompting for a yes or no.If yes is opted then the mail is sent . I want to suppress this popup,can anybody help?

Regards,

Niky.

2 REPLIES 2
Read only

Former Member
0 Likes
384

HI,

USE THIS FM

SO_NEW_DOCUMENT_ATT_SEND_API1

reward if helpful

thanks

vivekanand

Read only

gopi_narendra
Active Contributor
0 Likes
384

You can use this FM :SO_NEW_DOCUMENT_SEND_API1 in ABAP to send email to external emails.

See the below sample code

  email_data-obj_name = 'MESSAGE'.
  email_data-obj_descr = title.
  email_data-obj_langu = 'E'.
  email_data-sensitivty = 'P'.
  email_data-obj_prio = '1'.
  email_data-no_change = 'X'.
  email_data-priority = '1'.

  loop at username.
    email_send-receiver = username-id.
    email_send-rec_type = ' '.   " Sap user.
    email_send-express  = 'X'.   " Pop up SAP dialogue
*  email_send-to_answer = 'X'.
    append email_send.
  endloop.

  loop at message.
    data_tab-line = message-text.
    append data_tab.
  endloop.

  call function 'SO_NEW_DOCUMENT_SEND_API1'
    exporting
      document_data = email_data
      document_type = 'RAW'
      put_in_outbox = 'X'
    tables
      object_content = data_tab
      receivers   = email_send
    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.
    write: / 'Error in sending mail to ', username.
  endif.

Regards

Gopi