10-31-2006 12:35 PM
hi everybody
im using fm SO_NEW_DOCUMENT_SEND_API1 to send mail,
i have 2 receivers, the mail is being sent properly but the sender is getting the mails twice in his mailbox
there are 2 receivers and 1 sender
the sender should receive the mail once, isnt it?
heres my code
concatenate '9118' '@email.net' into mailrec-receiver.
mailrec-rec_type = 'U'.
append mailrec.
concatenate '9808' '@email.net' into mailrec-receiver.
mailrec-rec_type = 'U'.
append mailrec.
loop at mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
is my code wrong?
10-31-2006 12:48 PM
Hi
The following code will work properly and sending the mail twice as u have used loop at mailrec.So Mail has been sent two times thats why sender has two mails in sent items.
Just remove loop and endloop from ur code and execute
that will work
Or try this
U can try like this
concatenate '9118''@email.net' into mailrec1-receiver1.
concatenate '9808''@email.net' into mailrec-receiver2.
concatenate mailrec1-receiver1 mailrec-receiver2 into mailrec-receiver separeted by ';'.
mailrec-rec_type = 'U'.
append mailrec.
then
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
I think it should work
just correct syntax errors.
If helpful reward points
Regs
Manas Ranjan Panda
Message was edited by: MANAS PANDA
10-31-2006 12:42 PM
Hi,
there is nothing wrong in your code.
i guess in your outbox you are able to see two mails separately is it so.
since you are sending it to two peoples, you will see two mails in your out box.
Regards
vijay
10-31-2006 12:44 PM
is there a way to receive it only once in the sender's outbox?
because the user wants the email to appear only once in the sender's outbox, can that be done?
10-31-2006 12:43 PM
hi,
just refresh the internal table <b>mailrec</b> before
the appending of mail id's
rgds
anver
10-31-2006 12:44 PM
hi sia,
the problem is, that you loop?
in the FM there is the table mailrec with 2 receiver
and you execute the FM 2 times.
You don't have to loop!
Regards, Dieter
10-31-2006 12:48 PM
Hi
The following code will work properly and sending the mail twice as u have used loop at mailrec.So Mail has been sent two times thats why sender has two mails in sent items.
Just remove loop and endloop from ur code and execute
that will work
Or try this
U can try like this
concatenate '9118''@email.net' into mailrec1-receiver1.
concatenate '9808''@email.net' into mailrec-receiver2.
concatenate mailrec1-receiver1 mailrec-receiver2 into mailrec-receiver separeted by ';'.
mailrec-rec_type = 'U'.
append mailrec.
then
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
I think it should work
just correct syntax errors.
If helpful reward points
Regs
Manas Ranjan Panda
Message was edited by: MANAS PANDA
10-31-2006 1:08 PM
10-31-2006 12:52 PM
Hi anjali,
Remove the loop at mailrec.
the mailrec internal table will have the mail ids of the receiver so you need not to loop this internal table to send the mail to each receiver.
The FM it self will send the mail to all the receiver which are populated in this internal table.
Hope this will work.
Regards,
Satya