‎2006 Sep 15 11:55 AM
hi,
REPORT ysan_test_1 NO STANDARD PAGE HEADING.
DATA: object_header TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0,
contents_txt TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0,
receivers TYPE STANDARD TABLE OF somlreci1 INITIAL SIZE 0.
DATA: w_object_header TYPE solisti1,
w_contents_txt TYPE solisti1,
w_receivers TYPE somlreci1.
START-OF-SELECTION.
w_object_header-line = 'Test mail for users.........'.
APPEND w_object_header TO object_header.
CLEAR w_object_header.
w_contents_txt-line = 'Test mail for users.........'.
APPEND w_contents_txt TO contents_txt.
CLEAR w_contents_txt.
w_receivers-RECEIVER = 'ISANJUKTA@YAHOO.CO.IN'.
w_receivers-REC_TYPE = 'U'.
APPEND w_receivers TO receivers.
CLEAR w_receivers.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = 'TEST'
document_type = 'RAW'
put_in_outbox = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
object_header = object_header
contents_txt = contents_txt
receivers = 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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
enfif.
giving the error like this
Exception DOCUMENT_NOT_SENT
Message ID: SO Message number: 013
Message :
Database error for <ADDR_PERS_COMP_COMM_GET> <0>
‎2006 Sep 15 11:57 AM
u cannt send directly to servers like YAHOO or HOTMAIl , better to ask ur basis person , So he can explain much more better what is the Problem.
u have to do lot of setting @ db Level to send mails to Xternal Servers.Regards
Prabhu
‎2006 Sep 15 11:57 AM
u cannt send directly to servers like YAHOO or HOTMAIl , better to ask ur basis person , So he can explain much more better what is the Problem.
u have to do lot of setting @ db Level to send mails to Xternal Servers.Regards
Prabhu
‎2006 Sep 15 11:57 AM
‎2006 Sep 15 11:59 AM
‎2006 Sep 15 12:00 PM
first check with your BASIS people,whether your SAP is configured in SCOT(transaction code) with SMTP services or not.
if that is done then only you can send mails to the external ids.
also compare your program with the code available in this link,to findout what wrong with your code.
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
Regards
Srikanth
‎2006 Sep 15 12:17 PM
Hi,
lot of configuration is invloved in sending
mail to external email id. check BASIS to
configure for external mails ans also check
debug FM and see which conditions exceptions
(Document not sendis raised)
also check below code
CLEAR: DOC_CHNG, OBJTXT, OBJBIN, OBJPACK, OBJHEAD, RECLIST,
RECIPIENT_INT, DOC_SIZE,TAB_LINES.
REFRESH: OBJTXT, OBJBIN, OBJPACK, OBJHEAD, RECLIST.
OBJBIN[] = CONTENT_OUT[].
Populate e-mail title
DOC_CHNG-OBJ_NAME = 'MAIL'.
CONCATENATE 'EETS for Contract #'(245)
OIA01_TAB-EXGNUM
INTO DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
It is a text document
CLEAR OBJPACK-TRANSF_BIN.
The document needs no header (head_num = 0)
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
but it has a body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
of type RAW
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Create the attachment (the list itself)
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
It is binary document
OBJPACK-TRANSF_BIN = 'X'.
we need no header
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
but a body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
of type PDF
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'Attachment'(239).
CONCATENATE 'EETS_' OIA01_TAB-EXGNUM '_'
IT_ZMMTACCUID-ACCTUSRID
'_' SY-DATUM '_' SY-UZEIT '.PDF'
INTO OBJPACK-OBJ_DESCR.
READ TABLE OBJBIN INDEX TAB_LINES.
DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJBIN ).
OBJPACK-DOC_SIZE = DOC_SIZE.
APPEND OBJPACK.
Get e-mail address
CLEAR IT_ADDRESS.
READ TABLE IT_ADDRESS WITH KEY ACCTID = IT_ZMMTACCUID-ACCTUSRID
BINARY SEARCH.
IF SY-SUBRC = 0.
RECIPIENT_INT-ADDRESS = IT_ADDRESS-SMTP_ADR.
ENDIF.
*Send email to external mail address
RECLIST-RECEIVER = RECIPIENT_INT.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
CLEAR RECLIST.
*Send email to SAP Office mail address
RECLIST-RECEIVER = IT_ZMMTACCUID-ACCTUSRID.
RECLIST-REC_TYPE = 'B'.
APPEND RECLIST.
CLEAR RECLIST.
******************************************************************
SEND THE DOCUMENT BY CALLING THE SAPOFFICE API1 MODULE
FOR SENDING DOCUMENTS WITH ATTACHMENTS
******************************************************************
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = doc_chng
put_in_outbox = 'X'
importing
sent_to_all = sent_to_all
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.
Regards
Amole
‎2006 Sep 15 12:33 PM
Hi Sanjukta,
you have not specified the exporting parameters 'document_data' properly.
you spedified that as 'test' that shuld not.
look at the doucmentation for that function module.
and attach the follwing code to your program
DATA: WA_DOC_DATA TYPE SODOCCHGI1.
DATA: WA_LINES TYPE SY-TABIX VALUE '0'.
* Fill the document data
WA_DOC_DATA-OBJ_LANGU = SY-LANGU.
WA_DOC_DATA-OBJ_NAME = 'Materials'.
WA_DOC_DATA-OBJ_DESCR = 'Material descriptions'.
WA_DOC_DATA-SENSITIVTY = 'F'.
DESCRIBE TABLE contents_txt LINES WA_LINES.
READ TABLE contents_txt INTO w_contents_txt INDEX WA_LINES.
WA_DOC_DATA-DOC_SIZE = ( WA_LINES - 1 ) * 255 + STRLEN( w_contents_txt ).
now you pass as
exporting
Document_data = wa_doc_data