‎2007 Nov 16 3:04 PM
Hi guys
could any one provide me with the
sample code to send a mail from SAP with text as the main body of that mail via bcs classes
‎2007 Nov 16 3:05 PM
Search in the forum. There are a lot of threads on the same question
‎2007 Nov 16 3:05 PM
Search in the forum. There are a lot of threads on the same question
‎2007 Nov 16 3:08 PM
‎2007 Nov 16 3:10 PM
‎2007 Nov 16 3:11 PM
i wanted the text in main body of the email and not as attachments that too only when sending the mails thru Bcs classes
so please let me know if you find any discussion on this
‎2007 Nov 16 3:13 PM
Kittu,
This FM module does send text in the body but I am not sure whether it does so thru Bcs classes.
Regards
Aneesh.
‎2007 Nov 16 3:26 PM
hi aneesh thanks for the response iam already usin bcs classes to send out the mail but what ever i am trying to send for
cl_document_bcs=>create_document
is creating the mail in attachment where as i need the mail in the body of the mail
‎2007 Nov 16 3:31 PM
Kittu,
Send me your mail id, i will send you the code, to send data to mail body.
Regards,
Satish
‎2007 Nov 16 3:31 PM
Kittu,
Maybe this will be of help to you.
<a href="/people/thomas.jung3/blog/2005/01/05/develop-a-web-service-that-sends-an-email--in-abap Log</a>
Regards
Aneesh.
‎2007 Nov 16 3:31 PM
‎2007 Nov 16 5:24 PM
Hi satish
kittu_b4u2003@yahoo.co.in
is my ID ,please send the code
‎2007 Nov 16 5:33 PM
‎2007 Nov 16 5:38 PM
‎2007 Nov 16 3:44 PM
Hi,
Please go through this code: U can send mail;
Tables : zchp_cust-info.
DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: ENTRIES LIKE SY-TABIX.
DATA: NAME(15).
DATA: CON_NAME(20).
DATA: req_num like zchp_cust_info.
DATA: I_TAB_CHP LIKE ZCHP_CUST_INFO OCCURS 0 WITH HEADER LINE.
*data: reno like ZCHP_CUST_INFO-req_num value .
data input for the mail
select * from zchp_cust_info
appending table i_tab_chp where req_num = c_knumv.
LOOP AT I_TAB_CHP.
concatenate i_tab_chp-created_by i_tab_chp-req_num into CON_NAME.
*WRITE: / con_name.
ENDLOOP.
Fill the document
DOC_CHNG-OBJ_NAME = 'Refe'.
DOC_CHNG-OBJ_DESCR = 'TESCRA Ref Number !'.
DOC_CHNG-SENSITIVTY = 'P'.
*OBJCONT = 'Tescra'.
OBJCONT = CON_NAME.
APPEND OBJCONT.
OBJCONT = con_name.
APPEND OBJCONT.
DESCRIBE TABLE OBJCONT LINES ENTRIES.
READ TABLE OBJCONT INDEX ENTRIES.
DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).
Fill the receiver list
CLEAR RECLIST.
RECLIST-RECEIVER = SY-UNAME. " replace with <login name>
RECLIST-REC_TYPE = 'B'.
RECLIST-EXPRESS = 'X'.
APPEND RECLIST.
CLEAR RECLIST.
RECLIST-RECEIVER = 'sapuser'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
Send the document
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
LOOP AT RECLIST.
IF RECLIST-RECEIVER = SPACE.
NAME = RECLIST-REC_ID.
ELSE.
NAME = RECLIST-RECEIVER.
ENDIF.
IF RECLIST-RETRN_CODE = 0.
WRITE: / NAME, ': succesfully sent'.
ELSE.
WRITE: / NAME, ': error occured'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Too many receivers specified !'.
WHEN 2.
WRITE: / 'No receiver got the document !'.
WHEN 4.
WRITE: / 'Missing send authority !'.
WHEN OTHERS.
WRITE: / 'Unexpected error occurred !'.
ENDCASE.
<b>Please provide points if the issue is solved.</b>
Regards,
Sunil