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: 

Regarding Default sender with E-mail

Former Member
0 Kudos
464

Hi,

I am using the FM u201CSO_NEW_DOCUMENT_SEND_APIu201D to send an email to receivers. I would like change the default sender. So is there a way of changing who the sender is?

Please let me know, if you have any idea on above mentiones.

Reward points will be there.

Regards,

Suresh Kumar.

1 ACCEPTED SOLUTION

former_member181995
Active Contributor
0 Kudos
149

Suresh,

pls do not breed about points.

the best solution is that you can you sender email address by selection screen just like:

PARAMETERS: p_addr type AD_SMTPADR.

then:

INITIALIZATION.
CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'
 EXPORTING
   I_USER                    = SY-UNAME
 IMPORTING
   E_EMAIL_ADDRESS           = p_addr
 EXCEPTIONS
   MAIL_ADDRESS              = 1
   DETERMINATION_ERROR       = 2
   OTHERS                    = 3
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

finally pass p_addr into your FM as sender id.

Amit.

4 REPLIES 4

Former Member
0 Kudos
149

Check the example: BCS_EXAMPLE_3.

try.

  • -------- create persistent send request ------------------------

send_request = cl_bcs=>create_persistent( ).

  • -------- create and set document -------------------------------

  • create document from internal table with text

APPEND 'Hello world!' TO text.

document = cl_document_bcs=>create_document(

i_type = 'RAW'

i_text = text

i_length = '12'

i_subject = 'test created by BCS_EXAMPLE_3' ).

  • add document to send request

CALL METHOD send_request->set_document( document ).

  • --------- create and set note ----------------------------------

APPEND 'This is my little note' TO note.

CALL METHOD send_request->set_note( note ).

*     --------- set sender -------------------------------------------
*     note: this is necessary only if you want to set the sender
*           different from actual user (SY-UNAME). Otherwise sender is
*           set automatically with actual user.

      sender = cl_sapuser_bcs=>create( sy-uname ).
      CALL METHOD send_request->set_sender
        EXPORTING i_sender = sender.

Regards

Kannaiah

Former Member
0 Kudos
149

hi check this..

Former Member
0 Kudos
149

FM SO_NEW_DOCUMENT_SEND_API calls SO_DOCUMENT_SEND_API1 - with this FM you can change the name of the user sending the message. Change your program to use this one instead.

J

former_member181995
Active Contributor
0 Kudos
150

Suresh,

pls do not breed about points.

the best solution is that you can you sender email address by selection screen just like:

PARAMETERS: p_addr type AD_SMTPADR.

then:

INITIALIZATION.
CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'
 EXPORTING
   I_USER                    = SY-UNAME
 IMPORTING
   E_EMAIL_ADDRESS           = p_addr
 EXCEPTIONS
   MAIL_ADDRESS              = 1
   DETERMINATION_ERROR       = 2
   OTHERS                    = 3
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

finally pass p_addr into your FM as sender id.

Amit.