07-14-2008 10:18 AM
Hi Friends,
I am using FM SO_DOCUMENT_SEND_API1 to send email to external address. Everything is working fine except that the email address is placed in the CC: section instead of TO:
I have the following code and pass internal table gt_mailrecv in the function module.
gs_mailrecv-receiver = emailid.
gs_mailrecv-rec_type = 'U'.
gs_mailrecv-rec_date = sy-datum.
gs_mailrecv-express = 'X'.
APPEND gs_mailrecv TO gt_mailrecv.
Any idea why?
Thanks,
Nene
07-14-2008 10:31 AM
Hello nene,
Please try this code...
* Add the recipients email address
clear ireceivers.
refresh ireceivers.
ireceivers-receiver = email.
ireceivers-rec_type = 'U'.
ireceivers-com_type = 'INT'.
ireceivers-notif_del = 'X'.
ireceivers-notif_ndel = 'X'.
append ireceivers
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = xdocdata
put_in_outbox = 'X'
commit_work = 'X'
tables
packing_list = ipacking_list
contents_bin = iattachment
contents_txt = imessage
receivers = ireceivers
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.
.
Hope it helps you
Regards
Indu.
07-14-2008 10:29 AM
use SO_NEW_DOCUMENT_ATT_SEND_API1
<removed_by_moderator>
Bhupal
Edited by: Julius Bussche on Jul 14, 2008 10:15 AM
07-14-2008 10:30 AM
07-14-2008 10:31 AM
Hello nene,
Please try this code...
* Add the recipients email address
clear ireceivers.
refresh ireceivers.
ireceivers-receiver = email.
ireceivers-rec_type = 'U'.
ireceivers-com_type = 'INT'.
ireceivers-notif_del = 'X'.
ireceivers-notif_ndel = 'X'.
append ireceivers
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = xdocdata
put_in_outbox = 'X'
commit_work = 'X'
tables
packing_list = ipacking_list
contents_bin = iattachment
contents_txt = imessage
receivers = ireceivers
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.
.
Hope it helps you
Regards
Indu.
07-14-2008 10:50 AM
Thanks for the quick reply.
I tried your suggestions but didn't work
Forgot to mention that I am also passing a sender, but I am not sure that if that has something to do with the problem. Is there any setting for the receiver and/or sender addresses?
07-14-2008 12:59 PM
Hello,
That must not give an error, nene. Please check the COPY parameter mentioned by Storm.
The structure SOEXTRECI1 also has the COPY field ( DE: SO_SND_CP) Please check if it is also included in the exporting parameters.
Regards,
Indu.
07-15-2008 2:41 AM
Hi Indu,
No copy parameter is set. I tried removing this 2 lines and now it is placing the receiver in the TO section. This I don't understand, any reason behind?
gs_mailrecv-rec_date = sy-datum.
gs_mailrecv-express = 'X'.
Thanks for the response.
07-14-2008 10:51 AM
Hi,
Use this way
RECEIVERS-RECEIVER = T_MAILID-MAIL.
RECEIVERS-EXPRESS = 'X'.
RECEIVERS-COPY = T_MAILID-HRMAIL_CC .
RECEIVERS-REC_TYPE = 'U'.
APPEND RECEIVERS.
CLEAR RECEIVERS.
Here,T_MAILID-MAIL is the mailid 'TO' list and
T_MAILID-HRMAIL_CC is the mailid 'CC' list.