2006 Nov 29 11:35 AM
Hi,
I am trying to send a mail to external id . For this I have used the FM 'SO_NEW_DOCUMENT_SEND_API1'. Using this FM, I m sending mail to my SAP id as well as my gmail id(say,mail2neha@gmail.com). i have got the SAP mail but i m not getting the mail on my gmail id. When i tried to debug this FM, i got to know that the rec_tab which is used as the internal table to hold the receivers address does not contain my gmail id as the length of external id is more than 12 characters, which is not permissible. So can anyone sugeest me, what is the solution for that?
Below is given code that i have used:
REPORT ZNG_TEST .
data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.
data: mailrec type table of somlrec90 with header line.
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test'.
maildata-obj_langu = sy-langu.
mailtxt-line = 'This is a test'.
append mailtxt.
mailrec-receiver = 'mail2neha@gmail.com'.
mailrec-rec_type = 'U'.
append mailrec.
mailrec-receiver = sy-uname.
mailrec-rec_type = 'B'.
append 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.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
I got the similar question posted in SDN and it has given some solution related to Tranasction SCOT. but i have no idea how to work with it.
Please tell me what is the possible solution to send mail to my external id?
2006 Nov 29 11:41 AM
2006 Nov 29 11:48 AM
check below code and try to modify ur code...
Sending External email through SAP
What is the FM for sending the external email through SAP by attaching layout set to it?
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
-
How to send a report to an external mail-id?
Try this sample code :-
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = 'EXTERNAL-MAIL-ID@YAHOO.COM'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
2006 Nov 29 11:55 AM
for this u have to do setting in Xchange server side?
process like this :
SAP will send Request to Xchange Server , so from Xchange server Mail will go .
2006 Nov 29 12:00 PM
Hi,
See the modifications to your Program,
REPORT ZNG_TEST .
data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.
<b>data: mailrec LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE</b>
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test'.
maildata-obj_langu = sy-langu.
mailtxt-line = 'This is a test'.
append mailtxt.
mailrec-receiver = 'mail2neha@gmail.com'.
mailrec-rec_type = 'U'.
append mailrec.
<b>clear mailrec.</b>
mailrec-receiver = sy-uname.
mailrec-rec_type = 'B'.
append mailrec.
<b>clear mailrec.</b>
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.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
Execute now, the lenght is not limit to 12.
Regards
Sudheer
2006 Nov 29 2:26 PM
Sudhir,
I tried doing the same thing.. but still i m not getting the mail triggered to my external mail id.
thanks,
Neha
2006 Nov 29 2:38 PM
Hi,
It worked for me . I created the recevier list something like this
Create Receivers List
Reclist-receiver = 'yamini@rediffmail.com'. Change Address
Reclist-rec_type = 'U'.
Reclist-express = 'X'.
APPEND reclist.
Reclist-receiver = 'NEX2OYQ'. Change Internal Users
Reclist-rec_type = 'B'.
Reclist-express = 'X'.
APPEND reclist.
and passed the value to the FM SO_NEW_DOCUMENT_SEND_API1
SO_NEW_DOCUMENT_SEND_API1
EXPORTING
DOCUMENT_DATA = DOC_CHNG
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_CONTENT = OBJBIN
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 8
Kindly also check the transaction code SCOT , where it should be configured to send mail to external system.
Regards
Yamini