<?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: Sending HTML mail doesn't work in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600787#M1276386</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this program to find how to use the FM&lt;/P&gt;&lt;P&gt;This Fm 'SO_NEW_DOCUMENT_SEND_API1' is used all in this program please check it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RADMSJOB                         Call Mass Dictionary Checks (Friday-Sunday Only)&lt;/P&gt;&lt;P&gt;RFASSIGNAR                       Assignment of Open Items&lt;/P&gt;&lt;P&gt;RHMAIL10                         Submit Report for MAIL Processing&lt;/P&gt;&lt;P&gt;RHPMDYNMASS                      Dynamic personnel action for HR Funds and Position Managemen&lt;/P&gt;&lt;P&gt;RKSCMAMAIL                       Send Mail to User&lt;/P&gt;&lt;P&gt;RPLFDAF0PBSMOD&lt;/P&gt;&lt;P&gt;RSCMST                           CMS: Test programs&lt;/P&gt;&lt;P&gt;RSSOAUTH                         SAPoffice: Internal subroutine: Adjust folder authorization&lt;/P&gt;&lt;P&gt;RSSOOT01                         Program for object type SOFM: Office document&lt;/P&gt;&lt;P&gt;RSSOQUMS                         Send mail because of quota&lt;/P&gt;&lt;P&gt;RSSOQURE                         Evaluation of quota data at distribution list level&lt;/P&gt;&lt;P&gt;RSSOQUTA                         Calculation of the quota&lt;/P&gt;&lt;P&gt;RSSOUSCO                         Consistency check of user tables&lt;/P&gt;&lt;P&gt;RSSXRAWGEN                       Send a RAW/RAW Test Document in the SAPoffice Inbox&lt;/P&gt;&lt;P&gt;SAPF070                          Reconcile Documents and Account Transaction Figures&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2009 11:28:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-07T11:28:55Z</dc:date>
    <item>
      <title>Sending HTML mail doesn't work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600786#M1276385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to send an HTML eMail by using function module 'SO_NEW_DOCUMENT_SEND_API1'.&lt;/P&gt;&lt;P&gt;Without success! When I debug the code, the format os switched from HTM to RAW and I have no clue why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data objpack like sopcklsti1 occurs  2 with header line.
  data objhead like solisti1   occurs  1 with header line.
  data objbin  like solisti1   occurs 10 with header line.
  data objtxt  like solisti1   occurs 10 with header line.
  DATA ls_doc_send  TYPE sodocchgi1.

  ls_doc_send-obj_name = 'Exp.Auth. Notif.'.
  ls_doc_send-obj_descr = 'Expiring Authentication Notification'.
  ls_doc_send-sensitivty = 'O'.
  ls_doc_send-obj_langu = 'E'.
  DESCRIBE TABLE i_mailtext LINES lv_int_send.
  READ TABLE i_mailtext into lv_last_line INDEX lv_int_send.
  ls_doc_send-doc_size = ( lv_int_send - 1 ) * 255 + STRLEN( lv_last_line ).

  CLEAR objpack-transf_bin.
*  objpack-transf_bin = 'X'.
  objpack-head_start = 1.
  objpack-head_num   = 0.
  objpack-body_start = 1.
  DESCRIBE TABLE i_mailtext LINES tab_lines.
  objpack-body_num   = tab_lines.
  objpack-doc_type   = 'HTM'.
  objpack-doc_size   = ls_doc_send-doc_size.
  APPEND objpack.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    EXPORTING
     document_data                    = ls_doc_send
     document_type                    = 'HTM'
     PUT_IN_OUTBOX                    = 'X'
     commit_work                      = 'X'
* IMPORTING
*   SENT_TO_ALL                      =
*   NEW_OBJECT_ID                    =
    TABLES
     object_header                    = objhead
     object_content                   = i_mailtext
