Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9052

Re: Send FM results to a mail adress

$
0
0

Yes Amine,

 

It is possible with that FM.

 

* Mail Body

    DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
  READ TABLE lt_objtxt INTO lrec_soli INDEX l_tab_lines.
  lrec_doc_chng-doc_size = ( l_tab_lines - 1 ) * 375 + STRLEN( lrec_soli ).

* Creation of the entry for the Mail Contents
  CLEAR lrec_sopcklst-transf_bin.
  lrec_sopcklst-head_start = 1.
  lrec_sopcklst-head_num   = 0.
  lrec_sopcklst-body_start = 1.
  lrec_sopcklst-body_num   = l_tab_lines.
  lrec_sopcklst-doc_type   = 'HTM'.     " Or any other format
  APPEND lrec_sopcklst TO lt_objpack.

* Here keep your attachement Table
  CLEAR lrec_soli.
  DESCRIBE TABLE it_xml_table LINES l_tab_lines.
  lrec_soli = 'WO_List.xls'. " AttachmentName  "#EC NOTEXT
  APPEND lrec_soli TO lt_objhead.

* Creation of the entry for attachment
  lrec_sopcklst-transf_bin = 'X'.
  lrec_sopcklst-head_start = 1.
  lrec_sopcklst-head_num   = 1.
  lrec_sopcklst-body_start = 1.
  lrec_sopcklst-body_num   = l_tab_lines.
  lrec_sopcklst-doc_type   = 'XLS'.                         "#EC NOTEXT
  lrec_sopcklst-obj_name  = 'Work Order List'.            "#EC NOTEXT
  lrec_sopcklst-obj_descr = 'Due TMP WO List'.            "#EC NOTEXT

  READ table it_xml_table into lwa_xml_table index l_tab_lines.


  lrec_sopcklst-doc_size = ( l_tab_lines - 1) * 255 + STRLEN (lwa_xml_table).
  APPEND lrec_sopcklst TO lt_objpack.

* Sending the document
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = lrec_doc_chng
*     put_in_outbox              = 'X'
      commit_work                = 'X'
    TABLES
      packing_list               = lt_objpack
      object_header              = lt_objhead
*     contents_bin               = objbin
      contents_bin               = it_xml_table
      contents_txt               = lt_objtxt
      receivers                  = it_reclist
    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.

 

Cheers,

Raju Shrestha

www.sapyard.com


Viewing all articles
Browse latest Browse all 9052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>