<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Send email via html template solution in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947316#M1488131</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Guru ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing an abap program that can send the 'HTML' email to external user ( such as : GMAIL , YAHOO ) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Up to now , everything is fine .... But i am looking for a solution that is it possibile to use a HTML template for that ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example :&lt;/P&gt;&lt;P&gt;I have one HTML file , like that :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;body&amp;gt;
  &amp;lt;table&amp;gt;
     &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;name&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
     &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;address&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;/table&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in my abap program i will fill my username （ sy-uname ) and address ( zaddress ) to this HTML file and then send to the external user ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any good idea for that ? My idea is very stupid that put this file to internal table and then check it line by line ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Jun 2010 10:22:48 GMT</pubDate>
    <dc:creator>carlos_zhang3</dc:creator>
    <dc:date>2010-06-14T10:22:48Z</dc:date>
    <item>
      <title>Send email via html template solution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947316#M1488131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Guru ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing an abap program that can send the 'HTML' email to external user ( such as : GMAIL , YAHOO ) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Up to now , everything is fine .... But i am looking for a solution that is it possibile to use a HTML template for that ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example :&lt;/P&gt;&lt;P&gt;I have one HTML file , like that :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;body&amp;gt;
  &amp;lt;table&amp;gt;
     &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;name&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
     &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;address&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
  &amp;lt;/table&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in my abap program i will fill my username （ sy-uname ) and address ( zaddress ) to this HTML file and then send to the external user ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any good idea for that ? My idea is very stupid that put this file to internal table and then check it line by line ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jun 2010 10:22:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947316#M1488131</guid>
      <dc:creator>carlos_zhang3</dc:creator>
      <dc:date>2010-06-14T10:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Send email via html template solution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947317#M1488132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use html tag like this ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :  wa_objtxt TYPE solisti1,&lt;/P&gt;&lt;P&gt;           it_objtxt TYPE TABLE OF solisti1,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_objtxt = '&amp;lt;body&amp;gt;'.&lt;/P&gt;&lt;P&gt;APPEND wa_objtxt TO it_objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_objtxt = '&amp;lt;table id="Table_01" align="center" width="700" border="0" cellpadding="0" cellspacing="0"&amp;gt;'.&lt;/P&gt;&lt;P&gt;APPEND wa_objtxt TO it_objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_objtxt = '&amp;lt;tr&amp;gt;'.&lt;/P&gt;&lt;P&gt;APPEND wa_objtxt TO it_objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_objtxt = '&amp;lt;td&amp;gt;'.&lt;/P&gt;&lt;P&gt;APPEND wa_objtxt TO it_objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_objtxt = '&amp;lt;img src= &amp;gt;'.&lt;/P&gt;&lt;P&gt;APPEND wa_objtxt TO it_objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_objtxt = '&amp;lt;/td&amp;gt;'.&lt;/P&gt;&lt;P&gt;APPEND wa_objtxt TO it_objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_objtxt = '&amp;lt;/tr&amp;gt;'.&lt;/P&gt;&lt;P&gt;APPEND wa_objtxt TO it_objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SO_DOCUMENT_SEND_API1'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;document_data = wa_docdata&lt;/P&gt;&lt;P&gt;PUT_IN_OUTBOX = ' '&lt;/P&gt;&lt;P&gt;sender_address = '...'&lt;/P&gt;&lt;P&gt;sender_address_type = 'INT'&lt;/P&gt;&lt;P&gt;commit_work = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;packing_list = it_objpack&lt;/P&gt;&lt;P&gt;contents_txt = it_objtxt&lt;/P&gt;&lt;P&gt;receivers = it_reclist&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jun 2010 10:53:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947317#M1488132</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-14T10:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Send email via html template solution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947318#M1488133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear cagatay ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the way we are using now . but it seems very diffcult to handle the complex html template ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Imagine we have 100 html template files need to be sent and we will spend a lot of time on this hardcoding ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2010 01:24:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947318#M1488133</guid>
      <dc:creator>carlos_zhang3</dc:creator>
      <dc:date>2010-06-15T01:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Send email via html template solution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947319#M1488134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here i share my abap code if someone internet for this topic :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION Z_BCAPPLYTEMPLATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(FILE) TYPE  CHAR255
*"  TABLES
*"      PARAMETERS STRUCTURE  ZTMPLSTRU
*"      CONTEXT STRUCTURE  ZTMPLSTRU
*"----------------------------------------------------------------------
* This function can read a template file that storage in the application server
* And then replace the "^" charater to some parameters .
* Sometimes use for the HTML format email sending
*"----------------------------------------------------------------------
* By Carlos

* Defined vars
  DATA : BEGIN OF IT_READ OCCURS 0.
         INCLUDE STRUCTURE ZTMPLSTRU .
  DATA : END OF IT_READ .

  DATA : V_LENLEFT LIKE SY-FDPOS .
  DATA : V_PARAMETER TYPE CHAR200 .
  DATA : V_IDX TYPE I .

  V_IDX = 1 .
  SY-SUBRC = 0 .
  OPEN DATASET : FILE FOR INPUT IN TEXT MODE ENCODING UTF-8.

  CLEAR : IT_READ[] .

* Read file
  DO.
      IF sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      ENDIF.
      READ DATASET FILE INTO IT_READ.

      IF sy-subrc = 0.
        append IT_READ .
      ENDIF.
  ENDDO.


  CLOSE DATASET FILE .

* Start apply parameters

  LOOP AT IT_READ .

      CLEAR : V_LENLEFT .

      CONTEXT = IT_READ .

      WHILE sy-subrc = 0 .

            CLEAR :  V_LENLEFT .
            SEARCH CONTEXT-LINE for '^' .

            IF SY-SUBRC = 0 .
            " READ PARAMETERS
                READ TABLE PARAMETERS INDEX V_IDX  .
                  IF SY-SUBRC = 0 .
                      V_PARAMETER = PARAMETERS-LINE .
                      V_IDX = V_IDX + 1 .
                  ENDIF .

                V_LENLEFT = SY-FDPOS + STRLEN( V_PARAMETER ) - 1 .

                concatenate CONTEXT-LINE(sy-fdpos) V_PARAMETER CONTEXT-LINE+v_lenleft into CONTEXT-LINE .
            else.
                append CONTEXT.
            endif .
      ENDWHILE .

      CLEAR sy-subrc .

  ENDLOOP .

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2010 09:11:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947319#M1488134</guid>
      <dc:creator>carlos_zhang3</dc:creator>
      <dc:date>2010-06-15T09:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Send email via html template solution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947320#M1488135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Done by myself !@&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2010 09:12:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947320#M1488135</guid>
      <dc:creator>carlos_zhang3</dc:creator>
      <dc:date>2010-06-15T09:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Send email via html template solution</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947321#M1488136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good Work,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is possible , Can you send me full code ? I want to try in my system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is the content of ZTMPLSTRU ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cagatayersoylu@gmail&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jun 2010 08:44:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-via-html-template-solution/m-p/6947321#M1488136</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-16T08:44:49Z</dc:date>
    </item>
  </channel>
</rss>

