<?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: Mail attachment in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570903#M586979</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;Decalre an iternal tabkle like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Data : It_message LIKE solisti1 OCCURS 10 WITH HEADER LINE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and test the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Reshma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jul 2007 13:10:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-31T13:10:30Z</dc:date>
    <item>
      <title>Mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570900#M586976</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;Iam using Function module..SO_NEW_DOCUMENT_ATT_SEND_API1&lt;/P&gt;&lt;P&gt;to attach a file and send a mail to SAP user..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in my program everything is ok..&lt;/P&gt;&lt;P&gt;But in attachment..&lt;/P&gt;&lt;P&gt;all the records are stored in single line..&lt;/P&gt;&lt;P&gt;why this problem arise..&lt;/P&gt;&lt;P&gt;and how can i solve this...&lt;/P&gt;&lt;P&gt;Plz anyone help me,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance..&lt;/P&gt;&lt;P&gt;Gowrishankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 12:44:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570900#M586976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T12:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570901#M586977</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;Chk this sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FUNCTION zsend_mail_attachment.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(V_FILE_PATH) TYPE  STRING OPTIONAL
*"     REFERENCE(V_SUBJECT) TYPE  SO_OBJ_DES
*"  TABLES
*"      IT_RECEIVERS STRUCTURE  SOMLRECI1
*"      IT_MESSAGE STRUCTURE  SOLISTI1
*"----------------------------------------------------------------------
 
  DATA: gd_cnt TYPE i,
        gd_sent_all(1) TYPE c,
        gd_doc_data LIKE sodocchgi1,
        gd_error TYPE sy-subrc.
 
  DATA objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
 
  DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
 
* Binary store for File
  DATA : BEGIN OF it_file OCCURS 0,
           row(255),
         END OF it_file.
 
* splitting of the filepath
  DATA : BEGIN OF i_split OCCURS 0,
           row(50),
         END OF i_split.
 
  DATA tab_lines LIKE sy-tabix.
 
  REFRESH : it_file, objbin, it_packing_list, i_split.
  CLEAR   : it_file, objbin, it_packing_list, i_split.
 
  DESCRIBE TABLE it_message LINES tab_lines.
  READ     TABLE it_message INDEX tab_lines.
 
  gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
  gd_doc_data-obj_langu  = sy-langu.
  gd_doc_data-obj_name   = 'SENDFILE'.
  gd_doc_data-obj_descr  = v_subject.
  gd_doc_data-sensitivty = 'O'.
 
  CLEAR it_packing_list.
 
  it_packing_list-head_start = 1.
  it_packing_list-head_num   = 0.
  it_packing_list-body_start = 1.
  it_packing_list-doc_type   = 'RAW'.
  it_packing_list-body_num   = tab_lines.
  APPEND it_packing_list.
 
  IF v_file_path IS NOT INITIAL.
    DATA : v_len      TYPE i,
           v_index    LIKE sy-index,
           v_doc_type TYPE  so_obj_tp,
           v_filename TYPE  so_obj_des .
 
    v_len = STRLEN( v_file_path ) - 3.
    v_doc_type = v_file_path+v_len(3) .
    TRANSLATE v_doc_type TO UPPER CASE .
 
    SPLIT v_file_path AT '' INTO TABLE i_split .
    DESCRIBE TABLE i_split LINES v_index .
    READ TABLE i_split INDEX v_index .
    v_filename = i_split-row .
    v_len = STRLEN( v_filename ) - 4.
    v_filename = v_filename(v_len) .
 
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename = v_file_path
        filetype = 'BIN'
      TABLES
        data_tab = it_file.
 
    LOOP AT it_file.
      MOVE it_file-row TO objbin-line.
      APPEND objbin.
    ENDLOOP.
 
    CLEAR it_packing_list.
 
    DESCRIBE TABLE objbin LINES tab_lines.
 
    it_packing_list-transf_bin = 'X'.
    it_packing_list-head_start = 1.
    it_packing_list-head_num   = 1.
    it_packing_list-body_start = 1.
    it_packing_list-doc_type   = v_doc_type.
    it_packing_list-body_num   = tab_lines.
    it_packing_list-doc_size   = tab_lines * 255.
    it_packing_list-obj_descr  = v_filename.
    APPEND it_packing_list.
  ENDIF.
 
*  it_receivers-receiver = 'xyz@yahoo.com'.
*  it_receivers-rec_type = 'U'.
*  it_receivers-com_type = 'INT'.
*  APPEND it_receivers .
 
* Call the FM to post the message to SAPMAIL
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data = gd_doc_data
      put_in_outbox = 'X'
      commit_work   = 'X'
*   IMPORTING
*     sent_to_all = gd_sent_all
    TABLES
      packing_list = it_packing_list
      contents_txt = it_message
      contents_bin = objbin
      receivers    = it_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.
 
ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Reshma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 12:48:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570901#M586977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T12:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570902#M586978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reshma..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something missed in your coding..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it shows an error like this..&lt;/P&gt;&lt;P&gt;It_message is not declared..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 12:59:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570902#M586978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T12:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570903#M586979</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;Decalre an iternal tabkle like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Data : It_message LIKE solisti1 OCCURS 10 WITH HEADER LINE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and test the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Reshma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 13:10:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/2570903#M586979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T13:10:30Z</dc:date>
    </item>
  </channel>
</rss>

