‎2009 Sep 23 4:34 PM
hi Gurus,
Please kindly help out on the following:
i try to send email using
Send Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = EV_DOCUMENT_DATA
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = ' '
IMPORTING
SENT_TO_ALL = IV_SENT_TO_ALL
NEW_OBJECT_ID = IV_NEW_OBJECT_ID
TABLES
OBJECT_HEADER = CT_OBJECT_HEADER
OBJECT_CONTENT = CT_OBJECT_CONTENT
CONTENTS_HEX = CT_CONTENTS_HEX
OBJECT_PARA = CT_OBJECT_PARA
OBJECT_PARB = CT_OBJECT_PARB
RECEIVERS = CT_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.
The email was found in SBWP but not in SCOT.
The email was not automatically send out. I need to go into SBWP to click SEND and then it will go into SCOT.
Please kindly advise me how to make it automatically send out.
Thanks very very very much.
‎2009 Sep 23 4:42 PM
You have to pass commit_work = 'X' and then have to
Submit RSCONN01 program to send it immediately to SCOT.
‎2009 Sep 24 5:17 AM
Hi,
Please use the following. Its working for me.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = lv_document_data
put_in_outbox = space
commit_work = 'X'
tables
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_audit_output
contents_txt = i_objtxt
receivers = i_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.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* Display message saying email was sent successfully.
else.
write: /1 text-t23.
endif.Thanks,
Aravind
‎2009 Sep 24 5:26 AM
Hi
Check with the following code:
DATA: objpack TYPE TABLE OF sopcklsti1 INITIAL SIZE 2,
objhead TYPE TABLE OF solisti1 INITIAL SIZE 1,
objbin TYPE TABLE OF solisti1 INITIAL SIZE 10,
objtxt TYPE TABLE OF solisti1 INITIAL SIZE 10,
reclist TYPE TABLE OF somlreci1 INITIAL SIZE 5.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIFHope this helps you.
Regards,
Rajani
‎2009 Sep 24 8:11 AM
Hi,
Please add
commit_work = 'X'
to krupa jani's reply.
Thanks and Best Regards,
Suresh
‎2009 Sep 24 8:05 AM
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
‎2009 Sep 24 8:15 AM
Hi,
Check the below link. it will help you to solve the problem.
https://wiki.sdn.sap.com/wiki/display/Snippets/Email%2bfrom%2bSAP
Regards
Sunil