<?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: Reg: SO_NEW_DOCUMENT_ATT_SEND_API1 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596280#M594691</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;   I coudnt find my mail in SOST either.&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;Nathan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Aug 2007 06:59:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-08T06:59:26Z</dc:date>
    <item>
      <title>Reg: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596276#M594687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I am trying to send a mail from an executable program to an internet email id. I am using the function module SO_NEW_DOCUMENT_ATT_SEND_API1. The function doesnt raise any exception. The sent_to_all flag is set after execution. But the mail is not being sent. What could be wrong? If i use sapuser and rectype as 'B' the mail is delivered to the SAP Inbox. rectype 'U' is not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is a config issue in SCOT how to find the issue and how to solve it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nathan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 05:12:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596276#M594687</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T05:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596277#M594688</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;I think it is due to the problem of RFC connectivity. Ask your basis person for proper connectivity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are the FM for sending external email :- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO_DOCUMENT_SEND_API1  &lt;/P&gt;&lt;P&gt;SAPoffice: Send new document with attachments via RFC  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO_NEW_DOCUMENT_ATT_SEND_API1 &lt;/P&gt;&lt;P&gt;(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.) &lt;/P&gt;&lt;P&gt;SAPoffice: Send new document with attachments via RFC  &lt;/P&gt;&lt;P&gt;Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO_NEW_DOCUMENT_SEND_API1  &lt;/P&gt;&lt;P&gt;SAPoffice: Send new document  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Check this link it will solve ur issue&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/55/a8b538891b11d2a25a00a0c943858e/content.htm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Check this sample coding&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZMATURITYREPORT                                             *
*&amp;amp;                                                                     *
*&amp;amp;   Title - Maturity   report                                         *
*&amp;amp;           ABAP/4 Consultant                                         *
*&amp;amp; Name- Pavan Praveen Valluri Created on 26/07/2007                   *
*&amp;amp; FI Consultant- Amit Mistry                                          *
*&amp;amp; Module - FI                                                         *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZMATURITYREPORT.

tables: bseg.

* SELECTION SCREEN---------------------------------------------------  *

parameters: p_email type somlreci1-receiver default
'@outlook.com'.

* Data: p_email(25) type c value 'pavan@outlook.com'.

* END OF SELECTION SCREEN -------------------------------------------  *


*----------DATA DECLARATION--------------------------------------------*

data: it_message type standard table of solisti1 initial size 0
with header line.

data: it_message1 type standard table of solisti1 initial size 0
with header line.

data: it_message2(10) type N.


data: it_message3 type standard table of solisti1 initial size 0
with header line.


data: it_message4 type standard table of solisti1 initial size 0
with header line.

data: it_attach type standard table of solisti1 initial size 0
with header line.

data: text(150).


data: t_packing_list like sopcklsti1 occurs 0 with header line,
      t_contents like solisti1 occurs 0 with header line,
      t_receivers like somlreci1 occurs 0 with header line,
      t_attachment like solisti1 occurs 0 with header line,
      t_object_header like solisti1 occurs 0 with header line,


      w_cnt type i,
      w_sent_all(1) type c,
      w_doc_data like sodocchgi1,
      gd_error type sy-subrc,
      gd_reciever type sy-subrc.



start-of-selection.
data: lv_date type sy-datum.
data: lv_date1 type sy-datum.

data: lv_formatdate(10) type c.
data: lv_formatdate1(10) type c.

data: var1(4) type c,

var2(2) type c,

var3(2) type c.





data: begin of int_bseg occurs 0,
    BELNR LIKE BSEG-BELNR,
    ZUONR LIKE BSEG-ZUONR,
    GJAHR LIKE BSEG-GJAHR,
    DMBTR LIKE BSEG-DMBTR,
    HKONT LIKE BSEG-HKONT,


end of int_bseg.

data: begin of int_SKAT occurs 0,
    TXT50 LIKE SKAT-TXT50,
    SAKNR LIKE SKAT-SAKNR,
    KTOPL LIKE SKAT-KTOPL,

end of int_SKAT.

data: begin of int_bkpf occurs 0,
      BELNR LIKE BKPF-BELNR,
      BUKRS LIKE BKPF-BUKRS,
      GJAHR LIKE BKPF-GJAHR,
      BUDAT  LIKE BKPF-BUDAT,

end of int_BKPF.


data: 2days_out type sy-datum.
2days_out = sy-datum + 2.

data: var4(4) type c,