*     CONTENTS_HEX                     = i_mailtext
*   OBJECT_PARA                      =
*   OBJECT_PARB                      =
      receivers                        = i_receiver
   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                           = 8.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parameter i_Mailtext is the prepared HTML document. Do oyu know which HTML elements/tags are mandatory? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objhead and objbin are not set, should I?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Steffen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 11:24:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600786#M1276385</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T11:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sending HTML mail doesn't work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600787#M1276386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this program to find how to use the FM&lt;/P&gt;&lt;P&gt;This Fm 'SO_NEW_DOCUMENT_SEND_API1' is used all in this program please check it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RADMSJOB                         Call Mass Dictionary Checks (Friday-Sunday Only)&lt;/P&gt;&lt;P&gt;RFASSIGNAR                       Assignment of Open Items&lt;/P&gt;&lt;P&gt;RHMAIL10                         Submit Report for MAIL Processing&lt;/P&gt;&lt;P&gt;RHPMDYNMASS                      Dynamic personnel action for HR Funds and Position Managemen&lt;/P&gt;&lt;P&gt;RKSCMAMAIL                       Send Mail to User&lt;/P&gt;&lt;P&gt;RPLFDAF0PBSMOD&lt;/P&gt;&lt;P&gt;RSCMST                           CMS: Test programs&lt;/P&gt;&lt;P&gt;RSSOAUTH                         SAPoffice: Internal subroutine: Adjust folder authorization&lt;/P&gt;&lt;P&gt;RSSOOT01                         Program for object type SOFM: Office document&lt;/P&gt;&lt;P&gt;RSSOQUMS                         Send mail because of quota&lt;/P&gt;&lt;P&gt;RSSOQURE                         Evaluation of quota data at distribution list level&lt;/P&gt;&lt;P&gt;RSSOQUTA                         Calculation of the quota&lt;/P&gt;&lt;P&gt;RSSOUSCO                         Consistency check of user tables&lt;/P&gt;&lt;P&gt;RSSXRAWGEN                       Send a RAW/RAW Test Document in the SAPoffice Inbox&lt;/P&gt;&lt;P&gt;SAPF070                          Reconcile Documents and Account Transaction Figures&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 11:28:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600787#M1276386</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T11:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sending HTML mail doesn't work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600788#M1276387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try This u ill get some idea ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: maildata   like sodocchgi1.&lt;/P&gt;&lt;P&gt;data: mailtxt    like solisti1 occurs 10 with header line.&lt;/P&gt;&lt;P&gt;data: mailrec    like somlrec90 occurs 0  with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear:    maildata, mailtxt,  mailrec.&lt;/P&gt;&lt;P&gt;  refresh:  mailtxt, mailrec.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;submit ztestalv02 and return.&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_NEW_DOCUMENT_SEND_API1'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            document_data              = maildata&lt;/P&gt;&lt;P&gt;            document_type              = 'HTM'&lt;/P&gt;&lt;P&gt;            put_in_outbox              = 'X'&lt;/P&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;            object_header              = mailtxt&lt;/P&gt;&lt;P&gt;            object_content             = mailtxt&lt;/P&gt;&lt;P&gt;            receivers                  = mailrec&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            too_many_receivers         = 1&lt;/P&gt;&lt;P&gt;            document_not_sent          = 2&lt;/P&gt;&lt;P&gt;            document_type_not_exist    = 3&lt;/P&gt;&lt;P&gt;            operation_no_authorization = 4&lt;/P&gt;&lt;P&gt;            parameter_error            = 5&lt;/P&gt;&lt;P&gt;            x_error                    = 6&lt;/P&gt;&lt;P&gt;            enqueue_error              = 7&lt;/P&gt;&lt;P&gt;            others                     = 8.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 11:46:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600788#M1276387</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T11:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sending HTML mail doesn't work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600789#M1276388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi jinku,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your answer.&lt;/P&gt;&lt;P&gt;But also with your code I get a return code 2 = document_not_sent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created the mail text like this:&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;mailtxt = '&amp;lt;body&amp;gt;test&amp;lt;/body&amp;gt;'.
  APPEND mailtxt.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anything I miss?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During debugging, I found out that the doucment type is always reset to RAW in form "format_prepare_for_insert" in lines as l_file_type is initial:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;case l_object_type.
    when 'INT' or 'HTM' or 'TXT' or 'ICS'.
      if l_file_format = bin.
        set_type ext object_type.
      else.
        set_type raw object_type.
      endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Steffen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Steffen Weber on May 7, 2009 2:45 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Steffen Weber on May 7, 2009 3:02 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 12:18:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-html-mail-doesn-t-work/m-p/5600789#M1276388</guid>
      <dc:creator>steffen_weber</dc:creator>
      <dc:date>2009-05-07T12:18:47Z</dc:date>
    </item>
  </channel>
</rss>

