Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sending mail to outlook using ABAP objects

0 Likes
680

Hi,

I have used ABAP objects to send a mail to outlook.

I am getting the mail properly except body part.

Here I am appending 3 items to body.But in the mail i am getting only the last appended line item.

Please suggest the solution.I am hereby providing the code.

LR_MAIL_DATA->SUBJECT = 'Hi'.

**- To recipient (may be more)

LV_TO-ADDRESS = WA_REGUH-SMTP_ADDR.

LV_TO-NAME = WA_REGUH-ZNME1.

APPEND LV_TO TO LR_MAIL_DATA->TO.

*

**- Email Body (HTML)

MOVE 'text/html' TO LS_STRUC_MAIL-MIME_TYPE.

CONCATENATE '<br>The Following Payment <br>' INTO TEMP_BODY.

MOVE TEMP_BODY TO LS_STRUC_MAIL-CONTENT_ASCII.

APPEND LS_STRUC_MAIL TO LR_MAIL_DATA->BODY.

CLEAR TEMP_BODY.

MOVE '<br>The Details of the payment are as follows<br>' TO TEMP_BODY.

MOVE TEMP_BODY TO LS_STRUC_MAIL-CONTENT_ASCII.

APPEND LS_STRUC_MAIL TO LR_MAIL_DATA->BODY.

CLEAR TEMP_BODY.

**- Send Email

LV_SEND_REQUEST = CL_CRM_EMAIL_UTILITY_BASE=>SEND_EMAIL( IV_MAIL_DATA = LR_MAIL_DATA ).

Edited by: rama krishna vishnubhatla on Mar 30, 2009 2:47 PM

Edited by: rama krishna vishnubhatla on Mar 30, 2009 2:50 PM

Hi,

I have used ABAP objects to send a mail to outlook.

I am getting the mail properly except body part.

Here I am appending 3 items to body.But in the mail i am getting only the last appended line item.

Please suggest the solution.I am hereby providing the code.

LR_MAIL_DATA->SUBJECT = 'Hi'.

**- To recipient (may be more)

LV_TO-ADDRESS = WA_REGUH-SMTP_ADDR.

LV_TO-NAME = WA_REGUH-ZNME1.

APPEND LV_TO TO LR_MAIL_DATA->TO.

*

**- Email Body (HTML)

MOVE 'text/html' TO LS_STRUC_MAIL-MIME_TYPE.

CONCATENATE '<br>The Following Payment <br>' INTO TEMP_BODY.

MOVE TEMP_BODY TO LS_STRUC_MAIL-CONTENT_ASCII.

APPEND LS_STRUC_MAIL TO LR_MAIL_DATA->BODY.

CLEAR TEMP_BODY.

MOVE '<br>The Details of the payment are as follows<br>' TO TEMP_BODY.

MOVE TEMP_BODY TO LS_STRUC_MAIL-CONTENT_ASCII.

APPEND LS_STRUC_MAIL TO LR_MAIL_DATA->BODY.

CLEAR TEMP_BODY.

**- Send Email

LV_SEND_REQUEST = CL_CRM_EMAIL_UTILITY_BASE=>SEND_EMAIL( IV_MAIL_DATA = LR_MAIL_DATA ).

Edited by: rama krishna vishnubhatla on Mar 30, 2009 2:47 PM

Edited by: rama krishna vishnubhatla on Mar 30, 2009 2:50 PM

2 REPLIES 2
Read only

Former Member
0 Likes
502

Hi,

I suggest you can have a look in the example program BCS_EXAMPLE_1 for sending mail using the class CL_DOCUMENT_BCS.

Try for other example program also by searching with BCS_* in se38.

Regards,

Ankur

Read only

Former Member
0 Likes
502

Better use the CL_BCS to send mails. Easy example: https://wiki.sdn.sap.com/wiki/display/Snippets/SimplebutPowerfulCodeforSendingMailfromSAP