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;

Similar Messages

  • 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

  • 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>

  • 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 Unicode enabled text in the attachment

    hi,
    i have a specific requirement for JAPAN country. its as follows:
    i am retrieving delivery details into my program & i need to send them as in a mail attachment(as CSV file) to particular mail id.
    for sending mail, i am using the function module "SO_NEW_DOCUMENT_ATT_SEND_API1".
    here is my problem :
    as this program will be used by JAPAN people, some of the delivery details are stored in Japanese (text like Customer name,street address etc..)
    .so when i am trying to send it as attachment these japanese text is not appearing correctly in the mail attachment. its appearing as Junk characters.
    i observed here the problem is may be because these Texts are not sending with UNICODE format. may be the default format is ASCII, which can not
    interpret Japanese text properly.
    so pl let me know is there any new function module where we can mention the Encoding format like UNICODE ?? or can i use the
    same above mentioned function module with providing this UNICODE value somewhere....
    regards
    srikanth,Intelligroup.
    Message was edited by: Srikanth Kidambi

    Hi,
    Check the answer from xiaoming cai in this thread:
    Send mails with attachment to external email id
    Eddy

  • JavaMail hangs up does not send mail nor throws exception when sending with attachment.

    So basically i have a problem that has been reported, but none of the answers solved in my case.
    I'm trying to send a mail with attachment using java mail, and it hangs in the transport.Send without sending an exception.
    I've put the debug to true to try to understand what's going on and the result that i get is this:
    DEBUG: not loading system providers in <java.home>/lib
    DEBUG: not loading optional custom providers file: /META-INF/javamail.providers
    DEBUG: successfully loaded default providers
    DEBUG: Tables of loaded providers
    DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.S  MTPSSLTransport,Sun Microsystems, Inc],  com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.
    SMTPTransport,Sun Microsystems, Inc],  com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLSto  re,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLSto re,Sun M
    icrosystems, Inc],  com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun   Microsystems, Inc],  com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun   Microsystems, Inc]}
    DEBUG: Providers Listed By Protocol:   {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems,   Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems,   Inc], smtps=javax.mail.Provider[TRANSPORT,
    smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc],  pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc],  pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems,   Inc], smtp=java
    x.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
    DEBUG: not loading optional address map file: /META-INF/javamail.address.map
    i've tried set the both connection timeout proprieties to 5000 but it stil does nott generate an exception. i've tried to chage the try catch block to catch Exception rather than MessagingException but it still does not generate an exception.
    So i have another environment where using the same mail server and code it is working and i.ve generated the debug message and the next message is
    DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
    I don't understand why it blocks here and why this message is not shown. i don't think its a connection problem. maybe a configuration issue, so i'm triyng to understand whats going wrong.
    Any help would be appreciated. Thanks.

    Based on the debug output, you're using a very old version of JavaMail.  You should consider upgrading.
    The debug output shows no attempt to connect to any server, so it appears that something is going wrong even before then.
    If the program is really blocked, try to get a stack trace showing where it's blocked.
    Also, try catching Throwable to make sure you're not missing some kind of unexpected failure.
    Do you have a standalone application, or is it running in some sort of application server?
    What version of the JDK are you using?

  • Mail Sender Adapter - Attachment Handling

    Hello,
    I 'm using XI 3.0 SP 14.
    I have problems with my Mail-Sender-Adapter.
    The mails, I fetch, have an xml-attachment which
    represents an IDOC-structure (ORDERS.ORDERS05).
    I want to sent this attachment as payload to an SAP-System.
    The problem is now, that I have 2 Payloads (SXMB_MONI).
    One for the normal email-body and one for my original
    xml-attachment. See below:
    - <SAP:Payload xlink:href="cid:[email protected]">
      <SAP:Name>MailMessage</SAP:Name>
      <SAP:Description>mail message</SAP:Description>
      <SAP:Type>Application</SAP:Type>
      </SAP:Payload>
    - <SAP:Payload xlink:href="cid:[email protected]">
      <SAP:Name>MailAttachment-1</SAP:Name>
      <SAP:Description>mail attachment</SAP:Description>
      <SAP:Type>ApplicationAttachment</SAP:Type>
      </SAP:Payload>
      </SAP:Manifest>
      </SOAP:Body>
    The XI Runtime Workbench (SXMB_MONI) takes (in my case)
    the wrong one (email-body-attachment) and gives me
    an parsing error. (Error occurs at my IDOC-Receiver-Adapter)
    Now my question:
    Can I remove the email-body-attachment, so that
    the further processing works with my xml-attachment?
    Or how can I resolve my problem.
    best regards
    Marcel Reichert

    Hi Marcel,
    use the PayloadSwapBean module to get the attachment as main payload.
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
    As parameters use:
    swap.keyName = payload-name
    swap.keyValue = MailAttachment-1
    Regards
    Stefan

  • 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 mail sender adapter attachment mapping.

    I have created a MAIL->XI->RFC scenario.
    I have configured sender mail adapter with XIPAYLOAD message protocol.
    I have created RFC function which need an attachment as an input parameter.
    When I send an email with attachment, my mail adapter separates the input message into MailMessage and MailAttachment payloads. I can do mapping of the MailMessage payload but I need map the attachments to as input parameters of RFC function.
    I have read several webblogs about this problem. But I can not use them in this scenario. I have found one webblog with description of MessageTrasferBean  module and XSL mapping directli on adapter module but I am not familiar with XLST mapping and did not know how to use it to transform the attachments.
    Any help will be appritiated.
    Thanx
    Peter

    Hi,
    Am trying the same scenario as you did.
    Can you guide me step by step how to read , validate and extract data from attachment.
    Am stucked in reading the attachment now.
    I can able to get mail but not attachment.
    Can you tell the steps that you did.
    Thanks in advance,
    Sakthi

  • 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

  • E-mail sending with progress bar

    OK so I have a application that allows the user to send an e-mail with multiple attachments. It works fine but I want to add a progress bar - when the user clicks SEND, a new window should pop-up with a progress bar and a OK button after the mail has been successfuly sent.
    Any ideas how to accomplish this?
    Mail sending is handled by this class and is called from a frame:
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.FileDataSource;
    import javax.activation.DataHandler;
    import java.util.Properties;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.Vector;
    import java.io.File;
    import java.io.*;
    public class Mailer implements Runnable {
    boolean success = false;
    String sendToAddress, ccAddress, sendFromAddress,
    subject, messageText, filename, smtpServer;
    mainFrame2 frame;
    public Mailer(String sendToAddress, String ccAddress, String sendFromAddress, String subject, String messageText, String filename,
    String smtpServer, mainFrame2 frame)
    this.sendToAddress = sendToAddress;
    this.ccAddress = ccAddress ;
    this.sendFromAddress = sendFromAddress;
    this.subject = subject;
    this.messageText = messageText ;
    this.filename = filename;
    this.smtpServer = smtpServer ;
    this.frame = frame;
    public void run() {  
    sendMail();
    public void sendMail() {
    Properties props = System.getProperties();
    props.put("mail.smtp.host", smtpServer);
    Session session = Session.getInstance(props, null);
    MimeMessage msg = new MimeMessage(session);
    Multipart mp = new MimeMultipart();
    BodyPart body = new MimeBodyPart();
    BodyPart attachment = new MimeBodyPart();
    try {
    msg.setFrom(new InternetAddress(sendFromAddress));
    msg.setRecipient(javax.mail.Message.RecipientType.TO,
    new InternetAddress(sendToAddress));
    if(ccAddress.length()>3)
    msg.setRecipient(javax.mail.Message.RecipientType.CC, new InternetAddress(ccAddress));
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    msg.addHeaderLine("MIME-Version: 1.0");
    msg.addHeaderLine("Content-type: text/html; charset=\"windows-1251\"");
    body.setText(messageText);
    FileDataSource fds = new FileDataSource(new File(filename));
    DataHandler dh = new DataHandler(fds);
    attachment.setDataHandler(dh);
    attachment.setFileName(filename.substring(filename.lastIndexOf("\\", filename.length())+1));
    mp.addBodyPart(body);
    mp.addBodyPart(attachment);
    // this here is for the attachments, I've already collected them into a Vector
    for(int i=0; i < frame.attachedFiles.files.size(); i++)
    int chertichka = frame.attachedFiles.files.get(i).toString().lastIndexOf("\\");
    String ime = frame.attachedFiles.files.get(i).toString().substring(chertichka+1);
    BodyPart attachment1 = new MimeBodyPart();
    FileDataSource fds1 = new FileDataSource(new File(frame.attachedFiles.files.get(i).toString()));
    DataHandler dh1 = new DataHandler(fds1);
    attachment1.setDataHandler(dh1);
    attachment1.setFileName(ime);
    mp.addBodyPart(attachment1);
    turgData.doc_to_attach = "";
    msg.setContent(mp);
    Transport.send(msg);
    } catch (MessagingException e) {
    e.printStackTrace();
    success = true;
    public static boolean isEmailAddress(String text)
    if(text.indexOf(" ")>-1) return false;
    int kliomba = text.indexOf("@");
    int dotCom = text.lastIndexOf(".");
    if(kliomba < 2 || kliomba >(text.length()-4)) return false;
    else if(dotCom > (text.length()-2)) return false;
    else return true;
    public boolean isSent()
    return success;
    Please provide some code on how to put a progress bar in a pop-up window after the user clicks SEND. Also, the send button should be disabled until the mail has been sent.
    PLZ help me out ;)))

    Hi,
    Check the links for Email Adapter,If u want to send the Attachment then give me ur mail id i will send you one doc which will explain u how to send Email in Attachment.
    Receiver Mail Adapter.
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    /people/community.user/blog/2006/09/07/email-reporting
    /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    eMail Reporting
    /people/community.user/blog/2006/09/07/email-reporting
    Regards,
    Phani
    Reward points if Helpful

  • E-Mail sending with payload field in the topic and / or in the body

    Hello all,
    I have follow question:
    For a project, we need follow functionallity:
    If we get a Purchase Oder Message into the SAP XI for the customer:
    1.) XI have generating an E-Mail, which the topic contains the Order Number, or in the
    body of the E-Mail is a list which contains all Order - Numbers from the Message.
    2.) If we send the E-Mail, a attachment shouldn't be necessary.
    Can somebody help me ?
    Thanks
    Kind regards
    Stephan

    Hi,
    Check the links for Email Adapter,If u want to send the Attachment then give me ur mail id i will send you one doc which will explain u how to send Email in Attachment.
    Receiver Mail Adapter.
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    /people/community.user/blog/2006/09/07/email-reporting
    /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    eMail Reporting
    /people/community.user/blog/2006/09/07/email-reporting
    Regards,
    Phani
    Reward points if Helpful

  • Mail sending with subject and attachment

    hai all,
           my requiremnet is i want to send a mail with a body and pdf attachemnt , but with the below code iam able to send both as attachment , but how to send along with body.
    *& Report  ZV_TEST                                                     *
    Report  ZV_TEST no standard Page heading line-size 200.
    Tables: Pa0105,
            pernr,
            QPPNP,
            HRPY_RGDIR,
            SSCRFIELDS,
            pa0002.
    Constants
    constants:
    begin of F__LTYPE, "type of line
    CMD like PC408-LTYPE value '/:', "command
    TXT like PC408-LTYPE value 's', "textline
    end of F__LTYPE.
    constants:
    begin of F__CMD, "commands
    NEWPAGE like PC408-LINDA value '<NEW-PAGE>',
    end of F__CMD.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    Data Declaration
    DATA:Begin of Itab occurs 0,
           pernr like HRPY_RGDIR-PERNR,
           SEQNR like HRPY_RGDIR-SEQNR,
           PAYSLIP_VARIANT like BAPI7004-PAYSLIP_VARIANT,
         end of itab.
    data: P_INFO like PC407,
          P_INFO1 like PC407,
          P_FORM like PC408 occurs 0 with header line,
          P_P_FORM like PC408 occurs 0 with header line,
          RETURN like BAPIRETURN1 occurs 0 with header line,
          PAY_VAR like BAPI7004-PAYSLIP_VARIANT value 'ESS_PAYSLIPS' ,
          P_LIST like ABAPLIST occurs 1 with header line,
          P_IDX type I.
    data: begin of P_INDEX occurs 0,
            INDEX type I,
          end of P_INDEX.
    data: OBJBIN like SOLISTI1 occurs 10 with header line,
          DOCDATA like SODOCCHGI1,
          OBJTXT like SOLISTI1 occurs 10 with header line,
          OBJPACK like SOPCKLSTI1 occurs 1 with header line,
          RECLIST like SOMLRECI1 occurs 1 with header line,
          OBJHEAD like SOLISTI1 occurs 1 with header line,
          TAB_LINES type I,
          ATT_TYPE like SOODK-OBJTP.
    data: PDF_TAB like TBL1024 occurs 0 with header line,
          OTF_TAB like TBL1024 occurs 0 with header line.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    data: PDF_CONTENT TYPE XSTRING,
          PDF_FSIZE   TYPE I.
    data: error        TYPE sysubrc.
    DATA: v_dest LIKE tsp01-rqdest,
          v_handle LIKE sy-tabix,
          v_spool_id LIKE tsp01-rqident,
          v_rc TYPE c,
          v_errmessage(100) TYPE c,
          v_text(70) TYPE c.
    data: PAYSLIP     LIKE     BAPI7004_PAYSLIP occurs 0 with header line.
    Data: v_index like sy-index value 1.
    Data: Begin of I_Sent occurs 0,
            pernr like pernr-pernr,
            name(20),
            usrid_long like pa0105-usrid_long,
            Status(3),
          End of I_sent.
    Data: Begin of I_NSent occurs 0,
             pernr like pernr-pernr,
            usrid_long like pa0105-usrid_long,
          End of I_Nsent.
    DATA: I_FCODE TYPE TABLE OF sy-ucomm.
    data: v_text1(255),
          v_text2(255),
          v_text3(255).
    data: month_names like T247 occurs 0 with header line,
          v_month(2) type c.
    ***********************Selection Screen********************
    selection-screen Begin of Block b2 WITH FRAME TITLE TEXT-BL1 .
    Parameters: P_Print type c default 'X' radiobutton group g1
                                          user-command CMD,
                P_DISP  Type C  Radiobutton Group g1.
    Selection-screen end of Block b2.
    selection-screen Begin of Block b1 WITH FRAME TITLE TEXT-BL2 .
    Recipient address and Period
    SELECT-OPTIONS :   s_name   FOR PERNR-PERNR Modif id M1,
                       s_period for HRPY_RGDIR-FPPER Modif id M1.
                      s_year for QPPNP-PABRJ Modif id M1.
    SELECT-OPTIONS:    p_num    FOR PERNR-PERNR Modif id M2 .
    Selection-screen end of Block b1.
    *SELECTION-SCREEN FUNCTION KEY 1.
    *SELECTION-SCREEN PUSHBUTTON /10(20) CHARLY USER-COMMAND ABCD.
    ***********************At Selection Screen Output**************
    at selection-screen output.
      Loop at screen.
        if P_Print = 'X'.
          if screen-group1 = 'M2'.
            screen-active = 0.
          endif.
        else.
          if screen-group1 = 'M1'.
         if screen-name = 'S_NAME-LOW' Or screen-name = 'S_PERIOD'.
            screen-active = 1.
          endif.
        Endif.
        Modify Screen.
      Endloop.
    ***********************INITIALIZATION********************
    INITIALIZATION.
    MOVE 'Preview' TO SSCRFIELDS-FUNCTXT_01.
    MOVE 'Preview' TO CHARLY.
      p_print = 'X'.
    v_text1 =
    'Please find enclosed your salary slip for the month of Apr 2006 as
    *attachment. This is confidential '.
    ***********************AT SELECTION-SCREEN******************
    AT SELECTION-SCREEN.
    if p_print = 'X'.
       if s_name[] is initial.
          message e000(8i) with 'Make Entry into Personal Number Field'.
       endif.
    else.
       if p_num[] is initial.
          message e000(8i) with 'Make Entry into Personal Number Field'.
       endif.
    endif.
    ***********************Start-of-Selection********************
    Start-of-Selection.
      if p_print = 'X'.
        APPEND 'NEXT' TO i_fcode.
        APPEND 'PREV' TO i_fcode.
        set pf-status 'ZHRF' excluding I_FCODE.
        Perform Get_values.
       Perform Print using v_index.
        perform Write_Values.
      else.
        set pf-status 'ZHRF'.
      Perform Get_values.
        Perform Print using v_index.
      endif.
    ***********************Top-of-page***************************
    Top-of-page.
      skip 2.
      if p_print = 'X'.
        write:50 'The Pay Slip Sent details'.
        skip 1.
        uline at 1(70).
        write :/ sy-vline,2 'Personal Number',18 sy-vline,
                         19 'Name',40 sy-vline,
                         41 'User Mail-Ids',63 sy-vline,
                         64 'Status',70 sy-vline.
        ULINE /1(70).
      endif.
      set left scroll-boundary Column 0.
    *&      Form  Get_values
          text
    -->  p1        text
    <--  p2        text
    FORM Get_values .
      select  *
              from HRPY_RGDIR
              into corresponding fields of table itab
              where PERNR in s_name
              AND
              FPPER IN S_PERIOD.
      if sy-subrc eq 0.
        loop at itab.
          Create receiver list
          refresh RECLIST.
          clear RECLIST.
          select single *
                        from PA0105
                        where PERNR eq ITAB-PERNR
                          and USRTY eq '0010'.
          if SY-SUBRC <> 0.
            I_sent-PERNR = ITAB-PERNR.
            i_sent-status = 'NO'.
            select single *
                          from pa0002
                          where pernr eq itab-pernr.
            concatenate pa0002-VORNA pa0002-NACHN into i_sent-name
                                             separated by space.
            append i_Nsent.
            continue.
          else.
            refresh reclist.
            RECLIST-RECEIVER = pa0105-usrid_long.
            translate RECLIST-RECEIVER to lower case.
            RECLIST-REC_TYPE = 'U'.
            append RECLIST.
          endif.
          call function 'GET_PAYSLIP'
            EXPORTING
              EMPLOYEE_NUMBER = itab-PERNR
              SEQUENCE_NUMBER = itab-SEQNR
              PAYSLIP_VARIANT = PAY_VAR
            IMPORTING
              RETURN          = RETURN
              P_INFO          = P_INFO
            TABLES
              P_FORM          = P_FORM.
          loop at P_FORM
              where LINDA eq F__CMD-NEWPAGE
              and LTYPE eq F__LTYPE-CMD.
            P_INDEX-INDEX = SY-TABIX.
            append P_INDEX.
          endloop.
          P_IDX = 1.
          refresh P_P_FORM.
          append lines of P_FORM from P_IDX to P_INDEX-INDEX
          to P_P_FORM.
          P_IDX = P_INDEX-INDEX.
          export P_P_FORM to memory id '%%_P_FORM_%%'.
          export P_INFO to memory id '%%_P_INFO_%%'.
          submit RPCEDT_LIST_TO_MEMORY exporting list to memory and return.
          call function 'LIST_FROM_MEMORY'
            TABLES
              LISTOBJECT = P_LIST.
          call function 'TABLE_COMPRESS'
            TABLES
              IN     = P_LIST
              OUT    = OBJBIN
            EXCEPTIONS
              others = 1.
          Read table RECLIST index 1.
          I_sent-PERNR = ITAB-PERNR.
          i_sent-usrid_long = RECLIST-RECEIVER.
          select single *
                        from pa0002
                        where pernr eq itab-pernr.
          concatenate pa0002-VORNA pa0002-NACHN into i_sent-name
                                           separated by space.
          i_sent-status = 'YES'.
          append i_sent.
         concatenate ' Payslip-'  '(' ITAB-PERNR+4(4) ')'
        into DOCDATA-OBJ_DESCR.
          CALL FUNCTION 'MONTH_NAMES_GET'
           EXPORTING
             LANGUAGE                    = SY-LANGU
            TABLES
              MONTH_NAMES                 = month_names
           EXCEPTIONS
             MONTH_NAMES_NOT_FOUND       = 1
             OTHERS                      = 2
          IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
         if sy-datum+4(2)  = '01'.
            v_month = '12'.
         else.
            v_month = sy-datum+4(2) - 1.
         endif.
         read table month_names with key mnr = v_month.
         concatenate 'Salary Slip for the month of' month_names-LTX
                      sy-datum+0(4) '-' i_sent-name
                      into DOCDATA-OBJ_DESCR.
          DOCDATA-OBJ_NAME = 'Pay Slip'.
          DOCDATA-OBJ_LANGU = SY-LANGU.
          OBJTXT = 'Dear Mr.'.
          concatenate OBJTXT i_sent-name into objtxt.
          append OBJTXT.
          append initial line to objtxt.
          OBJTXT = 'Please find enclosed your salary slip for the month of'.
          concatenate OBJTXT month_names-LTX sy-datum+0(4)
                                      into objtxt separated by space.
           append OBJTXT.
    OBJTXT =
    'as attachment This is confidential document and not be disclosed'.
          append OBJTXT.
    OBJTXT =
    'shared with any other employee.In case of any queries on this subject'.
    append OBJTXT.
    OBJTXT =
    'you are requested to contact the Payroll administrator “Sabitha” '.
    OBJTXT = 'email:[email protected]'.
    append OBJTXT.
    append initial line to objtxt.
    append initial line to objtxt.
    OBJTXT = 'With Kind Regards'.
    append OBJTXT.
    append initial line to objtxt.
    append initial line to objtxt.
    OBJTXT = 'Sabitha'.
    append OBJTXT.
    OBJTXT = 'Payroll Administrator'.
    append OBJTXT.
    OBJTXT = 'Enteg Infotech Pvt Lyd.'.
    append OBJTXT.
    OBJTXT = 'Banaglore'.
    append OBJTXT.
          Write Packing List (Main)
           describe table objtxt.
           read table OBJTXT index sy-tfill.
          DOCDATA-DOC_SIZE = ( sy-tfill - 1 ) * 255 + strlen( OBJTXT ).
          clear OBJPACK-TRANSF_BIN.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = sy-tfill.
          OBJPACK-DOC_TYPE = 'TXT'.
          append OBJPACK.
    Create Message Attachment
    Write Packing List (Attachment)
          ATT_TYPE = 'ALI'.
          describe table OBJBIN lines TAB_LINES.
          read table OBJBIN index TAB_LINES.
          OBJPACK-DOC_SIZE =
          ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
          OBJPACK-TRANSF_BIN = 'X'.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = TAB_LINES.
          OBJPACK-DOC_TYPE = ATT_TYPE.
          OBJPACK-OBJ_NAME = 'ATTACHMENT'.
          OBJPACK-OBJ_DESCR = 'Payslip'.
          append OBJPACK.
    Send the document
          call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            EXPORTING
              DOCUMENT_DATA              = DOCDATA
              PUT_IN_OUTBOX              = ''
              COMMIT_WORK                = 'X'
            TABLES
              PACKING_LIST               = OBJPACK
              OBJECT_HEADER              = OBJHEAD
              CONTENTS_BIN               = OBJBIN
              CONTENTS_TXT               = OBJTXT
              RECEIVERS                  = 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.
        endloop.
      endif.
    ENDFORM.                    " Get_values
    *****************************At User Command*************************
    at User-Command.
      case Sy-ucomm.
        When 'NEXT'.
          describe table itab.
          if sy-tfill GT v_index.
            v_index = v_index + 1.
            Perform Print using v_index.
          else.
            message E000(8i) with 'You Have Reached the Last Entry'.
          endif.
        When 'PREV'.
          if v_index LE 1.
            Message E000(8i) with 'You Have Reached the First Entry'.
          else.
            v_index = v_index - 1.
            Perform Print using v_index.
          endif.
        When 'BACK'.
          leave to screen 0.
        WHen 'EXIT'.
          set Screen 0.
          leave screen.
      Endcase.
    *&      Form  Print
          text
    -->  p1        text
    <--  p2        text
    FORM Print using v_index.
      if v_index = 1.
        select  *
               from HRPY_RGDIR
               into corresponding fields of table itab
               where PERNR in P_num
      endif.
      if not itab[] is initial.
        sort itab by pernr .
        read table itab index v_index.
        select single *
                      from PA0105
                      where PERNR eq ITAB-PERNR
                        and USRTY eq '0010'.
        call function 'GET_PAYSLIP'
          EXPORTING
            EMPLOYEE_NUMBER = itab-PERNR
            SEQUENCE_NUMBER = itab-SEQNR
            PAYSLIP_VARIANT = PAY_VAR
          IMPORTING
            RETURN          = RETURN
            P_INFO          = P_INFO
          TABLES
            P_FORM          = P_FORM.
        loop at P_FORM
            where LINDA eq F__CMD-NEWPAGE
            and LTYPE eq F__LTYPE-CMD.
          P_INDEX-INDEX = SY-TABIX.
          append P_INDEX.
        endloop.
        P_IDX = 1.
        refresh P_P_FORM.
        append lines of P_FORM from P_IDX to P_INDEX-INDEX
        to P_P_FORM.
        P_IDX = P_INDEX-INDEX.
           export P_P_FORM to memory id '%%_P_FORM_%%'.
           export P_INFO to memory id '%%_P_INFO_%%'.
      IMPORT P_P_FORM FROM MEMORY ID '%%_P_FORM_%%'.
      IMPORT P_INFO FROM MEMORY ID '%%_P_INFO_%%'.
        new-page                                                "VKIK008647
        line-size p_info-pcols
        line-count p_info-psize
        no-title
        no-heading.
        SET BLANK LINES ON.
        LOOP AT P_P_FORM.
          if sy-tabix lt 20.
            NEW-LINE NO-SCROLLING.
          endif.
          CASE P_P_FORM-LTYPE.
         WHEN F__LTYPE-TXT.
            WRITE:/ P_P_FORM-LINDA.
            WHEN F__LTYPE-CMD.
              IF P_P_FORM-LINDA EQ F__CMD-NEWPAGE.
                NEW-PAGE.
              ENDIF.
            WHEN others.
              hide: itab,v_index.
              WRITE:/ P_P_FORM-LINDA.
              if sy-tabix lt 20.
                NEW-LINE NO-SCROLLING.
              else.
                NEW-LINE SCROLLING.
              endif.
          ENDCASE.
        ENDLOOP.
        SET BLANK LINES OFF.
    v_index = 1.
      endif.
    ENDFORM.                    " Print
    *&      Form  Write_Values
          text
    -->  p1        text
    <--  p2        text
    FORM Write_Values .
      if p_print = 'X'.
        loop at i_sent.
          write :/ sy-vline,2 i_sent-pernr,18 sy-vline,
                            19 i_sent-name,40 sy-vline,
                            41 i_sent-usrid_long,63 sy-vline,
                            64 i_sent-status,70 sy-vline.
          ULINE /1(70).
        endloop.
      endif.
    ENDFORM.                    " Write_Values
    i want to send the contents of objtxt has body.
    cheers

    Hi,
    in the below code, BOLD Characters coming as body text in my mail.after that i am attaching V_LINE as the attachment.pl compare this with ur code.
    revert, if you need any clarifications.
    <b>*-populate body text</b>
      CONCATENATE <b>'Japan BOL details for the Delivery#'
                    V_VBELN
                   ',is attached'</b>               INTO WA_OBJTXT SEPARATED BY SPACE.
      APPEND WA_OBJTXT TO IT_OBJTXT.
    <b>*---- Append Date and Time into Body of email.</b>
      MOVE 'File is generated on'(004) TO V_INFO.
      V_TIME = SY-UZEIT.
    WRITE : SY-UZEIT TO V_TIME USING EDIT MASK '__:__:__'.
      CONCATENATE V_TIME+0(2)
                  V_TIME+2(2)
                  V_TIME+4(2)
                  INTO
                  V_TIME2 SEPARATED BY ':'.
       WRITE : sy-datum MM/DD/YYYY TO lv_date .
      CONCATENATE SY-DATUM+4(2)
                  SY-DATUM+6(2)
                  SY-DATUM+0(4)
                  INTO V_DATE.
      CONCATENATE <b>V_INFO
                  V_DATE
                  'At'
                  V_TIME2
                  INTO V_INFO</b>              SEPARATED BY SPACE.
      <b>WA_OBJTXT = V_INFO.</b>  APPEND WA_OBJTXT TO IT_OBJTXT.
    *-document size
      CLEAR : V_TABLE_LINES.
      DESCRIBE TABLE IT_OBJTXT LINES V_TABLE_LINES.
      READ TABLE IT_OBJTXT INTO WA_OBJTXT INDEX V_TABLE_LINES.
      X_DOC_CHNG-DOC_SIZE =
                     ( V_TABLE_LINES - 1 ) * 255 + STRLEN( WA_OBJTXT ).
    *-populate packing list for body text
    CLEAR IT_OBJPACK-TRANSF_BIN.
      WA_OBJPACK-HEAD_START = 1.
      WA_OBJPACK-HEAD_NUM = 0.
      WA_OBJPACK-BODY_START = 1.
      WA_OBJPACK-BODY_NUM = V_TABLE_LINES.
      WA_OBJPACK-DOC_TYPE = 'RAW'.
      APPEND WA_OBJPACK TO IT_OBJPACK.
      CLEAR WA_OBJPACK.
    *--for attachment
    *--add Internal table lines here, as attachment.
      WA_OBJBIN = V_LINE.
      APPEND WA_OBJBIN TO IT_OBJBIN.
      CLEAR  WA_OBJBIN.
    *-get total no.of lines of Object table(attachment)
      CLEAR : V_TABLE_LINES.
      DESCRIBE TABLE IT_OBJBIN LINES V_TABLE_LINES.
    *-populate object header
      CONCATENATE  'Delivery#'(005)
                     V_VBELN
                     SY-DATUM
                     V_TIME
                     INTO
                     WA_OBJHEAD SEPARATED BY SPACE.
      APPEND WA_OBJHEAD TO IT_OBJHEAD.
      CLEAR  WA_OBJHEAD.
    *-packing list for attachment
      WA_OBJPACK-TRANSF_BIN = C_X.
      WA_OBJPACK-HEAD_START = 1.
      WA_OBJPACK-HEAD_NUM = 1.
      WA_OBJPACK-BODY_START = 1.
      WA_OBJPACK-BODY_NUM = V_TABLE_LINES .
    WA_OBJPACK-DOC_TYPE = 'CSV' .
      WA_OBJPACK-DOC_TYPE = 'RAW' .
      WA_OBJPACK-OBJ_NAME = 'POTR'.
    CONCATENATE 'Delivery details for '(005)
      CONCATENATE TEXT-005
                V_VBELN
                SY-DATUM
                V_TIME
                '.CSV'
                INTO
                WA_OBJPACK-OBJ_DESCR SEPARATED BY SPACE.
      BREAK-POINT.
      WA_OBJPACK-DOC_SIZE = V_TABLE_LINES * 255.
      APPEND WA_OBJPACK TO IT_OBJPACK.
      CLEAR  WA_OBJPACK.

  • Send a file attached to a mail send with sendmail

    Hello,
    I'd like to send a report with a short mail to a mailing list. This task will be done every day by executing a ksh script.
    May I do it with sendmail ? how ?
    Is there another way to do it ?
    Thanks for your help.
    Ncg

    Sorry,
    question already posted on kernel Forum: "Command line mail - attachment"

Maybe you are looking for

  • HTTP 400 Bad Request

    Hello All, I'm up against a show stopper. I have a simple region (lets call it the "Quote Region") of type SQL Query that returns rows from a table which I will need tp update. Occasionally the query will return a large number of rows, depending on t

  • Extended notification framwork handler

    HI, Where i can get info about ENF handler ,i see that i can use there class in delivery. Any data about the handler and is capabilities will be welcome. Regards

  • How can we make a field confirm control compulsory field

    how can we make a field 'confirm control' compulsory field while creating a vendor code this field is under tab default data material tab while creating vendor code in purchasing org .part of vendor

  • Dynamically extracting SQL query costs/statistics at runtime

    Hi there, I need to measure the I/O cost (such as 'physical reads')of a SQL statement at runtime. What I'm looking to do is to test the total cost of a number of queries in a java program. So I need to get the cost automatically and add them up. Ther

  • Retiree site problems

    I have been trying to register at the AT&T Employee and Retiree Discount Self-Service Site for several days. The response is "Unfortunately, you have entered information that does not match our records and we are unable to confirm your eligibility."