2008 Oct 14 10:14 PM
Hi Experts,
we are using 4.6c version and i would like to send emails from abap report to external users.
i am using the above function module and i tried all the examples discussed in forums.
but i am getting exception DOCUMENT_NOT_SENT = 2.
do i need to maintain anything in SCOT OR SU01 ....Transactions?
once again i tried all the examples in diff abap sites,but when the point reachecs to function
SO_NEW_DOCUMENT_ATT_SEND_API1 i am getting the above exception.
Does anyone got this kind of problem...?
Kindly advise.
Thanks,
Sara
Hi Experts,
we are using 4.6c version and i would like to send emails from abap report to external users.
i am using the above function module and i tried all the examples discussed in forums.
but i am getting exception DOCUMENT_NOT_SENT = 2.
do i need to maintain anything in SCOT OR SU01 ....Transactions?
once again i tried all the examples in diff abap sites,but when the point reachecs to function
SO_NEW_DOCUMENT_ATT_SEND_API1 i am getting the above exception.
Does anyone got this kind of problem...?
Kindly advise.
Thanks,
Sara
2008 Oct 15 2:47 AM
Hi,
You usually get this if you email id is not correct... Check the email ids and also check the receiver type... if you are sending through to a dist. lsit it should be of type 'C' .. Create the dist. list in SO23 and then pass 'X' to express mail option...
eg..
receiver-receiver = dist list.
receiver-express = 'X'. " Express mail
receiver-rec_type = 'C' for dist. lsit and 'U' for internet address..
regds,
Madan...
2008 Oct 15 3:55 PM
Hey ,
we are using sap 4.6c
just i want to send an attachements from abap using SO_NEW_DOCUMENT_ATT_SEND_API1 function.
here is the example program i am using
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default 'MY VALID EMAIL ID' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
&----
*& Form POPULATE_MESSAGE_TABLE
&----
Adds text to email text table
----
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
&----
*& Form SEND_EMAIL_MESSAGE
&----
Send email message
----
form send_email_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
receivers = it_receivers
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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
&----
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
&----
Instructs mail send program for SAPCONNECT to send email.
----
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM
do i need to check anything..? (in user settings or in SCOT)
2008 Oct 15 4:14 PM
Hi ,
try this also SO_OBJECT_SEND . just give a try.........points if answer is helpful
2008 Oct 15 4:26 PM
try debugging and looking at all the field you are passing...
DATA: docdata TYPE sodocchgi1,
objpack TYPE TABLE OF sopcklsti1,
objpack_line LIKE LINE OF objpack,
objhead TYPE TABLE OF solisti1,
objbin TYPE TABLE OF solisti1,
reclist TYPE TABLE OF somlreci1
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |