<?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 Re: Send Email With HTML Layout in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-with-html-layout/m-p/12195564#M1981230</link>
    <description>&lt;P&gt;You dont specify how you "move the contents", but I assume, that you simply insert the lines from READ_TEXT, which are "SAP-Script Text Rows" with Format and Content of TDSTXLLINE having CHAR 132, into the "SAP-Office Rows" with only Content SO_TEXT255 having CHAR 255.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But instead, you could/should transform the SAP-Script into SAP-Office format correctly. I do this by moving SAP-Script into string first, and then from string into SAP-Office.&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;" 1) READ TEXT in SAP-Script Format
DATA lt_lines TYPE TABLE OF tline. " table of struc TLINE with TDFORMAT and TDLINE having CHAR 132
CALL FUNCTION 'READ_TEXT'
  EXPORTING
    id       = your_id              " e.g. 'ST'        
    language = your_language        " e.g. 'E'
    name     = your_text_name
    object   = your_object          " e.g. 'TEXT'
  TABLES
    lines    = lt_lines.            " output in SAP-Script


* 2) Convert SAP-Script to String
DATA lo_text_assist TYPE REF TO /plmu/cl_ltx_assist.
DATA lv_string TYPE string.
CREATE OBJECT lo_text_assist.
CALL METHOD lo_text_assist-&amp;gt;convert_itf_to_string(  
     EXPORTING it_lines       = lt_lines 
     IMPORTING ev_ltx_content = lv_string ).


* 3) Convert String to SAP-Office
DATA lt_content TYPE SOLI_TAB. " table of struc SOLI with LINE TYPE SO_TEXT255 having CHAR 255
lt_content = cl_document_bcs=&amp;gt;string_to_soli( lv_string ).


* 4) Use the SAP-Office data for the object content
  DATA lt_mail_content TYPE TABLE OF SOLISTI1. " same struc as soli_tab, just different 'table type'
  INSERT LINES OF lt_content INTO TABLE lt_mail_content.
  CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    EXPORTING
      " ...
    IMPORTING
      " ...
    TABLES
      object_content             = lt_mail_content
      " ...
    EXCEPTIONS
      " ...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;PS: Instead of using the FM, you can also use class CL_BCS to create and send the mail and class CL_DOCUMENT_BCS to create content.&lt;/P&gt;</description>
    <pubDate>Fri, 22 May 2020 04:14:02 GMT</pubDate>
    <dc:creator>michael_piesche</dc:creator>
    <dc:date>2020-05-22T04:14:02Z</dc:date>
    <item>
      <title>Send Email With HTML Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-with-html-layout/m-p/12195562#M1981228</link>
      <description>&lt;P&gt;Hello Abapers&lt;/P&gt;
  &lt;P&gt;My requirement is to send the notification with the HTML layout in SAP inbox and external Email. I am using the FM SO_NEW_DOCUMENT_SEND_API1 and its working fine but the HTML layout is not working.&lt;/P&gt;
  &lt;P&gt;I did the 2 steps&lt;/P&gt;
  &lt;P&gt;1) I created the text by SO10 and write the html logic there and I am calling it through READ_TEXT&lt;/P&gt;
  &lt;P&gt;2) Then moving the contents into body OBJECT_CONTENT and sending it by document type HTM&lt;/P&gt;
  &lt;P&gt;But its not working can anybody explain me what step I am doing wrong or missing&lt;/P&gt;
  &lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 09:52:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-with-html-layout/m-p/12195562#M1981228</guid>
      <dc:creator>former_member554223</dc:creator>
      <dc:date>2020-05-21T09:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Send Email With HTML Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-with-html-layout/m-p/12195563#M1981229</link>
      <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;aizysyed&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;I know this isn't for SO_NEW_DOCUMENT_SEND_API1, but maybe you can rewrite your code to use the CL_CRM_EMAIL_DATA class? In my opinion it's much more developer friendly.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  lv_html TYPE string,
  ls_recipient TYPE crms_email_recipient.