var5(2) type c,

var6(2) type c.

*-------- END OF DATA DECLARATION--------------------------------------*



*--- CONCATENATING AND ARRANGING DATE ---------------------------------*



lv_date = 2days_out.
var1 = lv_date+(4).
var2 = lv_date+4(2).
var3 = lv_date+6(2).

concatenate var3 var2 var1 into lv_formatdate separated by '.'.

*--- END OF CONCATENATING AND ARRANGING DATE  -------------------------*


*-------------------------SELECTION FOR BSEG---------------------------*




select zuonr belnr bukrs GJAHR DMBTR HKONT from bseg into
corresponding fields of  table int_bseg
where bukrs = 'company code' and
      ZUONR = lv_formatdate.

*--------------END OF SSELECTION FOR BSEG---------------------------   *



*-------------------------SELECTION FOR BKPF---------------------------*



select  BUDAT BUKRS BELNR GJAHR  from BKPF into
corresponding fields of table int_BKPF
where bukrs = 'company code'.


append int_BKPF.

*------------------END OF SELECTION FOR BKPF---------------------------*

*-------------------------SELECTION FOR SKAT---------------------------*




select SAKNR TXT50 from SKAT into
corresponding fields of  table int_SKAT
where KTOPL = 'company code'.
*and      SAKNR = INT_BSEG-HKONT.
APPEND INT_SKAT.

*--------------END OF SSELECTION FOR SKAT---------------------------   *



*-----------------POPULATING EMAIL SUBJECT ----------------------------*




 perform populate_email_message_body.



  perform send_file_as_email_attachment
  tables it_message
  it_attach
  using p_email
  'Maturity after 2 days'
  'XLS'
  'filename'
  ' '
  ' '
  ' '
  changing gd_error
  gd_reciever.

* Instructs mail send program for SAPCONNECT to send email(rsconn01)
  perform initiate_mail_execute_program.



*endif.




end-of-selection.

*------------END OF POPULATING EMAIL SUBJECT --------------------------*


*&amp;amp;---------------------------------------------------------------------
*
*&amp;amp; Form SEND_FILE_AS_EMAIL_ATTACHMENT
*&amp;amp;---------------------------------------------------------------------
*
* Send email
*----------------------------------------------------------------------
*
form send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.


  data: ld_error type sy-subrc,
  ld_reciever type sy-subrc,
  ld_mtitle like sodocchgi1-obj_descr,
  ld_email like somlreci1-receiver,
  ld_format type so_obj_tp ,
  ld_attdescription type so_obj_nam ,
  ld_attfilename type so_obj_des ,
  ld_sender_address like soextreci1-receiver,
  ld_sender_address_type like soextreci1-adr_typ,
  ld_receiver like sy-subrc.

  ld_email = p_email.
  ld_mtitle = p_mtitle.
  ld_format = p_format.
  ld_attdescription = p_attdescription.
  ld_attfilename = p_filename.
  ld_sender_address = p_sender_address.
  ld_sender_address_type = p_sender_addres_type.


* Fill the document data.
  w_doc_data-doc_size = 1.



* Populate the subject/generic message attributes
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name = 'SAPRPT'.
  w_doc_data-obj_descr = ld_mtitle .
  w_doc_data-sensitivty = 'F'.




** Fill the document data and get size of attachment
  clear w_doc_data.
  read table it_attach index w_cnt.
  w_doc_data-doc_size =
  ( w_cnt - 1 ) * 255 + strlen( it_attach ).
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name = 'SAPRPT'.
  w_doc_data-obj_descr = ld_mtitle.
  w_doc_data-sensitivty = 'F'.
  clear t_attachment.
  refresh t_attachment.
  t_attachment[] = pit_attach[].

* Describe the body of the message
  clear t_packing_list.
  refresh t_packing_list.
  t_packing_list-transf_bin = space.
  t_packing_list-head_start = 1.
  t_packing_list-head_num = 0.
  t_packing_list-body_start = 1.
  describe table it_message lines t_packing_list-body_num.
  t_packing_list-doc_type = 'RAW'.
  append t_packing_list.


* Add the recipients email address
  clear t_receivers.
  refresh t_receivers.
  t_receivers-receiver = ld_email.
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  append t_receivers.

  call function 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data              = w_doc_data
      put_in_outbox              = 'X'
      sender_address             = ld_sender_address
      sender_address_type        = ld_sender_address_type
      commit_work                = 'X'
    IMPORTING
      sent_to_all                = w_sent_all
    TABLES
      object_header              = t_object_header
      packing_list               = t_packing_list
      contents_bin               = t_attachment
      contents_txt               = it_message
      receivers                  = t_receivers
    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.

