2008 Jul 15 3:43 PM
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.
2008 Jul 15 3:51 PM
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.
2008 Jul 15 3:45 PM
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
2008 Jul 15 3:46 PM
2008 Jul 15 3:48 PM
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
2008 Jul 15 3:51 PM
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.