09-23-2015 8:30 AM
Hi Guys,
I am sending mails to different recipients using FM SO_NEW_DOCUMENT_SEND_API1, problem is here I need to send a default sender email address instead of sy-uname. I have gone through the blogs but nothing was working fine to me.
Please do let me know how can we achieve this.
Even I tested with FM SO_DOCUMENT_SEND_API1, I am getting error as Virus scan profile is not active and also I am not attaching any documents while sending email in this can I use this FM.
Thanks in advance.
09-23-2015 8:39 AM
Try to use CL_BCS class and not outdated FM
data: lo_bcs type ref to cl_bcs,
lo_sender type ref to if_sender_bcs,
lv_mail type ad_smtpadr.
lv_mail = 'do-not-reply@your-domain.com'.
lo_sender = cl_cam_address_bcs=>create_internet_address( lv_mail ).
lo_bcs->set_sender( lo_sender ).
Regards,
Raymond
09-23-2015 8:39 AM
Try to use CL_BCS class and not outdated FM
data: lo_bcs type ref to cl_bcs,
lo_sender type ref to if_sender_bcs,
lv_mail type ad_smtpadr.
lv_mail = 'do-not-reply@your-domain.com'.
lo_sender = cl_cam_address_bcs=>create_internet_address( lv_mail ).
lo_bcs->set_sender( lo_sender ).
Regards,
Raymond
09-23-2015 9:44 AM
Hi Raymond,
I tried with this too but it is looking for email address from ADR6 table, but in my case I would like to use one static email ID for sender.
do we need any prerequisite for this.
09-24-2015 9:08 AM
thanks for the reply.it is working fine.
but the problem is I would line to pass different text in subject of email and header of email .
I tried with I_header parameter of create_document method of class cl_document_bcs.
but it is not working for me.
09-24-2015 10:45 AM
So you put some lines in I_HEADER and a text in I_SUBJECT, did you get an error and did you try to read the message with different email clients, else build a small html and pass it it I_TEXT.
(
Regards,
Raymond
09-23-2015 9:54 AM
09-24-2015 12:20 PM
Hi,
This is a bit late reply bit if you have not still found the solution, here it is.
It will work cent % because I had worked on the similar requirement and this fm worked fine.
FM - 'SO_DOCUMENT_SEND_API1'
it has a parameter named sender_address, here you can pass the default sender email, that will actually overwrite the sy-uname in sender.
V_SENDER = 'XXX@GMAIL.com'
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = C_X
SENDER_ADDRESS = V_SENDER
COMMIT_WORK = C_X
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_TXT = OBJTXT
CONTENTS_HEX = OBJBIN
RECEIVERS = RECLIST
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.