* Populate zerror return code
  ld_error = sy-subrc.

* Populate zreceiver return code
  loop at t_receivers.
    ld_receiver = t_receivers-retrn_code.
  endloop.
endform.                    "send_file_as_email_attachment



*&amp;amp;---------------------------------------------------------------------
*
*&amp;amp; Form INITIATE_MAIL_EXECUTE_PROGRAM
*&amp;amp;---------------------------------------------------------------------
*
* Instructs mail send program for SAPCONNECT to send email.
*----------------------------------------------------------------------
*

form initiate_mail_execute_program.
  wait up to 2 seconds.
  if gd_error eq 0.
    submit rsconn01 with mode = 'INT'
                  with output = 'X'
                  and return.
  endif.
endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM



*&amp;amp;---------------------------------------------------------------------
*
*&amp;amp; Form POPULATE_EMAIL_MESSAGE_BODY
*&amp;amp;---------------------------------------------------------------------
*
* Populate message body text
*----------------------------------------------------------------------
*
form populate_email_message_body.

  refresh it_message.
  refresh it_message1.
  refresh it_message3.
   refresh it_message4.

*--------------- LOOP FOR BSEG -----------------------------------------

  loop at int_BSEG.


read table int_bKPF WITH KEY BELNR = INT_BSEG-BELNR
        GJAHR = INT_BSEG-GJAHR.

read table int_SKAT WITH KEY SAKNR = INT_BSEG-HKONT.


*---CHANGING DATE FORMAT FOR BKPF---------------------------------------


lv_date1 = int_bkpf-budat.
  var4 = lv_date1+(4).
  var5 = lv_date1+4(2).
  var6 = lv_date1+6(2).


concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.

*---END OF CHANGING DATE FORMAT FOR BKPF-------------------------



it_message =  int_bseg-belnr.
it_message1 =  lv_formatdate1.
it_message2 = int_bseg-dmbtr.
it_message3 = int_bseg-hkont.
IT_MESSAGE4 = INT_SKAT-TXT50.

SHIFT IT_MESSAGE2 LEFT DELETING LEADING '0'.

*-------------POPULATING EMAIL BODY WITH DATA -------------------------


concatenate 'Maturity After 2Days' 'for'  'G/L account-' it_message3
'--' IT_MESSAGE4  ',' 'Amount-' it_message2
    into it_message separated by space.


 append it_message.
 append it_message1.
 append it_message3.


  clear it_message.
  clear it_message1.
  clear it_message2.
  clear it_message3.





 endloop.

*------------END OF LOOP FOR BSEG --------------------------------------



endform. " POPULATE_EMAIL_MESSAGE_BODY&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this link for other details about sending mail&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/38/71f865c2c9a94ab1dce95792187c16/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/38/71f865c2c9a94ab1dce95792187c16/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_sm32/helpdata/en/49/fa6b41419f031de10000000a155106/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_sm32/helpdata/en/49/fa6b41419f031de10000000a155106/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 05:30:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596277#M594688</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T05:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596278#M594689</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;go to transaction &amp;lt;b&amp;gt;SOST&amp;lt;/b&amp;gt; and check whether you can see your mail..&lt;/P&gt;&lt;P&gt;If your send method is &amp;lt;b&amp;gt;VIA internet&amp;lt;/b&amp;gt; and its in status is in &amp;lt;b&amp;gt;yellow color&amp;lt;/b&amp;gt;..then your mail is waiting for communication&lt;/P&gt;&lt;P&gt;.. then inform your Basis guy regarding the communication setup..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rewards if useful,&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;nazeer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 05:30:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596278#M594689</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T05:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596279#M594690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you run program program RSCONN01?  The FM SO_NEW_ATT_SEND_API creates the email and pops it in the ooutbox.  Then, you need to run ath aforementioned program in order to push it through out of SAP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want/need to have this occur without your intervention, you can always set up the program to run in a bacth job and schedule every x number of minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 05:33:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596279#M594690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T05:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596280#M594691</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;   I coudnt find my mail in SOST either.&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;Nathan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 06:59:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-so-new-document-att-send-api1/m-p/2596280#M594691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T06:59:26Z</dc:date>
    </item>
  </channel>
</rss>

