‎2009 Oct 21 10:26 AM
Hi friends,
I am using FM SO_DOCUMENT_SEND_API1and trying to send mail to external mail id (internet) i am unable to send but I am getting sy-subrc = 0 & when i check in debugging i am getting
SY-MSGID -AM
SY-MSGTY-E
SY-MSGNO-012
SY-MSGV1-97394.
i am able to send email to sap inbox(internal).
I used SO_NEW_DOCUMENT_SEND_API1 too geting same problem.
Please find the code below.
*Variable declaration for email functionality
DATA : w_doc_data TYPE sodocchgi1, "Subject/Attributess s
it_mail TYPE STANDARD TABLE OF solisti1, "Body of an email.
w_mail LIKE LINE OF it_mail,
it_email TYPE STANDARD TABLE OF somlreci1, "receiver
w_email LIKE LINE OF it_email,
it_packing_list TYPE STANDARD TABLE OF sopcklsti1,
w_packing_list LIKE LINE OF it_packing_list,
lv_lines TYPE i.
DESCRIBE TABLE it_mail LINES lv_lines.
READ TABLE it_mail INDEX lv_lines.
IF sy-subrc = 0.
w_doc_data-doc_size = ( lv_lines - 1 ) * 255 + STRLEN( it_mail ).
ENDIF.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = w_subject.
w_doc_data-obj_descr = w_subject.
CLEAR it_packing_list.
REFRESH it_packing_list.
w_packing_list-transf_bin = space.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-doc_type = 'RAW'.
w_packing_list-body_num = lv_lines.
w_packing_list-doc_size = w_doc_data-doc_size.
APPEND w_packing_list TO it_packing_list.
CLEAR w_packing_list.
sender_address = sy-uname.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
sender_address = sender_address
sender_address_type = 'INT'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_txt = it_mail
receivers = it_email
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.
pls assist me ...what'ss wronk with the code....
thanks & regards
Narendra
‎2009 Oct 21 10:31 AM
1. use proper code posting using the <' > button..
2. please search.
‎2009 Oct 21 10:35 AM
convert the data into pdf using FM CALL FUNCTION 'CONVERT_OTF'
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = v_inbox
sender_address = v_email1
sender_address_type = space
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
NEW_OBJECT_ID =
SENDER_ID =
TABLES
packing_list = t_packing_list
OBJECT_HEADER =
contents_bin = t_attachment
contents_txt = it_message
receivers = t_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
‎2009 Oct 21 12:14 PM
use standard table for pac_list and Doc_rec to send through mail
use this code
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_data
PUT_IN_OUTBOX = ' '
commit_work = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = pac_list
OBJECT_HEADER =
CONTENTS_BIN =
contents_txt = cont_txt
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = doc_rec
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.
‎2009 Oct 21 12:23 PM
‎2009 Oct 21 12:24 PM