Skip to Content
author's profile photo Former Member
Former Member

Sending mail

while tryign to send email to external mail id, its not being sent to the recepiient. The mail is listed in SOST transaction. When i executed it again, its showing (red icon )error.

Attachign the code:



lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.

lo_send_request = cl_bcs=>create_persistent( ).

* Message body and subject


lt_message_body TYPE bcsy_text VALUE IS INITIAL,

lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.

APPEND 'Dear,' TO lt_message_body.

APPEND ' ' TO lt_message_body.

APPEND 'Please fill the attached form and send it back to us.'

TO lt_message_body.

APPEND 'URL' TO lt_message_body.

APPEND 'Thank You,' TO lt_message_body.

lo_document = cl_document_bcs=>create_document(

i_type = 'RAW'

i_text = lt_message_body

i_subject = 'Personnel Information Form' ).

DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.

* Pass the document to send request

lo_send_request->set_document( lo_document ).

* Create sender


lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,

l_send TYPE adr6-smtp_addr VALUE 'SENDER_ID',

l_reci TYPE adr6-smtp_addr.

l_reci = '<mail id>. "Approver's email address

* lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).

lo_sender = cl_sapuser_bcs=>create( sy-uname ).

* Set sender



i_sender = lo_sender ).

* create recipient


lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.

lo_recipient = cl_cam_address_bcs=>create_internet_address( l_reci ).

** Set recipient



i_recipient = lo_recipient

i_express = 'X' ).

* lo_send_request->add_recipient(


* i_recipient = lo_recipient

* i_express = 'X' ).* Send email

DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.



i_with_error_screen = 'X'


result = lv_sent_to_all ).


Kindly help

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on May 17, 2015 at 12:21 PM

    Dear Ashly,

    I have also faced the same issue last week. When i checked my code i found the sender issue.

    Please check the sender address,

    You have mentioned here SY-UNAME, but in idle case it should be WF-BATCH.

    lo_sender = cl_sapuser_bcs=>create( sy-uname )

    Please check, if error still persist let us know.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 18, 2015 at 03:22 PM

    Hello Ashly,

    Email is displayed in SOST and is not transmitted to the receiver, then the receiver email address may not be maintained in transaction SCOT. Usally Security or Basis team can add these email addresses under SMTP node in SCOT.

    The other possibility could be a background job scheduled by basis should run frequently to send these email out.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.