Sie sind auf Seite 1von 5

*&---------------------------------------------------------------------*

*& Report ZEMAIL_HTML


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZEMAIL_HTML.
DATA : BEGIN OF l_table,
table1(20) TYPE c,
tr1(20) TYPE c,
td1(10) TYPE c,
desc1(20) TYPE c,
td11(10) TYPE c,
td2(10) TYPE c,
desc2(20) TYPE c,
td22(10) TYPE c,
td3(10) TYPE c,
desc3(20) TYPE c,
td33(10) TYPE c,
tr11(10) TYPE c,
table11(20) TYPE c,
END OF l_table.
DATA : t_email Type standard table of soli,
w_email type soli.
DATA: wa_mailsubject

TYPE sodocchgi1.

DATA: t_mailrecipients TYPE STANDARD TABLE OF somlrec90,


wa_mailrecipient

TYPE somlrec90.

Recipients
wa_mailrecipient-rec_type = 'U'.
wa_mailrecipient-receiver = '502119612@mail.ad.ge.com'.

APPEND wa_mailrecipient TO t_mailrecipients.


CLEAR: wa_mailrecipient.

Subject.
wa_mailsubject-obj_name = 'test mail'.
wa_mailsubject-obj_langu = sy-langu.
wa_mailsubject-obj_descr = 'Subject of the mail'.

* Mail content
w_email-line =
'Please click the button above to review Purchase Requisition 3000000' &
'027/Item 00010 and Release or Reject it. Requisition details as foll' &
'ows:'
.
append w_email
w_email-line =
append w_email
w_email-line =
append w_email

to t_email.
'<p> </p>'.
to t_email.
'<h4><font color="blue">PO Details:</font></h4>'.
to t_email.

w_email-line = '<p><pre>Item number


:00010</pre></p>'.
append w_email to t_email.
w_email-line = '<p><pre>Requisition Date
:02.10.2012</pre></p>'.
append w_email to t_email.
w_email-line = '<p><pre>PR Creator
:501968267</pre></p>'.
append w_email to t_email.
w_email-line = '<p><pre>Header Note
:Testing html</pre></p>'
.
append w_email to t_email.
**********************************************************************
*URL for Approve and reject
w_email-line = '<a href="http://sap3edev1.psamer.ps.ge.com:8003/sap/' &
'bc/bsp/sap/swn_wiexecute/main.do?sap-client=095&sap-language=' &
'E&action=DECISION&decision_alt=0001&wi_id=000000005134&tok=' &
'C2311E92660DE47B456E721B0DABC9F857AB4">APPROVE</a>'.
append w_email to t_email.
**********************************************************************
w_email-line ='<h4><font color="blue">Line Item Details:</font></h4>'.
append w_email
w_email-line =
append w_email
w_email-line =
append w_email
w_email-line =
append w_email
w_email-line =
append w_email

to t_email.
'<p><pre>Plant
to t_email.
'<p><pre>Material
to t_email.
'<p><pre>Description
to t_email.
'<p><pre>Quantity
to t_email.

:00010</pre></p>'.
:00010</pre></p>'.
:00010</pre></p>'.
:00010</pre></p>'.

w_email-line = '<p><pre>Unit of Measure


:00010</pre></p>'.
append w_email to t_email.
w_email-line = '<p><pre>Delivery Date
:00010</pre></p>'.
append w_email to t_email.
w_email-line = '<p><pre>Vendor
:00010</pre></p>'.
append w_email to t_email.
w_email-line = '<p><pre>Valuation Price
:00010</pre></p>'.
append w_email to t_email.
w_email-line = '<p><pre>Price Unit
:00010</pre></p>'.
append w_email to t_email.
w_email-line =
'<p>In order to view requisition details, please click on the object '
'on the right-hand side, once logged on</p>'
.
append w_email to t_email.
w_email-line = '<p>Regards,<br> Workflow System.</p>'.
append w_email to t_email.
w_email-line =
'<pre>---------------------------------------------------------------'
'--------------------------------------------------------------------'
'-------------------------------------------------</pre>'
.
append w_email to t_email.
w_email-line =
'<p>This is an automated e-mail. Please do not hit reply.</p>'.
append w_email to t_email.
w_email-line =
'<p>If you have any problems logging on, contact your system administ'
'rator.</p>'
.
append w_email to t_email.
w_email-line =
'<pre>---------------------------------------------------------------'
'--------------------------------------------------------------------'
'-------------------------------------------------</pre>'.
.
w_email-line = '<h4><font color="blue">Line Item Details:</font>' &
'</h4> <table border="1" align="left">'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Plant
:</th><td>Shanghai'&
'</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Material' &
':</th><td>Air Motor</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Description
:</th><td>' &
'Motor used in Planes</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Quantity
:</th><td>' &
'1500</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Unit of Measure :</th><td>' &
'EA</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Delivery Date :</th><td>' &
'08.10.2012</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Vendor
:</th><td>' &

&

&
&

&

&
&

'Rolls Royce</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Valuation Price :</th><td>' &
'250000.00</td></tr>'.
append w_email to t_email.
w_email-line = '<tr><th align="left">Price Unit
:</th><td>' &
'CNY</td></tr>'.
append w_email to t_email.
w_email-line = '</table>'.
append w_email to t_email.
*w_email-line = '<h4>PO Details:</h4> <table border="0"> <tr><th>Item
*Number
:</th>'.
*append w_email to t_email.
*w_email-line = '<td>00010</td> </tr> <tr><th>Requisition Date
:
*</th> <td>02.10.2012</td></tr>'.
*append w_email to t_email.
*w_email-line = '<tr><th>PR Creator
:</th>
*<td>501968267</td></tr> <tr><th>Header Note
:</th> <td>For
*Testing</td></tr></table>'.
*append w_email to t_email.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'


EXPORTING
document_data

= wa_mailsubject

DOCUMENT_TYPE

= 'HTM'

TABLES
object_content

= t_email

receivers

= t_mailrecipients

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

IF sy-subrc EQ 0.
commit work.

= 8.

ENDIF.