DATA(lo_email) = NEW cl_crm_email_data( ).
CALL METHOD cl_crm_email_utility_base=&amp;gt;get_body_part_from_editor
  IMPORTING
    et_mime_data   = lo_email-&amp;gt;body
  CHANGING
    cv_html        = lv_html
  EXCEPTIONS
    input_error    = 1
    OTHERS         = 2.

lo_email-&amp;gt;subject = |My first HTML email, yay!|.
lo_email-&amp;gt;from-name = 'My name'.
lo_email-&amp;gt;from-address = '&amp;lt;MyEmailAddress@server.com&amp;gt;'.

ls_recipient-name = 'Your name'.
ls_recipient-address = 'YourEmailAddress@server.com'.
APPEND ls_recipient TO lo_email-&amp;gt;to.

TRY.
    DATA(lo_send_request) = cl_crm_email_utility_base=&amp;gt;cre_send_req_from_mail_data( lo_email ).
    " N = never, E = on error
    lo_send_request-&amp;gt;set_status_attributes( i_requested_status = 'N' ). 
    lo_send_request-&amp;gt;set_send_immediately( abap_true ).
    DATA(lv_result) = lo_send_request-&amp;gt;send( ).
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  CATCH cx_send_req_bcs INTO DATA(lx_bcs).
    " handle the exception
  CATCH cx_crm_email INTO DATA(lx_crm).
    " handle the exception
ENDTRY.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;Mateusz</description>
      <pubDate>Thu, 21 May 2020 10:59:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-with-html-layout/m-p/12195563#M1981229</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-05-21T10:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Send Email With HTML Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-with-html-layout/m-p/12195564#M1981230</link>
      <description>&lt;P&gt;You dont specify how you "move the contents", but I assume, that you simply insert the lines from READ_TEXT, which are "SAP-Script Text Rows" with Format and Content of TDSTXLLINE having CHAR 132, into the "SAP-Office Rows" with only Content SO_TEXT255 having CHAR 255.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But instead, you could/should transform the SAP-Script into SAP-Office format correctly. I do this by moving SAP-Script into string first, and then from string into SAP-Office.&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;" 1) READ TEXT in SAP-Script Format
DATA lt_lines TYPE TABLE OF tline. " table of struc TLINE with TDFORMAT and TDLINE having CHAR 132
CALL FUNCTION 'READ_TEXT'
  EXPORTING
    id       = your_id              " e.g. 'ST'        
    language = your_language        " e.g. 'E'
    name     = your_text_name
    object   = your_object          " e.g. 'TEXT'
  TABLES
    lines    = lt_lines.            " output in SAP-Script


* 2) Convert SAP-Script to String
DATA lo_text_assist TYPE REF TO /plmu/cl_ltx_assist.
DATA lv_string TYPE string.
CREATE OBJECT lo_text_assist.
CALL METHOD lo_text_assist-&amp;gt;convert_itf_to_string(  
     EXPORTING it_lines       = lt_lines 
     IMPORTING ev_ltx_content = lv_string ).


* 3) Convert String to SAP-Office
DATA lt_content TYPE SOLI_TAB. " table of struc SOLI with LINE TYPE SO_TEXT255 having CHAR 255
lt_content = cl_document_bcs=&amp;gt;string_to_soli( lv_string ).


* 4) Use the SAP-Office data for the object content
  DATA lt_mail_content TYPE TABLE OF SOLISTI1. " same struc as soli_tab, just different 'table type'
  INSERT LINES OF lt_content INTO TABLE lt_mail_content.
  CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    EXPORTING
      " ...
    IMPORTING
      " ...
    TABLES
      object_content             = lt_mail_content
      " ...
    EXCEPTIONS
      " ...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;PS: Instead of using the FM, you can also use class CL_BCS to create and send the mail and class CL_DOCUMENT_BCS to create content.&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 04:14:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-email-with-html-layout/m-p/12195564#M1981230</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-05-22T04:14:02Z</dc:date>
    </item>
  </channel>
</rss>

