<?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 a Basic eMail in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072017#M429244</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;Set the date field to sy-datum wherever it appears in the tables before using the SO_API_NEW_DOCUMENT function call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;- Atul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Mar 2007 12:13:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-09T12:13:48Z</dc:date>
    <item>
      <title>Sending a Basic eMail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072014#M429241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement to send just a basic email in SAP. I am using the following code but for some reason it is not working. It says that I don't have an recipient address even though a correctly formatted address is in LT_ADSMTP-E_MAIL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INCLUDE &amp;lt;CNTN01&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: MESSAGE TYPE SWC_OBJECT.&lt;/P&gt;&lt;P&gt;DATA: RECIPIENT TYPE SWC_OBJECT.&lt;/P&gt;&lt;P&gt;DATA: CONTENT LIKE SOLI-LINE OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CONTAINER CONTAINER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CLEAR_CONTAINER CONTAINER.&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'AddressString' LT_ADSMTP-E_MAIL.&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'TypeId' 'B'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CLEAR_CONTAINER CONTAINER.&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'SendExpress' 'X'.&lt;/P&gt;&lt;P&gt;SWC_CALL_METHOD RECIPIENT 'SetExpress' CONTAINER.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CREATE_OBJECT MESSAGE 'MESSAGE' SPACE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CLEAR_CONTAINER CONTAINER.&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'Document Title'(001).&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'Document Name'(002).&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'DOCUMENTTYPE' 'RAW'.&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'NO_DIALOG' 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONTENT = 'First Line of content'(003).&lt;/P&gt;&lt;P&gt;APPEND CONTENT.&lt;/P&gt;&lt;P&gt;CONTENT = 'Second line of content'(004).&lt;/P&gt;&lt;P&gt;APPEND CONTENT.&lt;/P&gt;&lt;P&gt;SWC_SET_TABLE CONTAINER 'DocumentContent' CONTENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CALL_METHOD MESSAGE 'Create' CONTAINER.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CLEAR_CONTAINER CONTAINER.&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'NewRecipient' RECIPIENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CALL_METHOD MESSAGE 'AddCopyOfRecipient' CONTAINER.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CLEAR_CONTAINER CONTAINER.&lt;/P&gt;&lt;P&gt;SWC_SET_ELEMENT CONTAINER 'OutboxFlag' 'X'.&lt;/P&gt;&lt;P&gt;SWC_CALL_METHOD MESSAGE 'SetOutboxFlag' CONTAINER.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_CLEAR_CONTAINER CONTAINER.&lt;/P&gt;&lt;P&gt;SWC_CALL_METHOD MESSAGE 'Submit' CONTAINER.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;commit work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SWC_FREE_OBJECT MESSAGE.&lt;/P&gt;&lt;P&gt;SWC_FREE_OBJECT RECIPIENT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 17:43:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072014#M429241</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-08T17:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sending a Basic eMail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072015#M429242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Never tried it quite that way,  but here is some coding that works to send a simple mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0003 .

* For API
data: maildata type sodocchgi1.
data: mailtxt  type table of solisti1 with header line.
data: mailrec  type table of somlrec90 with header line.

start-of-selection.

  clear:    maildata, mailtxt,  mailrec.
  refresh:  mailtxt, mailrec.

  maildata-obj_name = 'TEST'.
  maildata-obj_descr = 'Test'.
  maildata-obj_langu = sy-langu.

  mailtxt-line = 'This is a test'.
  append mailtxt.

  mailrec-receiver = 'you@yourcompany.com'.
  mailrec-rec_type  = 'U'.
  append mailrec.


    call function 'SO_NEW_DOCUMENT_SEND_API1'
         exporting
              document_data              = maildata
              document_type              = 'RAW'
              put_in_outbox              = 'X'
         tables
              object_header              = mailtxt
              object_content             = mailtxt
              receivers                  = mailrec
         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.
    if sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.

  
*  Force the send process by uncommenting the next line
* submit rsconn01 with mode = 'INT' and return.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 18:02:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072015#M429242</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-03-08T18:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sending a Basic eMail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072016#M429243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant as always Rich, thanks! One thing though,  when I look in the SOST queue, the send date is set as 00.00.000 is there anyway of sorting this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 10:35:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072016#M429243</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T10:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sending a Basic eMail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072017#M429244</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;Set the date field to sy-datum wherever it appears in the tables before using the SO_API_NEW_DOCUMENT function call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;- Atul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 12:13:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072017#M429244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T12:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sending a Basic eMail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072018#M429245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only date field in the MAILDATA table is OBJ_EXPDAT which is the Expiration date of object so I don't think thats what I'm after.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks anyway&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2007 12:23:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-a-basic-email/m-p/2072018#M429245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-09T12:23:25Z</dc:date>
    </item>
  </channel>
</rss>

