*&---------------------------------------------------------------------*
*& Report ZTEST_SEND_MAIL_HTML
*&---------------------------------------------------------------------*
*& This report will show how to send the Formatted Emails using
*& SAPConnect
*&---------------------------------------------------------------------*
REPORT ztest_np_send_mail.
DATA:
t_objbin TYPE STANDARD TABLE OF solisti1, " Attachment data
t_objtxt TYPE STANDARD TABLE OF solisti1, " Message body
t_objpack TYPE STANDARD TABLE OF sopcklsti1, " Packing list
t_reclist TYPE STANDARD TABLE OF somlreci1, " Receipient list
t_objhead TYPE STANDARD TABLE OF solisti1. " Header
DATA: wa_docdata TYPE sodocchgi1, " Document data
wa_objtxt TYPE solisti1, " Message body
wa_objbin TYPE solisti1, " Attachment data
wa_objpack TYPE sopcklsti1, " Packing list
wa_reclist TYPE somlreci1. " Receipient list
*&---------------------------------------------------------------------*
*& Form create_message
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM create_message .
**1 Title, Description & Body
PERFORM create_title_desc_body.
**2 Receivers
PERFORM fill_receivers.
ENDFORM. " create_message
*&---------------------------------------------------------------------*
*& Form CREATE_TITLE_DESC_BODY
*&---------------------------------------------------------------------*
* Title, Description and body
*----------------------------------------------------------------------*
FORM create_title_desc_body.
* table header
wa_objtxt-line = '<th bgcolor="#90EE90">Material</th>'.
APPEND wa_objtxt TO t_objtxt.
wa_objtxt-line = '<th bgcolor="#90EE90">Description</th></tr>'.
APPEND wa_objtxt TO t_objtxt.
* table Contents
DO 5 TIMES.
wa_objtxt-line = '<tr style="background-color:#eeeeee;"><td>TEST</td>'.
APPEND wa_objtxt TO t_objtxt.
CONCATENATE '<td>' sy-abcde '</td> </tr>' INTO wa_objtxt-line.
APPEND wa_objtxt TO t_objtxt.
ENDDO.
* table close
wa_objtxt-line = '</tbody> </table>'.
APPEND wa_objtxt TO t_objtxt.
* Hyperlink
wa_objtxt-line = '<br> <br>'.
APPEND wa_objtxt TO t_objtxt.
wa_objtxt-line = '<p><a href="http://help-abap.blogspot.com">'.
APPEND wa_objtxt TO t_objtxt.
wa_objtxt-line = 'Click here to check the latest post</a></p>'.
APPEND wa_objtxt TO t_objtxt.
* Signature with background color
wa_objtxt-line = '<br><br>'.
APPEND wa_objtxt TO t_objtxt.
wa_objtxt-line = '<p> Regards,</p>'.
APPEND wa_objtxt TO t_objtxt.
wa_objtxt-line = '<p style="background-color:#1E90FF;"><b>Naimesh Patel</b></p>'.
APPEND wa_objtxt TO t_objtxt.
* HTML close
wa_objtxt-line = '</body> </html> '.
APPEND wa_objtxt TO t_objtxt.
* Document data
DESCRIBE TABLE t_objtxt LINES w_tab_lines.
READ TABLE t_objtxt INTO wa_objtxt INDEX w_tab_lines.
wa_docdata-doc_size =
( w_tab_lines - 1 ) * 255 + STRLEN( wa_objtxt ).
* Packing data
CLEAR wa_objpack-transf_bin.
wa_objpack-head_start = 1.
wa_objpack-head_num = 0.
wa_objpack-body_start = 1.
wa_objpack-body_num = w_tab_lines.
* we will pass the HTML, since we have created the message
* body in the HTML
wa_objpack-doc_type = 'HTML'.
APPEND wa_objpack TO t_objpack.
ENDFORM. " CREATE_TITLE_DESC_BODY
*&---------------------------------------------------------------------*
*& Form fill_receivers
*&---------------------------------------------------------------------*
* Filling up the Receivers
*----------------------------------------------------------------------*
FORM fill_receivers .
ENDFORM. " fill_receivers
*&---------------------------------------------------------------------*
*& Form send_message
*&---------------------------------------------------------------------*
* Sending Mail
*----------------------------------------------------------------------*
FORM send_message .
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.