‎2013 Jun 12 5:24 PM
Hello
I am new to HTML stuff, my requirement is to build the email body having a table in it, as shown in attachmnet / pic.
So, i tried with the below code, but not getting table as per my requirements, i coded like below
* Message Body in HMTL
***************** gs_objtxt-line = '<html> <body style="background-color:#FFE4C4;">'. "pale yellow; delete this line bcz i want white backgr.
gs_objtxt-line = '<html>'.
APPEND gs_objtxt TO gt_objtxt.
gs_objtxt-line = '<p> List of Employees </p>'.
APPEND gs_objtxt TO gt_objtxt.
* Table display
gs_objtxt-line = '<table style="MARGIN: 10px" bordercolor="#90EE90" '. "green
APPEND gs_objtxt TO gt_objtxt.
gs_objtxt-line = ' cellspacing="0" cellpadding="3" width="400"'.
APPEND gs_objtxt TO gt_objtxt.
gs_objtxt-line = ' border="1"><tbody><tr>'.
APPEND gs_objtxt TO gt_objtxt.
* Table header
************ gs_objtxt-line = '<th bgcolor="#90EE90">Project Name</th>'. ===> This gives green back ground, but i want grey color
gs_objtxt-line = '<tr style="background-color:#eeeeee;"><td>Emp Name</td>'.
APPEND gs_objtxt TO gt_objtxt.
gs_objtxt-line = '<th bgcolor="#90EE90">Number</th></tr>'.
APPEND gs_objtxt TO gt_objtxt.
gs_objtxt-line = '<th bgcolor="#90EE90">Department</th>'.
APPEND gs_objtxt TO gt_objtxt.
* Table Contents
DO 5 TIMES.
gs_objtxt-line = '<tr style="background-color:#eeeeee;"><td>TEST_EMP</td>'. "==> Its grey color as back ground, but i need white backgr.
APPEND gs_objtxt TO gt_objtxt.
CONCATENATE '<td>' 'Test_Number' '</td> </tr>' INTO gs_objtxt-line.
APPEND gs_objtxt TO gt_objtxt.
CONCATENATE '<td>' 'Test_Dept' '</td> </tr>' INTO gs_objtxt-line.
APPEND gs_objtxt TO gt_objtxt.
ENDDO.
So, pls. let me know what changes i hv to do to the above my code to get the table as shown in the pic. / attachment?
Thank you
‎2013 Jun 12 6:06 PM
I would like you to create a basic html page which shows desired table in web browser.
Once concept is clear, same code can be created using ABAP.
This W3Schools article would teach the basics of HTML Table.
To assist you, here is html code taken from your code, and indented (pretty printed) so you can locate errors.
<html>
<body style="background-color:#FFE4C4;">
<html>
<p> List of Employees </p>
<table style="MARGIN: 10px" bordercolor="#90EE90" cellspacing="0" cellpadding="3" width="400" border="1">
<tbody>
<tr>
<th bgcolor="#90EE90">Project Name
</th>
<tr style="background-color:#eeeeee;">
<td>Emp Name
</td>
<th bgcolor="#90EE90">Number
</th>
</tr>
<th bgcolor="#90EE90">Department
</th>
<tr style="background-color:#eeeeee;">
<td>TEST_EMP
</td>
<td>Test_Number
</td>
</tr>
<td>Test_Dept</td>
</tr>
Here are some of the errors.
‎2013 Jun 12 5:36 PM
Hi MSR,
I see that you have not nested the HTML tags properly. For Example, you have two <HTML> tags in the beginning.
Use the below wiki and code accordingly.
http://wiki.sdn.sap.com/wiki/display/Snippets/Formatted+HTML+Email+Attachments+using+ABAP
Regards,
Karthik
‎2013 Jun 12 6:06 PM
I would like you to create a basic html page which shows desired table in web browser.
Once concept is clear, same code can be created using ABAP.
This W3Schools article would teach the basics of HTML Table.
To assist you, here is html code taken from your code, and indented (pretty printed) so you can locate errors.
<html>
<body style="background-color:#FFE4C4;">
<html>
<p> List of Employees </p>
<table style="MARGIN: 10px" bordercolor="#90EE90" cellspacing="0" cellpadding="3" width="400" border="1">
<tbody>
<tr>
<th bgcolor="#90EE90">Project Name
</th>
<tr style="background-color:#eeeeee;">
<td>Emp Name
</td>
<th bgcolor="#90EE90">Number
</th>
</tr>
<th bgcolor="#90EE90">Department
</th>
<tr style="background-color:#eeeeee;">
<td>TEST_EMP
</td>
<td>Test_Number
</td>
</tr>
<td>Test_Dept</td>
</tr>
Here are some of the errors.
‎2013 Jun 12 6:11 PM