Mail package with attachment

Hi,
I have to send a flat file as attachment through the mail adapter in combination with the mail package because I have to communicate with several partners and I want to determine dynamically the "To:" depending on a field in the source structure (an IDoc).
The scenario is almost complete. I've created the file as mail attachment using the MessageTransformBean module and it works fine but how can I map the xml structure needed for the mail package?
I've already check the following weblogs but I didn't find the answer to my question.
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
/people/srinivas.reddy/blog/2005/02/11/model-driven-architecturemda-for-dummies
Thank you!
Ciao
Stefano

Hi Stefano,
Refer to the How-to Guide on Mail Adapter at the below link.
https://websmp103.sap-ag.de/~form/sapnet?_SHORTKEY=01200252310000071155&_SCENARIO=01100035870000000202&_OBJECT=011000358700004556712005E
Rgds,
Sam Raju

Similar Messages

  • File-xi- mail scenario with attachements

    Hi
    Can anybody tell me the real time use of file-xi- mail scenario with attachements ??
    thanks
    kumar

    Hi,
    >>>>Can anybody tell me the real time use of file-xi- mail scenario with attachements ??
    yes: your application puts order data into a file and generated a PDF file with it
    XI takes both and send order file in mail and PDF in mail attachment
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Receiver Mail Adapter, Mail Package with Payload as Attachment

    Hi Everyone,
    I have spent the better part of the day today searching and testing all of the different combinations that I could think of to solve this problem, so please don't just do an SDN search for me and cut/paste in the links as there are too many contradictive answers piling up over the last year.
    I am trying to use a Receiver mail adapter to send some data using the mail package, and I want to have the <content> tag be in an attachment.  I am using mail package to dynamically set the mail address, but to also try and turn my data into a csv file that the recipient can open in Excel.
    My mail package sets the following values:
    <Content_Type>text/plain</Content_Type>
    <Content_Disposition>attachment</Content_Disposition>
    <Content>Sample Text</Content>
    This blog is basically what I am trying to do: 
    <a href="/people/community.user/blog/2006/09/08/email-report-as-attachment-excelword:///people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    But no where in here is he setting ContentDisposition, and he is (potentially) not using the MessageTransformBean module.
    It is unclear if I need to use the MessageTransformBean to make this work? 
    Questions:
    1) Do I need to use the MessageTransformBean?
    2) Do I need to set the ContentDisposition in the mail package?
    3) Does Service Pack matter with these settings?  We are on SP15 upgrading to SP18 very soon.
    Thanks
    Peter

    Hi Peter,
    try:
    <Content_Type>text/plain;name="file.csv"</Content_Type>
    <Content_Disposition>attachment;filename="file.csv"</Content_Disposition>
    <Content>Sample Text</Content>
    Regards
    Stefan

  • Mail Package with XML attachment

    Hi Everybody,
    I am using Mail Package to implement dynamic mail.
    The email is sent successfully, the problem is that when I try to open my XML attachment and the error 'The page can not be displayed'  appears in my browser.
    I changed charset from ISO-8859-1 to UTF-8. But it still didn't work.
    Here is the information in my content_type tag:
    text/plain; charset=UTF-8 ; name=NFe.xml
    Please anyone could help me ?
    Regards,
    Daniela

    Thanks for your reply.
    In fact the right value for Context_Type tag is application/xml; charset="UTF-8"; name="MyFile.xml"
    And I also removed the values in the Tags "Content_Description" and "Content_Disposition".
    Now it is working fine.
    Regards,
    Daniela Machado

  • Mail Package with email attachments

    Hy,
    it's possible to use Email package (From,To,Content,...), if I want send an email with attachment?
    Cheers
    Matti

    Hi Mattia,
    Have a look at these weblogs....
    http://help.sap.com/saphelp_nw04/helpdata/en/23/c093409c663228e10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/frameset.htm
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    /people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems
    cheers,
    Prashanth

  • Mail receiver with attachment

    Hey,
    I have a rfc to mail scenario, it works but i get the payload(data) as an attachment, how do i change it so payload will be in mail body ?
    TX

    Hey Abhishek,
    what do you meen by "HTML formatting", can you please explain how to do that ?
    how can i use both mail package and XSLT ? isnt it one or the other ?
    this is my xslt:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="/">
    <rfc:Y_SD_XI_FEED_BACK_1 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
       <xsl:element name = "COUNTER_E" >
          <xsl:value-of select = "//COUNTER_E" />
       </xsl:element>
       <xsl:element name = "DATUM" >
          <xsl:value-of select = "//DATUM" />
       </xsl:element>
       <xsl:element name = "DELIVERY" >
          <xsl:value-of select = "//DELIVERY" />
       </xsl:element>
       <xsl:element name = "FILE_NAME" >
          <xsl:value-of select = "//FILE_NAME" />
       </xsl:element>
       <xsl:element name = "FUNCNAME" >
          <xsl:value-of select = "//FUNCNAME" />
       </xsl:element>
       <xsl:element name = "INV_DOC_NO" >
          <xsl:value-of select = "//INV_DOC_NO" />
       </xsl:element>
       <xsl:element name = "MANDT" >
          <xsl:value-of select = "//MANDT" />
       </xsl:element>
       <xsl:element name = "PO_NUMBER" >
          <xsl:value-of select = "//PO_NUMBER" />
       </xsl:element>
       <xsl:element name = "SYSID" >
          <xsl:value-of select = "//SYSID" />
       </xsl:element>
       <xsl:element name = "TEXT" >
          <xsl:value-of select = "//TEXT" />
       </xsl:element>
       <xsl:element name = "SYSID" >
          <xsl:value-of select = "//SYSID" />
       </xsl:element>
       <xsl:element name = "UZEIT" >
          <xsl:value-of select = "//UZEIT"/>
       </xsl:element>     
       <IT_RETURN>
       <xsl:for-each select = "//IT_RETURN/item" >
       <item>
          <xsl:element name = "TYPE" >
          <xsl:value-of select = "//TYPE" />
       </xsl:element>
       <xsl:element name = "ID" >
          <xsl:value-of select = "//ID" />
       </xsl:element>
       <xsl:element name = "NUMBER" >
          <xsl:value-of select = "//NUMBER" />
       </xsl:element>
       <xsl:element name = "MESSAGE" >
          <xsl:value-of select = "//MESSAGE"/>
       </xsl:element>  
          <xsl:element name = "LOG_NO" >
          <xsl:value-of select = "//LOG_NO" />
       </xsl:element>
       <xsl:element name = "LOG_MSG_NO" >
          <xsl:value-of select = "//LOG_MSG_NO" />
       </xsl:element>
       <xsl:element name = "MESSAGE_V1" >
          <xsl:value-of select = "//MESSAGE_V1"/>
       </xsl:element>
          <xsl:element name = "MESSAGE_V2" >
          <xsl:value-of select = "//MESSAGE_V2"/>
       </xsl:element>
          <xsl:element name = "MESSAGE_V3" >
          <xsl:value-of select = "//MESSAGE_V3"/>
       </xsl:element>
          <xsl:element name = "MESSAGE_V4" >
          <xsl:value-of select = "//MESSAGE_V4"/>
       </xsl:element>
          <xsl:element name = "PARAMETER" >
          <xsl:value-of select = "//PARAMETER"/>
       </xsl:element>
          <xsl:element name = "ROW" >
          <xsl:value-of select = "//ROW"/>
       </xsl:element>
          <xsl:element name = "FIELD" >
          <xsl:value-of select = "//FIELD"/>
       </xsl:element>
          <xsl:element name = "SYSTEM" >
          <xsl:value-of select = "//SYSTEM"/>
       </xsl:element>   
       </item>
    </xsl:for-each>
    </IT_RETURN>
    </rfc:Y_SD_XI_FEED_BACK_1>
    </xsl:template>
    </xsl:stylesheet>
    Edited by: Zevik Heinoch on Feb 9, 2009 3:07 PM

  • Receiver Mail Adapter with Attachment and Mailpackage

    I have set up a scenario
    filesystem: filexxx.xml filexxx.pdf
    xml= mailpackage format to get the receiver mailaddress
    pdf=the file i want to send as a attchment.
    I am using the RenemAttachment module i found on SDN.
    in SXMB_MONI it looks ok,  the attachment name is filexxx.pdf application/pdf
    But when i look at the mail send it shows as attachments
    Untitled.txt and Untitled.pdf
    Any id's
    I only want to send the mail woth one attachment, the original pdf as a attchment.
    tnx

    Issue should be solved with SP17.
    I solved by putting the attacgement into the content part of the message.
    like.
    <?xml version="1.0" encoding="ISO8859-1"?>
    <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
         <Subject>Greenery:TESTTEST</Subject>
         <From>customerservicedesk@xxxxxxx</From>
         <To>Peter.schults@xx</To>
         <Content_Type>application/pdf; name=TEST.pdf</Content_Type>
         <Content_Description>PDF FAKTUUR</Content_Description>
         <Content_Disposition>attachment; filename=TEST.pdf</Content_Disposition>
        </ns1:Mail>

  • Mail adapter with attachment

    hello
    I have a mail sender adapter with attachment, that I would like to transfer to other PI.
    the important is to keep the attachment and to deliever it to the PI
    any ideas?
    Kfir

    Hi,
    By using Java mapping, you can easily achieve this.
    Or use Adapter module 'PayloadSwapBean '.
    Please see the below blogs, it might be helpful to you.
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    /people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping
    Regards,
    Rajesh

  • Xi sender mail adapter with attachment (to Web Service w/ attachment)

    Hello,
    We're working on an XI scenario wherein a sender mail adapter polls an exchange server inbox for mail (with attachment)and sends the attachment to a Web Service via SOAP Adapter? Does anyone know if this is doable, and if so, how?
    Thanks,
    Eric

    Hi!
    I think so, if you just have a single attachment to be transferred.
    Use the Mail Sender Adapter and specify the MailServer URL etc...
    In the Module provessor of the Mail-Adapter you have to specify the PayloadSwapBean ( -> this changes the payload - the attachment becomes the payload)
    then you configure the standard XI-scenario with
    SenderAgreement
    Mapping if necessary
    Receiver Agreement
    Receiver adapter
    kr Martin

  • Mail sending with attachment

    Hi all,
            i'm working on badi i need to send a mail with excel attachment, if you have sample code pls
    send me.
    Regards
    Suprith

    hi
    refer to this thread
    Re: Send mails with attachment to external email id
    hope this helps
    regards
    Aakash Banga

  • How to include body of the mail along with attachment using the below FM

    Hi All,
    I am using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to generate an e-mail with excel file as attachment. Can you please  let me know how to include body of the e-mail along with this attachment.
    Thanks & Regards
    Gowthami

    hi,
    see this code
    TABLES: apqi.                         "Queue info definition
    TYPES DECLARATION
    *& Global Types
    TYPE-POOLS: slis,                     "Type for alv list
                sx.                       "SAP connect
    TYPE-POOLS: list.
    *& Types
    TYPES: BEGIN OF s_itab_apqi.
            INCLUDE STRUCTURE apqi.
    TYPES: END OF s_itab_apqi.
               INTERNAL TABLE / WORK AREA DECLARATION             *
    *&  For email  attachment
    DATA:   it_message 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:   it_packing_list  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            it_contents      LIKE solisti1 OCCURS 0 WITH HEADER LINE  ,
            it_receivers     LIKE somlreci1 OCCURS 0 WITH HEADER LINE ,
            it_attachment    LIKE solisti1 OCCURS 0 WITH HEADER LINE  ,
            it_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE  .
    DATA:   v_cnt            TYPE i                                   ,
            v_sent_all(1)    TYPE c                                   ,
            v_doc_data       LIKE sodocchgi1                          ,
            gd_error         TYPE sy-subrc                            ,
            gd_reciever      TYPE sy-subrc                            .
    DATA: p_email   TYPE somlreci1-receiver
                                 VALUE 'mail id here of the reciever'.
    *&   Variable for attachment name
    DATA: v_attach(12).
    *&   Internal table to get data from apqi table
    table here
    DATA: ws_line TYPE slis_listheader.
    DATA: it_list_top_of_page TYPE slis_t_listheader.
    CONSTANTS : v_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    VARIABLE DECLARATION
    DATA: v_colpos        TYPE i.
    DATA: v_transcnt(10)  TYPE c,
          v_transcnte(10) TYPE c,
          v_transcntf(10) TYPE c,
          v_msgcnt(10)    TYPE c,
          v_qid(20)       TYPE c.
    DATA  v_tot_rec(3)    TYPE n.
    DATA :v_date(10) TYPE c,
          v_time(8) TYPE c .
    DATA: v_fromdate(10) .
    DATA: v_todate(10) .
    SELCTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-015.
    PARAMETERS:
    SELECTION-SCREEN END OF BLOCK blk1.
    AT SELCTION SCREEN
    AT SELECTION-SCREEN.
      IF p_dfrom IS INITIAL AND
         NOT p_dato IS INITIAL.
        MESSAGE e000(zp) WITH text-020.
      ENDIF.
    START OF SELECTION
    START-OF-SELECTION.
    *&  To get data from APQI table into internal table
      PERFORM populate_itab.
    **To Populate table with details to be entered into .xls file
      PERFORM build_xls_data_table.
    END OF SELECTION
    END-OF-SELECTION.
    *& To display ALV list when IT_APQI is not initial
      IF NOT it_apqi[] IS INITIAL.
    *&-- Send an Notification email
        PERFORM send_email .
    *&--To populate fields for ALV
        PERFORM build_fieldcat   .
        PERFORM build_eventcat   .
        PERFORM e04_comment_build  USING it_list_top_of_page[].
        PERFORM build_layout     .
        PERFORM build_sortcat    .
        PERFORM start_list_viewer.
      ELSE.
    *&-- If no record exists in IT_APQI internal table then message is displayed
        MESSAGE s000(zp) WITH text-021.
      ENDIF.
    FORMS **********************************
    populate itab here -
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  BUILD_EVENTCAT
    FORM build_eventcat .
      DATA: v_header(25) .
      CONCATENATE 'ZPIPY016' p_dfrom p_dato INTO v_header.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_eventcat[]
        EXCEPTIONS
          list_type_wrong = 1
          OTHERS          = 2.
      READ TABLE it_eventcat WITH KEY name = slis_ev_top_of_page
                                 INTO wa_eventcat.
      IF sy-subrc = 0.
        MOVE v_formname_top_of_page TO wa_eventcat-form.
        APPEND wa_eventcat TO it_eventcat.
      ENDIF.
    ENDFORM.                    " BUILD_EVENTCAT
    *&      Form  BUILD_LAYOUT
    FORM build_layout .
      ws_layout-no_keyfix           = 'X'.
      ws_layout-group_buttons       = 'X'.
      ws_layout-colwidth_optimize   = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  BUILD_SORTCAT
    FORM build_sortcat .
      CLEAR wa_sortcat.
      CLEAR v_colpos.
    ENDFORM.                    " BUILD_SORTCAT
    *&      Form  START_LIST_VIEWER
    FORM start_list_viewer .
      DATA: ws_pgm  LIKE sy-repid.
    *& To Display ALV list
      ws_pgm = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = ws_pgm
          is_layout          = ws_layout
          it_fieldcat        = it_fieldcat
          it_sort            = it_sortcat
          i_save             = 'A'
          it_events          = it_eventcat
        TABLES
          t_outtab           = it_apqi
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    ENDFORM.                    " START_LIST_VIEWER
    *&      Form  BUILD_XLS_DATA_TABLE
    FORM build_xls_data_table .
      CLASS cl_abap_char_utilities DEFINITION LOAD.
      CONSTANTS: con_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
                 con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
    *& To populate it_attach table to be send as email.
      CONCATENATE 'Error of transaction SM35' ' '
         INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
    *& To gettotal number of error records
      DESCRIBE TABLE it_apqi LINES v_tot_rec .
      CONCATENATE  'Number of Errors  = '  v_tot_rec
                INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      CONCATENATE text-001
                  text-002
                  text-003
                  text-004
                  text-005
                  text-006
                  text-007
                  text-008
                  text-009
                  text-010
                  text-011
                  text-012
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
    *& To populate it_attach from it_apqi
      LOOP AT it_apqi INTO wa_apqi.
    *& To get the date format in DD/MM/YYYY
        WRITE wa_apqi-credate TO v_date  DD/MM/YYYY.
    *& To get time format in hh:mm:ss.
        v_time = wa_apqi-cretime.
        CONCATENATE  v_time(2) ':' v_time2(2) ':' v_time4(2) INTO v_time.
        v_transcnt  = wa_apqi-transcnt.
        v_transcnte = wa_apqi-transcnte.
        v_transcntf = wa_apqi-transcntf.
        v_msgcnt    = wa_apqi-msgcnt.
        v_qid       = wa_apqi-qid.
        CONCATENATE wa_apqi-groupid wa_apqi-creator
                         wa_apqi-qstate v_date
                         v_time wa_apqi-progid
                         wa_apqi-userid  v_transcnt
                         v_transcnte v_transcntf
                         v_msgcnt v_qid
                   INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach  .
        CLEAR   it_attach  .
        CLEAR:  v_transcnt ,
                v_transcnte,
                v_transcntf,
                v_msgcnt   ,
                v_qid      ,
                v_date     ,
                v_time     .
      ENDLOOP.
    ENDFORM  .                    " BUILD_XLS_DATA_TABLE
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
    FORM populate_email_message_body .
      REFRESH it_message.
      it_message = 'message here'.
      APPEND it_message.
      CLEAR it_message.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    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.
      v_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      v_doc_data-obj_langu = sy-langu.
      v_doc_data-obj_name  = 'SAPRPT'.
      v_doc_data-obj_descr = ld_mtitle .
      v_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR v_doc_data.
      READ TABLE it_attach INDEX v_cnt.
      v_doc_data-doc_size =
         ( v_cnt - 1 ) * 255 + STRLEN( it_attach ).
      v_doc_data-obj_langu  = sy-langu.
      v_doc_data-obj_name   = 'SAPRPT'.
      v_doc_data-obj_descr  = ld_mtitle.
      v_doc_data-sensitivty = 'F'.
      CLEAR it_attachment.
      REFRESH it_attachment.
      it_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      APPEND it_packing_list.
    Create attachment notification
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  ld_format.
      it_packing_list-obj_descr  =  ld_attdescription.
      it_packing_list-obj_name   =  ld_attfilename.
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
    Add the recipients email address
      CLEAR it_receivers.
      REFRESH it_receivers.
      it_receivers-receiver = ld_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      APPEND it_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = v_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                = v_sent_all
        TABLES
          packing_list               = it_packing_list
          contents_bin               = it_attachment
          contents_txt               = it_message
          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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT it_receivers.
        ld_receiver = it_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  SEND_EMAIL
    FORM send_email .
    Populate message body text
      PERFORM populate_email_message_body.
      PERFORM send_file_as_email_attachment
                                   TABLES it_message
                                          it_attach
                                    USING p_email
                                          'Error Sessions from SM35'
                                          'XLS'
                                          'filename'
                                          v_attach
                                 CHANGING gd_error
                                          gd_reciever.
    ENDFORM.                    " SEND_EMAIL
    *&      Form  E04_COMMENT_BUILD
          text
         -->E04_LT_TOP_OF_PAGE  text
    FORM e04_comment_build USING lt_top_of_page TYPE slis_t_listheader.
      CLEAR: v_fromdate,
             v_todate.
      WRITE p_dfrom TO v_fromdate  DD/MM/YYYY.
      WRITE p_dato TO  v_todate    DD/MM/YYYY.
    *& To write header in ALV list
    *& Program name
      CLEAR ws_line.
      ws_line-typ  = 'H'.
      ws_line-info = text-016.
      APPEND ws_line TO lt_top_of_page.
      CLEAR ws_line.
      ws_line-typ  = 'S'.
      ws_line-key = text-018.
      ws_line-info = v_tot_rec.
      APPEND ws_line TO lt_top_of_page.
    *& Date from
      CLEAR ws_line.
      ws_line-typ  = 'S'.
      ws_line-key  = text-050.
      ws_line-info = v_fromdate.
      APPEND ws_line TO lt_top_of_page.
    *& Date to
      CLEAR ws_line.
      ws_line-typ  = 'S'.
      ws_line-key  = text-051.
      ws_line-info = v_todate.
      APPEND ws_line TO lt_top_of_page.
    ENDFORM.                    "E04_COMMENT_BUILD
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
    *& To write Heading in Top of page
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_list_top_of_page.
    ENDFORM.                    "TOP_OF_PAGE
    thanks

  • Mail Sending with attachement

    Hello,
    I have one Modulepool having Z Transaction which sends the mail through workflow.
    I have created a task and bussiness object.
    Using FM SAP_WAPI_START_WORKFLOW to send the workitem in SAP inbox.
    That is attached to a standard Transaction CJ20n.
    I added the CC for sending mail.
    But if one user double click, then the WI will trrigerred and workflow completed and the second will not b able to c the WI.
    I want to send the mail to the second user with that T Code as Attachment.
    How to do this.
    Please Help.
    With Regards,
    Nitin Malhotra

    Here's how I do it, without attachments though (names, users, and servers changed):
    connect system/******@mydb as sysdba
    alter system set smtp_out_server='MAIL.k12.sd.us' SCOPE=BOTH;
    @I:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utlmail.sql;
    @I:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\prvtmail.plb;
    GRANT execute ON utl_mail TO USER1;
    connect USER1/******@mydb;
    CREATE OR REPLACE PROCEDURE USER1.E_MAIL_MESSAGER IS
    vSender VARCHAR2(30) := '[email protected]';
    vRecip VARCHAR2(30) := '[email protected]';
    vSubj VARCHAR2(50) := 'TCHNAME_STUDENTS_INSERT';
    vMesg VARCHAR2(4000):='TCHNAME_STUDENTS SUCCESSFUL';
    vMType VARCHAR2(30) := 'text/plain; charset=us-ascii';
    BEGIN
    utl_mail.send(vSender, vRecip, NULL, NULL, vSubj,vMesg, vMType,
    NULL);
    END E_MAIL_MESSAGER;
    Rem Now to call the procedure to run it:
    exec E_MAIL_MESSAGER;

  • PayloadZIPBean with Mail Package... is it possible?

    Hi,
    In proxy to file scenario, I send mails from PI with data received from proxy as attachment. I also need to zip the attachment.
    I will be getting the email address dynamically, hence I should use Mail Package with 'Keep Attachments' option. Now the problem is if I use mail package since the <content> tag data is taken as mail attachment, can I use PayloadZipBean in receiver mail adapter to zip the attachemnt?
    I tried using the follwoing adapter module in receiver mail mail adapter but ended with an error.
    Module Name: AF_Modules/PayloadZipBean                             Module Key: zip
    Module Config:
    zip             zip.filenameKey                   payloadName
    zip             zip.mode                              zipOne
    Error:
    org.xml.sax.SAXParseException: Content is not allowed in prolog
    Regards,
    Sreedhar

    Hi Sreedhar,
        Have you looked at this help link?
    http://help.sap.com/saphelp_nwpi711/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm
    Also see :
    Zip Payload using PayloadZipBean Module Processor
    Regards,
    Ravi Kanth Talagana
    Edited by: Ravi Kanth Talagana on Oct 22, 2009 5:13 PM

  • Can SAP send e-mail to external mail with attached file?

    Hi ABAP Guru.
    Can SAP send the E-Mail to external mail server? (e.g. Hotmail, Yahoo and so on.)
    And Can the E-Mail sent with attached file?
    And How to do that?
    Please give me your advice.
    Thank you and Best Regard,
    Nattapash C.

    Thank you very much! Amit Gujargoud.
    And I'm so sorry for my question that not clear for you and everyone.
    What I need to know is How to do with ABAP Code.
    I found the Function Module
    'SO_DOCUMENT_REPOSITORY_MANAGER' with method 'SEND' is being used for my case.
    but I don't know what field of structure RECIPIENTS (Table parameter of this Func. Module) that used for define recipient's E-Mail Address.
    Does anyone know the field or Have any method to solved my case?
    Please give me your advice.
    Thank you and Best regard.
    Nattapash C.

  • Sending mails with attachements

    I am using Forms and Reports 6i
    I found some examples.
    Now I am able to create mail message with attachement and send it with Outlook mail client.
    But I have 2 problems...
    1) in my code I use
    OutlookApp := OLE2.CREATE_OBJ('Outlook.Application');
    But I would like to execute default mail client (for example Mozilla Thunderbird), not only Outlook.
    2) if I create new message a display it, the message format is RTF. Can I change message format to HTML or plain-text?
    When I execute only preview of some report, there is a button with "letter". And this button execute some action, which is the action that I need. It opens default mail client, create new message and add report as attachement into it.
    I would like to create similar action, but I will attach reports in PDF.
    Is there any solution?
    My code is:
    DECLARE
    OutlookApp OLE2.OBJ_TYPE;
    NameSpace OLE2.OBJ_TYPE;
    mailItem OLE2.OBJ_TYPE;
    OLEPARAM OLE2.LIST_TYPE;
    Send OLE2.OBJ_TYPE;
    Attachments OLE2.OBJ_TYPE;
    Attachment_dummy OLE2.OBJ_TYPE;
    var1 varchar2(200);
    Begin
    var1 := 'Test message from REports';
    OutlookApp := OLE2.CREATE_OBJ('Outlook.Application');
    OLEPARAM := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(OLEPARAM,'MAPI');
    NameSpace := OLE2.INVOKE_OBJ(OutlookApp,'GetNameSpace',OLEPARAM);
    OLE2.DESTROY_ARGLIST(OLEPARAM);
    OLEPARAM := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(OLEPARAM,0);
    mailItem := OLE2.INVOKE_OBJ(OutlookApp,'CreateItem',OLEPARAM);
    OLE2.DESTROY_ARGLIST(OLEPARAM);
    OLE2.SET_PROPERTY(mailItem,'To','[email protected]');
    OLE2.SET_PROPERTY(mailItem,'Subject','Sample message from forms');
    OLE2.SET_PROPERTY(mailItem,'Body', 'Hi'||var1);
    --add an attachment
    Attachments := OLE2.GET_OBJ_PROPERTY(mailItem,'Attachments');
    OLEPARAM := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(OLEPARAM,'c:\temp\temp.pdf');
    Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);
    OLE2.DESTROY_ARGLIST(OLEPARAM);
    OLE2.INVOKE(mailItem,'Display');
    --destroy objects
    OLE2.RELEASE_OBJ(mailItem);
    OLE2.RELEASE_OBJ(NameSpace);
    OLE2.RELEASE_OBJ(OutlookApp);
    END;

    I'm writing a voice recorder for iPhone. I would like to give the possibility to send recorder files via mail...

Maybe you are looking for