Excel mail attachment in background execution

I want to send excel as mail attachment with 53 columns when exceute in background. But i_attach has 255 characters so its truncating more than 255 characters in header and values of excel.
so pls tel how to send attachment with all internal table contents.
Adding Attachment
      CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
        EXPORTING
          I_ATTACHMENT_TYPE    = C_EXT
          I_ATTACHMENT_SIZE    = L_SIZE
          I_ATTACHMENT_SUBJECT = 'Valid Standard Cost Estimate'
          I_ATT_CONTENT_TEXT   = I_ATTACH[].

Hi,
What extension are you using? Try 'BIN' Extension and remove the size parameter.
Also add it to the HEX table, not the text one.
          CALL METHOD lv_document->add_attachment
            EXPORTING
              i_attachment_type    = 'BIN'
              i_attachment_subject = lv_string
              i_att_content_hex    = lt_attach[]
              i_attachment_header  = lt_att_table[].
Thanks
Ernesto

Similar Messages

  • Field names Missing in the (Excel) Mail attachment

    Hi ,
    I am trying to send my ALV Grid Output as Excel Email attachment using the below code
    The problem is that the field names are missing in the receivers Mail.
    i.e
    *Name*   *Emp Code*   * Branch*         "this is missing
    abc         123                 ukp
    I searched many threads but unable to find the solution for this.
    Kindly suggest me regarding this issue.
    loop at p_eadd.
        if p_eadd-low <> space.
          clear reclist.
          reclist-rec_type = 'U'.  "Internet-adress
          reclist-receiver = p_eadd-low.
          reclist-express = 'X'.
          append reclist.
        endif.
      endloop.
    * endif.
    * Send the document
      call function 'SO_NEW_DOCUMENT_SEND_API1'
         exporting
              document_type              = 'RAW'
              document_data              = doc_chng
    *         PUT_IN_OUTBOX              = 'X'
         tables
              object_content             = objcont
              receivers                  = reclist
         exceptions
              too_many_receivers         = 1
              document_not_sent          = 2
              operation_no_authorization = 4
              others                     = 99.
      ld_aplstat = '4'.
      case sy-subrc.
        when 0.
          loop at reclist.
            if reclist-receiver = space.
              name = reclist-rec_id.
            else.
              name = reclist-receiver.
            endif.
            if reclist-retrn_code = 0.
              write: / name, ': succesfully sent'.
            else.
              write: / name, ': error occured'.
            endif.
          endloop.
          ld_aplstat = '0'.
        when 1.
          write: / 'Too many receivers specified !'.
        when 2.
          write: / 'No receiver got the document !'.
        when 4.
          write: / 'Missing send authority !'.
        when others.
          write: / 'Unexpected error occured !'.
      endcase.
    *.Tell workflow to go on
      clear ls_scma_event.
      ls_scma_event-wf_event = cs_wf_events-finished.
      ls_scma_event-wf_witem = wf_witem.
      ls_scma_event-wf_okey  = wf_okey.
      call function 'KPEP_MONI_CLOSE_RECORD'
        exporting
          ls_key        = gs_key
          ls_scma_event = ls_scma_event
        changing
          ld_aplstat    = ld_aplstat
        exceptions
          no_id_given   = 1
          others        = 2.
    call function 'SAP_CONVERT_TO_XLS_FORMAT'
          exporting
           i_field_seperator          = ' '
           i_line_header              = 'X'
            i_filename                 = p_file
    *   I_APPL_KEEP                = ' '
          tables
            i_tab_sap_data             = it_final
    * CHANGING
    *   I_TAB_CONVERTED_DATA       =
         exceptions
           conversion_failed          = 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.
    Thanks in Advance,
    Mr. Ben

    Hi Ben,
    Follow the code below....
    Your internal table it_final will have the attachment data. After you got the attachment data do the following
    gc_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
    lt_attachment        TYPE TABLE OF  solisti1 ,
    gt_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE,
      CLEAR:gs_attach.                      <this will have your attachment, declare a structure which contains fields of your  excel sheet>
    <before this you have to copy all the fields from your final internal table which should be attached to email to gs_attach>
    For attaching field names
        CONCATENATE gc_ret gs_attach INTO gs_attach.
        gs_attach = gs_attach+1.
        APPEND gs_attach TO gt_attach.
    CLEAR:lt_attachment.
          lt_attachment[] = gt_attach[].
    SORT  lt_attachment .
          DELETE ADJACENT DUPLICATES FROM lt_attachment COMPARING ALL FIELDS.
          CLEAR gs_attach.
          CONCATENATE <field names >
          INTO gs_attach SEPARATED BY gc_tab.
          INSERT gs_attach INTO lt_attachment INDEX 1.
    <field addition ends>
    call function 'SO_NEW_DOCUMENT_SEND_API1'
         exporting
              document_type              = 'RAW'
              document_data              = doc_chng
            PUT_IN_OUTBOX              = 'X'
         tables
              object_content             = objcont
              receivers                  = reclist
            contents_bin               = lt_attachment
         exceptions
              too_many_receivers         = 1
              document_not_sent          = 2
              operation_no_authorization = 4
        if sy-subrc  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    Regards,
    Aravind.

  • To Send HTML Format and excel file attachment  in same mail

    Dear All,
            Have requerment ,to send a mail options HTML table format and same data in excel file attachement.have capable to do the html format using methods BCS .but how to send excel format attachment in same  mail.
    Please guide me how to do it.
    Regards ,
    Santhu
    Edited by: santosh jajur on Apr 9, 2010 1:54 PM

    Santhosh,
    please check the code:
    report bcs_example_7.
    This report provides an example for sending an Excel
    attachment in Unicode Systems
    constants:
      gc_tab  type c value cl_bcs_convert=>gc_tab,
      gc_crlf type c value cl_bcs_convert=>gc_crlf.
    parameters:
      mailto type ad_smtpadr
       default 'ur mail id'.                    "#EC *
    data send_request   type ref to cl_bcs.
    data document       type ref to cl_document_bcs.
    data recipient      type ref to if_recipient_bcs.
    data bcs_exception  type ref to cx_bcs.
    data main_text      type bcsy_text.
    data binary_content type solix_tab.
    data size           type so_obj_len.
    data sent_to_all    type os_boolean.
    start-of-selection.
      perform create_content.
      perform send.
    form send.
      try.
          send_request = cl_bcs=>create_persistent( ).
        create document object from internal table with text
          append 'Hello world!' to main_text.                   "#EC NOTEXT
          document = cl_document_bcs=>create_document(
            i_type    = 'RAW'
            i_text    = main_text
            i_subject = 'Test Created By BCS_EXAMPLE_7' ).      "#EC NOTEXT
        add the spread sheet as attachment to document object
          document->add_attachment(
            i_attachment_type    = 'xls'                        "#EC NOTEXT
            i_attachment_subject = 'ExampleSpreadSheet'         "#EC NOTEXT
            i_attachment_size    = size
            i_att_content_hex    = binary_content ).
        add document object to send request
          send_request->set_document( document ).
        --------- add recipient (e-mail address) -----------------------
        create recipient object
          recipient = cl_cam_address_bcs=>create_internet_address( mailto ).
        add recipient object to send request
          send_request->add_recipient( recipient ).
        ---------- send document ---------------------------------------
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
          commit work.
          if sent_to_all is initial.
            message i500(sbcoms) with mailto.
          else.
            message s022(so).
          endif.
      endtry.
    endform.                    "send
    form create_content.
      data lv_string type string.
      data ls_t100 type t100.
    columns are separated by TAB and each line ends with CRLF
      concatenate 'This Is Just Example Text!'                  "#EC NOTEXT
                  gc_crlf gc_crlf
                  into lv_string.
    header line
      concatenate lv_string
                  'MSGID'    gc_tab
                  'MSGNO'    gc_tab
                  'Language' gc_tab                             "#EC NOTEXT
                  'Text'     gc_crlf                            "#EC NOTEXT
                  into lv_string.
    data lines
      select * from t100 into ls_t100
        where arbgb = 'SO' and msgnr = '182'.
        concatenate lv_string
                    ls_t100-arbgb gc_tab
                    ls_t100-msgnr gc_tab
                    ls_t100-sprsl gc_tab
                    ls_t100-text  gc_crlf
                    into lv_string.
      endselect.
      select * from t100 into ls_t100
        where arbgb = 'SO' and msgnr = '316'.
        concatenate lv_string
                    ls_t100-arbgb gc_tab
                    ls_t100-msgnr gc_tab
                    ls_t100-sprsl gc_tab
                    ls_t100-text  gc_crlf
                    into lv_string.
      endselect.
      try.
          cl_bcs_convert=>string_to_solix(
            exporting
              iv_string   = lv_string
              iv_codepage = '4103'  "suitable for MS Excel, leave empty
              iv_add_bom  = 'X'     "for other doc types
            importing
              et_solix  = binary_content
              ev_size   = size ).
        catch cx_bcs.
          message e445(so).
      endtry.
    endform.                    "create_content
    Thanks.

  • GP Mail: Unexpected internal exception during background execution

    Hi,
          I have designed a process in Guided Procedures which send mails when Approved or Rejected. I get an exception for users who have yahoo or gmail IDs.
    Technical Exception:
    Unexpected internal exception during background execution: The message contains non-trusted or invalid receivers
    Is there any setting /configuration for sending mails to these.
    Pl help
    Thanks,
    Vasu
    Message was edited by:
            Vasu Mullapudi

    Hi,
    are you using the Bounced Mails Framework to manage you mails? If so, one possible explanation is that BMF blocks untrusted messages.
    To configure BMF options, go to the Administration workset and edit the list of trusted addresses in BMF.
    More info:
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/44/450862f1f014bce10000000a155369/frameset.htm">Administering the BMF</a>
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/44/4491dafaab0597e10000000a155369/frameset.htm">Managing Trusted Addresses</a>
    HTH
    Regards, Petja

  • How to send mail attachment excel sheet correctly

    Hi,
    I  am working one program and there the out put should be sent in mail attachment in excel sheet. I have used one Function module SO_DOCUMENT_SEND_API1. I am able to send the output data mail attachment excel sheet. But one problem I am facing that last two lines in excel sheet are shifting one tab right. It should come from from first column itself.
    How to correct this program any one can answer it with some code if possible.
    Waiting for quick response.
    Best Regards,
    BDP

    Hi,
    I  am working one program and there the out put should be sent in mail attachment in excel sheet. I have used one Function module SO_DOCUMENT_SEND_API1. I am able to send the output data mail attachment excel sheet. But one problem I am facing that last two lines in excel sheet are shifting one tab right. It should come from from first column itself.
    How to correct this program any one can answer it with some code if possible.
    Waiting for quick response.
    Best Regards,
    BDP

  • Procedure or Function that send E-mail with image background and file attached

    hi
    I4d like know if someone there is a procedure or function that send E-mail with image background and file attached, for me.
    thanks
    Josi Vieira

    If you go to this part of OTN you will find the official Oracle UTL_SMTP demo, which includes attachments:
    http://technet.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    Getting a background is slightly trickier. The UTL_SMTP package is for primarily sending text e-mails, whereas images require HTML e-mail. I suggest you look at the structure of a sample HTML e-mail and see if you can write the necessary HTML strings in the DATA parameter. Otherwise you'll need to investigate handcrafting a program based on the UTL_TCP package.
    [rant]
    If this seems like a lot of trouble I agree and urge you not to bother. HTML e-mail is one of the curses of the modern age, not least because it is frequently used by purveyors of viruses. I have a filter on my Outlook client that strips out all the HTML in any e-mail I receive, which means I get lots of e-mails rendered unreadable by the inclusion of <HTML> tags. But who cares, they're mostly spam anyway. In fact, the use of HTML in an e-mail is almost always an indicator of the irrelevance of its content.
    [rant]
    Vibes, APC

  • Reg sending mail attachment

    Hi,
    im working on sending report output as mail attachment in pdf format..
    but im not getting the required output,,,i.e., even after entering email addresses in the selection screen....im not getting any mail to the respective mail-ids..
    im pasting the code..pls fix the problem..
    pls let me know wat we have to do in SCOT transaction after executing the program....pls respond ..pls ..
    TABLES : t001,                                         "COMPANY CODE
             knb1,                                         "CUSTOMER MASTER(COMPANY CODE)
             cdhdr,                                        "CHANGE DOCUMENT HEADER
             knkk,                                         "CUSTOMER MASTER CREDIT MANAGEMENT: CONTROL AREA DATA
             kna1,                                         "GENERAL DATA IN CUSTOMER MASTER
             adrc,                                         "ADDRESSES (BUSINESS ADDRESS SERVICES)
             t001s,                                        "ACCOUNTING CLERKS
             adrt,                                         "COMMUNICATION DATA TEXT (BUSINESS ADDRESS SERVICES)
             adr6.                                         "E-MAIL ADDRESSES (BUSINESS ADDRESS SERVICES)
    TABLES: itcpo,                                         "SAPscript output interface
            itcpp.                                         "SAPscript output parameters
    TYPES:   BEGIN OF y_t001,
                      bukrs TYPE bukrs,
                      kkber TYPE kkber,
                      adrnr TYPE adrnr,
             END OF y_t001.
    TYPES:   BEGIN OF y_cust,
                      p_objectid TYPE cdobjectv,
             END OF y_cust.
    TYPES:   BEGIN OF y_knkk,
                      kunnr TYPE kunnr,
                      kkber TYPE kkber,
                      dtrev TYPE dtrev_cm,
                      nxtrv TYPE nxtrv_cm,
                      klimk TYPE klimk,
                      dbwae TYPE dbwae_cm,
             END OF y_knkk.
    TYPES:   BEGIN OF y_customer,
                      kunnr TYPE kunnr,
                      adrnr TYPE adrnr,
             END OF y_customer.
    TYPES:   BEGIN OF y_custo ,
                      kunnr TYPE  kunnr,
                      name  TYPE  name1_gp,
                      kkber TYPE kkber,
             END OF y_custo.
    TYPES:   BEGIN OF y_knkk1,
                      kunnr LIKE knkk-kunnr,
                      dtrev LIKE knkk-dtrev,
                      nxtrv LIKE knkk-nxtrv,
                      klimk LIKE knkk-klimk,
             END OF y_knkk1.
    TYPES:   BEGIN OF y_report_display,
                      kunnr TYPE kunnr,
                      name  TYPE name1_gp,
                      dtrev TYPE dtrev_cm,
                      nxtrv TYPE nxtrv_cm,
                      klimk TYPE klimk,
                      dbwae TYPE dbwae_cm,
             END OF y_report_display.
    TYPES:   BEGIN OF y_adrt,
                      addrnumber TYPE adrnr,
                      comm_type  TYPE ad_comm,
                      remark     TYPE ad_remark2,
                      persnumber TYPE ad_persnum,
                      date_from  TYPE ad_date_fr,
                      consnumber TYPE ad_consnum,
                      smtp_addr  TYPE ad_smtpadr,
              END OF y_adrt.
    *TYPES : BEGIN OF y_adr6,
                     addrnumber TYPE ad_addrnum,
                     persnumber TYPE ad_persnum,
                     date_from  TYPE ad_date_fr,
                     consnumber TYPE ad_consnum,
                     smtp_addr  TYPE ad_smtpadr,
           END OF y_adr6.
    *TYPES:   BEGIN OF y_addr,
                     addrnumber TYPE adrnr,
                     name1  TYPE ad_name1,
                     postcode TYPE ad_pstcd1,
                     city1    TYPE ad_city1,
                     street   TYPE ad_street,
                     housenum TYPE ad_hsnm1,
                     telnum   TYPE ad_tlnmbr1,
                     faxnum   TYPE ad_fxnmbr1,
            END OF y_addr.
    TYPES:   BEGIN OF y_custnam,
                      adrnr TYPE adrnr,
                      name2 TYPE ad_name1,
             END OF y_custnam.
    TYPES:   BEGIN OF y_kna1,
                      kunnr TYPE kunnr,
                      adrnr TYPE adrnr,
                      name1 TYPE name1,
                     END OF y_kna1.
    TYPES:   BEGIN OF y_knb1,
                      kunnr TYPE kunnr,
                      bukrs TYPE bukrs,
                      busab TYPE busab,
             END OF y_knb1.
    TYPES:   BEGIN OF y_clv,
                      dtrev TYPE dtrev_cm,
                      nxtrv TYPE nxtrv_cm,
                      klimk TYPE klimk,
             END OF y_clv.
    TYPES:    BEGIN OF y_ccname,
                       sname TYPE t001s-sname,
              END OF y_ccname.
    *TYPES DECLARATION FOR DESIGING SCRIPT
    TYPES : BEGIN OF y_adrc,
               addrnumber LIKE adrc-addrnumber,
               name1 LIKE adrc-name1,
               post_code1 LIKE adrc-post_code1,
               city1 LIKE adrc-city1,
               street LIKE adrc-street,
               house_num1 LIKE adrc-house_num1,
               tel_number LIKE adrc-tel_number,
               nation LIKE adrc-nation ,
               fax_number LIKE adrc-fax_number,
               country LIKE adrc-country,
               END OF y_adrc.
    *TO GET C1 (CUSTOMER NAME IN RUSSIAN
    TYPES : BEGIN OF y_adrc1,
            addrnumber LIKE adrc-addrnumber,
            name1 LIKE adrc-name1,
            nation LIKE adrc-nation,
            END OF y_adrc1.
    *TO GET C7
    TYPES :BEGIN OF y_t001s,
            bukrs LIKE t001s-bukrs,    "Company Code
            busab LIKE t001s-busab,
            sname LIKE t001s-sname,
            END OF y_t001s.
    CONSTANTS:
    c_printer         LIKE itcpp-tddevice VALUE 'PRINTER',
    c_true(1)         TYPE c VALUE 'X',
    c_1(1)            TYPE n VALUE '1',
    c_pdf_format(3)   TYPE c VALUE 'PDF',
    c_u               LIKE soos1-recesc   VALUE 'U',
    c_recipient_name  LIKE soos1-recnam   VALUE 'U-',
    c_english         LIKE sy-langu       VALUE 'E',
    c_f               LIKE sood1-objsns   VALUE 'F',
    c_int(3)          TYPE c VALUE 'INT',
    c_main(4)         TYPE c VALUE 'ITEM',
    c_main_window(4)  TYPE c VALUE 'MAIN',
    c_header(6)       TYPE c VALUE 'HEADER',
    c_minus_sign(1)   TYPE c VALUE '-',
    c_document_type   LIKE sood-objtp     VALUE 'EXT',
    c_space(1)        TYPE c VALUE ' '.
    DATA t_result LIKE itcpp.
    DATA :w_t001      TYPE t001,
          w_custo     TYPE y_custo,
          w_knkk      TYPE y_knkk,
          w_cust      TYPE y_cust,
          w_customer  TYPE y_customer,
          w_report_display TYPE y_report_display,
         w_addr      TYPE y_addr,
          w_custnam   TYPE y_custnam,
          w_adrt      TYPE y_adrt,
         w_adr6      TYPE y_adr6,
          w_kna1      TYPE y_kna1,
          w_knb1      TYPE y_knb1,
          w_clv       TYPE y_clv,
          w_ccname    TYPE y_ccname.
    DATA:    w_error_found(1)       TYPE c,
             w_key_date_text(30)    TYPE c,
             w_total(10)            TYPE p DECIMALS 2,
             w_htddevice            LIKE itcpp-tddevice.
    DATA: E_PROFILE LIKE SOPRD.
    DATA:   t_t001            TYPE STANDARD TABLE OF y_t001,
            t_custo           TYPE STANDARD TABLE OF y_custo,
          t_knkk            TYPE STANDARD TABLE OF y_knkk,
            t_cust            TYPE STANDARD TABLE OF y_cust,
            t_customer        TYPE STANDARD TABLE OF y_customer,
            t_report_display  TYPE STANDARD TABLE OF y_report_display,
           t_addr            TYPE STANDARD TABLE OF y_addr,
            t_custnam         TYPE STANDARD TABLE OF y_custnam,
            t_adrt            TYPE STANDARD TABLE OF y_adrt,
           t_adr6            TYPE STANDARD TABLE OF y_adr6,
            t_kna1            TYPE STANDARD TABLE OF y_kna1,
            t_knb1            TYPE STANDARD TABLE OF y_knb1,
            t_clv             TYPE STANDARD TABLE OF y_clv,
            t_ccname          TYPE STANDARD TABLE OF y_ccname.
    DATA : number LIKE spell,
           amount(1000) TYPE c.
    For storing error log
    DATA: BEGIN OF t_error OCCURS 0,
            kunnr LIKE kna1-kunnr,
            comm(30) TYPE c,
          END OF t_error.
    For storing customer's email address
    DATA: BEGIN OF t_email OCCURS 0,
            smtp_addr LIKE adr6-smtp_addr,
          END OF t_email.
    To be used in the function to send a layout via email
    DATA: t_otfdata LIKE itcoo OCCURS 0 WITH HEADER LINE,
          t_htline  LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA DECLARATIONS FOR DESIGING SCRIPT
    DATA : it_t001 TYPE STANDARD TABLE OF y_t001,
           wa_t001 TYPE y_t001.
    DATA : it_adrc TYPE STANDARD TABLE OF y_adrc,
            wa_adrc type  y_adrc.
    DATA : it_adrc1 TYPE STANDARD TABLE OF y_adrc1,
           wa_adrc1 TYPE y_adrc1.
    DATA : it_knb1 TYPE STANDARD TABLE OF y_knb1,
           wa_knb1 TYPE y_knb1.
    DATA : it_kna1 TYPE STANDARD TABLE OF y_kna1,
           wa_kna1 TYPE y_kna1.
    DATA : it_knkk TYPE STANDARD TABLE OF y_knkk,
           wa_knkk TYPE y_knkk.
    DATA : it_knkk1 TYPE STANDARD TABLE OF y_knkk1,
           wa_knkk1 TYPE y_knkk1.
    DATA : it_t001s TYPE STANDARD TABLE OF y_t001s,
           wa_t001s TYPE y_t001s.
    *DATA STATEMENTS FOR EMAIL ADDRESSES
    DATA : it_adrt TYPE TABLE OF y_adrt,
           wa_adrt TYPE y_adrt,
           wa_email LIKE t_email.
    *DATA : it_adr6 TYPE TABLE OF y_adr6,
          wa_adr6 TYPE y_adr6,
    DATA : counter TYPE i,
           counter1 TYPE i,
           c5 LIKE spell.
    SELECTION-SCREEN BEGIN OF BLOCK clcn WITH FRAME TITLE text-200.
    SELECTION-SCREEN SKIP.
    PARAMETERS:     p_bukrs LIKE t001-bukrs OBLIGATORY,                    "COMPANY CODE
                    p_kkber LIKE t001-kkber OBLIGATORY.                    "CREDIT CONTROL AREA
    SELECT-OPTIONS: s_kunnr FOR knb1-kunnr OBLIGATORY,                     "CUSTOMER NUMBER
                    s_datum FOR sy-datum OBLIGATORY DEFAULT sy-datum.      "DATE OF CREDIT LIMIT UPDATE
    SELECTION-SCREEN SKIP.
    PARAMETERS : p_simul AS CHECKBOX DEFAULT 'X'.                          "RUN IN SIMULATION MODE
    SELECTION-SCREEN SKIP.
    PARAMETERS : p_lemail LIKE adr6-smtp_addr.                             " EMAIL
    SELECTION-SCREEN END OF BLOCK clcn.
    AT SELECTION-SCREEN.
      PERFORM f0100_validate_bukrs.  "*  For Company Code.
      PERFORM f0200_validate_kkber.  "* For Credit Control Area.
      PERFORM f0300_validate_kunnr.  "* For Customer Number
      PERFORM f0400_validate_datum.  "* For Date of Credit Limit Update
      PERFORM f0500_validate_simul.  "* For simulation mode and e-mail address
    *======================================================================
    START-OF-SELECTION.
      PERFORM f1000_get_customer.          "** COLLECT INFO FOR REPORT DISPLAY
      IF p_simul is initial AND NOT P_lemail IS INITIAL.
        PERFORM F1000_CHECK_GATEWAY_CONNECTION.
      ENDIF.
      IF p_simul IS INITIAL AND  NOT p_lemail IS INITIAL.
        PERFORM f3000_process_data_script USING t_report_display.
      ENDIF.
    END-OF-SELECTION.
      IF NOT p_simul IS INITIAL.
        PERFORM f2000_display_customer USING t_report_display.
      ENDIF.
    FORM f0100_validate_bukrs.
      DATA : w_bukrs TYPE bukrs.
    VALIDATION OF P_BUKRS
      SELECT SINGLE bukrs
                    FROM t001
                    INTO w_bukrs
                    WHERE bukrs EQ p_bukrs.
      IF sy-subrc NE 0.
        MESSAGE e999(zf) WITH 'Invalid Company Code' p_bukrs.   "(E01).
    *AUTHORIZATION CHECK
        AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
                            ID 'BUKRS' FIELD p_bukrs
                            ID 'ACTVT' FIELD '03'.
        IF sy-subrc NE 0.
          MESSAGE e999(zf)  WITH 'No Authorization for company code' p_bukrs."(e06).
        ENDIF.
      ENDIF.
    ENDFORM.                    " F0100_VALIDATE_BUKRS
    *Eject
    *&      Form  F0200_VALIDATE_KKBER
         *-> CREDIT CONTROL AREA AUTHORITY CHECK
    FOR CREDIT CONTROL AREA.
    FORM f0200_validate_kkber.
      DATA : w_kkber LIKE t001-kkber.
      SELECT SINGLE kkber
              FROM t001
              INTO w_kkber
              WHERE bukrs EQ p_bukrs
                AND   kkber EQ p_kkber.
      IF sy-subrc NE 0.
        MESSAGE e999(zf) WITH
       'Credit Control Area' p_kkber 'not defined for Company Code' p_bukrs."(e02).
       MESSAGE e999 WITH text-e02 p_kkber .
      ENDIF.
    ENDFORM.                    "F0200_VALIDATE_KKBER
    *&      Form  F0300_VALIDATE_KUNNR
         *-> CUSTOMER NUMBER AUTHORITY CHECK
    FORM f0300_validate_kunnr.
    VALIDATION OF S_KUNNR
      DATA : w_kunnr TYPE kunnr,
             w_bukrs TYPE bukrs.
      IF s_kunnr IS INITIAL .
        MESSAGE e999 WITH 'Enter Customer Number'(e04).
        SUBMIT (sy-cprog) VIA SELECTION-SCREEN.
      ENDIF.
      LOOP AT s_kunnr.
        CLEAR : w_kunnr,
                w_bukrs.
        IF NOT s_kunnr-low IS INITIAL.
          SELECT SINGLE kunnr bukrs
          FROM knb1 INTO (w_kunnr ,w_bukrs)
          WHERE kunnr EQ s_kunnr-low
          AND bukrs EQ p_bukrs.
          IF sy-subrc NE 0.
            MESSAGE e999(zf)  WITH 'Customer S_KUNNR-LOW not defined in company code' p_bukrs."(e03).
          ENDIF.
        ENDIF. "if not s_kunnr-low is initial.
        IF NOT s_kunnr-high IS INITIAL.
          CLEAR : w_kunnr,
                  w_bukrs.
          SELECT SINGLE kunnr bukrs
          FROM knb1 INTO (w_kunnr , w_bukrs)
          WHERE kunnr EQ s_kunnr-high
          AND bukrs EQ p_bukrs.
          IF sy-subrc NE 0.
            MESSAGE e999(zf)  WITH 'Customer S_KUNNR-HIGH not defined in company code' p_bukrs."(e03).
          ENDIF.
        ENDIF. "if not s_kunnr-high is initial.
      ENDLOOP. " loop at s_kunnr
    ENDFORM.                    " F0200_VALIDATE_KUNNR
    *&      Form  F0400_VALIDATE_DATUM
         *-> DATE OF CREDIT LIMIT UPDATE
    FORM f0400_validate_datum.
      IF s_kunnr IS INITIAL AND s_datum IS INITIAL.
        MESSAGE e999 WITH 'Enter either Date of CL update or Customer number.'(e04).
      ENDIF.
    ENDFORM.                    "F0400_VALIDATE_DATUM
    *&      Form  F1000_GET_CUSTOMER
          text
    -->  p1        text
    <--  p2        text
    FORM f1000_get_customer .
      DATA : w_kunnr LIKE knkk-kunnr,
               w_kkber LIKE knkk-kkber.
      IF s_datum IS NOT INITIAL.
        SELECT objectid
               FROM cdhdr
               INTO TABLE t_cust
               WHERE  objectclas IN ('KLIM','DTREV','NXTRV')
               AND  change_ind IN ('U','I')
               AND udate IN s_datum.
              WHERE ( objectclas EQ 'KLIM' OR objectclas EQ 'DTREV' OR  objectclas EQ 'NXTRV')
              AND  ( change_ind EQ 'U' OR change_ind EQ 'I')
              AND udate IN s_datum .
      ENDIF.
      IF sy-subrc NE 0.
        MESSAGE s999 WITH 'There is no data for selected period'(e07).
      ELSE.
        MOVE t_cust TO t_customer.
      ENDIF.
      SORT t_customer BY kunnr.
      IF NOT t_customer[] IS INITIAL.
        SELECT kunnr
               kkber
               dtrev
               nxtrv
               klimk
               dbwae
               FROM knkk
               INTO TABLE t_knkk
               FOR ALL ENTRIES IN t_customer
               WHERE kunnr = t_customer-kunnr
               AND   kkber = p_kkber.
      ELSE.
        MESSAGE e999 WITH text-e07.
      ENDIF.
      IF sy-subrc NE 0.
      ENDIF.
      SORT t_knkk BY kunnr kkber.
      IF NOT t_knkk[] IS INITIAL.
        SELECT   kunnr
                 name1
        FROM kna1
        INTO TABLE t_custo
        FOR ALL ENTRIES IN t_knkk
        WHERE kunnr = t_knkk-kunnr.
      ENDIF.
      IF sy-subrc = 0.
      ENDIF.
      SORT t_custo BY kunnr kkber.
      LOOP AT t_custo INTO w_custo.
        CLEAR w_knkk.
        READ TABLE t_knkk INTO w_knkk WITH KEY kunnr = w_custo-kunnr
                                      BINARY SEARCH.
        IF sy-subrc = 0.
          w_report_display-kunnr = w_custo-kunnr.
          w_report_display-name  = w_custo-name.
          w_report_display-dtrev = w_knkk-dtrev.
          w_report_display-nxtrv = w_knkk-nxtrv.
          w_report_display-klimk = w_knkk-klimk.
          w_report_display-dbwae = w_knkk-dbwae.
          APPEND w_report_display TO t_report_display .
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " F1000_GET_CUSTOMER
    *&      Form  F2000_DISPLAY_CUSTOMER
          text
         -->P_T_REPORT_DISPLAY  text
    FORM f2000_display_customer  USING    p_t_report_display.
      DATA: no  TYPE n  VALUE 1.
      DATA: t_data TYPE STANDARD TABLE OF y_report_display.
      t_data = p_t_report_display.
      DATA : w_data LIKE LINE OF t_data .
      ULINE (118).
      WRITE:/ sy-vline,
              8 'CREDIT LIMIT CHANGE NOTIFICATION REPORT ON',
              sy-datum , 118 sy-vline.
      ULINE (118).
      WRITE:/ sy-vline,'NO'(008) ,
            10 sy-vline, 11 'CUSTOMER NUMBER',
            28 sy-vline, 29 'CUSTOMER NAME', 43 sy-vline,
            44 'CREDIT LIMIT VALID', 63 sy-vline ,
            64 'CREDIT LIMIT AMOUNT', 85 sy-vline, 86 'CURRENCY',
            95 sy-vline , 96 'Notification Status',118 sy-vline.
      ULINE (118).
      WRITE:/ sy-vline,43 sy-vline, 44 'FROM', 53 sy-vline,
      56 'TILL', 63 sy-vline, 118 sy-vline .
      ULINE (118).
      LOOP AT t_data INTO w_data.
        WRITE:/ sy-vline, no,
              10 sy-vline, 11 w_data-kunnr ,
              28 sy-vline, 29 w_data-name, 43 sy-vline, 44 w_data-dtrev,
              53 sy-vline, 56 w_data-nxtrv ,63 sy-vline ,64 w_data-klimk,
              85 sy-vline, 86 w_data-dbwae,
              95 sy-vline , 118 sy-vline.
        no = no + 1.
        ULINE (118).
      ENDLOOP.
    ENDFORM.                    " F2000_DISPLAY_CUSTOMER
    *&      Form  F3000_PROCESS_DATA_SCRIPT
          text
         -->P_T_REPORT_DISPLAY  text
    FORM f3000_process_data_script  USING    p_t_report_display.
      DATA: t_data TYPE STANDARD TABLE OF y_report_display.
      t_data = p_t_report_display.
      DATA : w_data LIKE LINE OF t_data .
      DATA: temp_is_negative(1) TYPE c,
               temp_text(20)       TYPE c,
               temp_sname          LIKE t001s-sname,
               temp_email          LIKE adr6-smtp_addr.
      DATA : number LIKE spell,
             amount(255) TYPE c.
      PERFORM f3100_initialize_settings.
      LOOP AT t_data INTO w_data.
        AT NEW kunnr.
          CLEAR w_error_found.
          IF p_simul IS INITIAL AND  NOT p_lemail IS INITIAL.
            PERFORM f3300_open_form.
           data:  wa_t001 like line of t001
            DATA : begin of wa_t001,
                   adrnr like t001-adrnr,
                   end of wa_t001.
            SELECT SINGLE
                   adrnr FROM t001 INTO wa_t001
                   WHERE bukrs = p_bukrs.
          DATA: BEGIN OF wa_adrc,
                 addrnumber LIKE adrc-addrnumber,
                 name1 LIKE adrc-name1,
                 post_code1 LIKE adrc-post_code1,
                 city1 LIKE adrc-city1,
                 street LIKE adrc-street,
                 house_num1 LIKE adrc-house_num1,
                 tel_number LIKE adrc-tel_number,
                 nation LIKE adrc-nation ,
                 fax_number LIKE adrc-fax_number,
                 country LIKE adrc-country,
               END OF wa_adrc.
       SELECT SINGLE
                addrnumber
                name1
                post_code1
                city1
                street
                house_num1
                tel_number
                nation
                fax_number
                country
                FROM adrc
                INTO corresponding fields of wa_adrc
                WHERE addrnumber EQ wa_t001-adrnr  AND
                      nation EQ ' '.
            PERFORM f3700_write_form.
            DATA: wa_kna1 LIKE LINE OF t_kna1,
                  wa_adrcc LIKE LINE OF it_adrc.
            SELECT SINGLE
                   kunnr
                   adrnr FROM kna1
                   INTO  wa_kna1
                   WHERE kunnr = w_data-kunnr.
            IF sy-subrc EQ 0.
              SELECT SINGLE
                     addrnumber
                     name1
                     FROM adrc
                     INTO wa_adrcc
                     WHERE addrnumber = wa_kna1-adrnr
                     AND nation = ' '.
            ENDIF.
            PERFORM f3701_write_form.
            DATA : wa_knkk LIKE LINE OF t_knkk.
            DATA : counter TYPE i,
                   counter1 TYPE i.
            IF sy-subrc EQ 0.
          SELECT SINGLE KUNNR
                 DTREV
                 NXTRV
                 KLIMK  FROM KNKK INTO WA_KNKK WHERE
                 KUNNR EQ W_DATA-KUNNR.
            ENDIF.
            CALL FUNCTION 'SPELL_AMOUNT'
             EXPORTING
               amount          = w_knkk-klimk
       CURRENCY        = ' '
       FILLER          = ' '
               language        = sy-langu
             IMPORTING
               in_words        = number.
            IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
            amount = number-word.
            PERFORM f3702_write_form.
            DATA: wa_knb1 LIKE LINE OF t_knb1.
            IF sy-subrc EQ 0.
              SELECT SINGLE
                     busab
                     FROM   knb1
                     INTO   wa_knb1
                     WHERE  kunnr = w_data-kunnr
                     AND    bukrs = p_bukrs.
            ENDIF.
            DATA : wa_t001s LIKE LINE OF it_t001s.
            IF sy-subrc EQ 0.
              SELECT SINGLE bukrs
                 busab
                 sname
                 FROM t001s
                 INTO wa_t001s
                 WHERE bukrs = wa_knb1-bukrs
                 AND busab = wa_knb1-busab.
            ENDIF.
            PERFORM f3703_write_form.
            PERFORM f3704_write_form.
            IF counter1 < counter.
              PERFORM f3705_write_form.
            ENDIF.
            PERFORM f3706_close_form.
          ENDIF.
        ENDAT.
        IF w_error_found EQ c_true.
        ENDIF.
        AT END OF kunnr.
    PERFORM F3400_WRITE_FORM USING C_TOTAL C_MAIN_WINDOW.
         PERFORM F3500_CLOSE_FORM.
          IF p_simul IS INITIAL AND  NOT p_lemail IS INITIAL.       "Email setting
            PERFORM f3200_get_email_addr USING w_data-kunnr.
            PERFORM f3600_send_data_via_email USING w_data-kunnr.
          ENDIF.
        ENDAT.
      ENDLOOP.
      WRITE:/ ' E-Mail is sent to the customer'.
    ENDFORM.                    " F3000_PROCESS_DATA_SCRIPT
    *&      Form  F3100_INITIALIZE_SETTINGS
          text
    -->  p1        text
    <--  p2        text
    FORM f3100_initialize_settings .
      SELECT SINGLE spld
            INTO itcpo-tddest
            FROM usr01
            WHERE bname EQ sy-uname.
      IF sy-subrc NE 0.
        itcpo-tddest = 'LOCAL'.
      ENDIF.
      w_htddevice      = c_printer.
      itcpo-tddest = ''.
      itcpo-tdrdidev = ''.
      itcpo-tdsenddate = sy-datum.
      itcpo-tdsendtime = sy-uzeit.
      itcpo-tdschedule = 'IMM'.
      itcpo-tdimmed = ' '.
    itcpo-tdnewid    = c_true.            "PRINT: New spool request
      itcpo-tdlifetime = c_1.               "PRINT: Spool retention period
      itcpo-tdgetotf   = c_true.
      IF p_simul IS INITIAL AND  NOT p_lemail IS INITIAL.       "Email setting
        itcpo-tdgetotf     = c_true.
      ENDIF.
    ENDFORM.                    " F3100_INITIALIZE_SETTINGS
    *&      Form  f0500_validate_simul
          text
    -->  p1        text
    <--  p2        text
    FORM f0500_validate_simul .
      IF p_simul IS INITIAL AND p_lemail IS INITIAL.       "Email setting
       MESSAGE e999(zf) WITH 'Enter Email address'.            "(e05).
      ENDIF.
    ENDFORM.                    " f0500_validate_simul
    *&      Form  F3600_SEND_DATA_VIA_EMAIL
          text
         -->P_W_DATA_KUNNR  text
    FORM f3600_send_data_via_email  USING p_w_data_kunnr.
      DATA:   fle1(2)       TYPE p,
              fle2(2)       TYPE p,
              off1          TYPE p,
              hltlines      TYPE i,
              temp_filesize TYPE i,
              hfeld(500)    TYPE c,
              header(50)   TYPE c,
              htabix        LIKE sy-tabix,
              x_sent_to_all LIKE sonv-flag.
      DATA: BEGIN OF x_objcont OCCURS 0.
              INCLUDE STRUCTURE soli.
              INCLUDE STRUCTURE SOLISTI1.
      DATA: END OF x_objcont.
      DATA: BEGIN OF x_object_hd_change.
              INCLUDE STRUCTURE sood1.
      DATA: END OF x_object_hd_change.
      DATA: BEGIN OF x_receivers OCCURS 0.
              INCLUDE STRUCTURE soos1.
             INCLUDE STRUCTURE SOMLRECI1.
      DATA: END OF x_receivers.
      DATA: BEGIN OF x_objhead OCCURS 1.
              INCLUDE STRUCTURE soli.
      DATA: END OF x_objhead.
    **Data: begin of objpack occurs 0.
             include structure SOPCKLSTI1.
    **Data: end of objpack.
    **Data: begin of email_data occurs 0.
             include structure SODOCCHGI1.
    **Data: end of email_data.
    Converts the layout set to PDF format
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = c_pdf_format
        IMPORTING
          bin_filesize          = temp_filesize
        TABLES
          otf                   = t_otfdata
          lines                 = t_htline
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          OTHERS                = 4.
      IF sy-subrc NE 0.
        w_error_found = c_true.
        t_error-kunnr = p_w_data_kunnr.
        t_error-comm  = 'Error in conversion to PDF format.'(e08).
        APPEND t_error.
        CLEAR t_error.
        EXIT.
      ENDIF.
    Convert the PDF file into an internal table which to be used in the
    function that will send a PDF file to a email address
      DESCRIBE TABLE t_htline LINES hltlines.
    DESCRIBE FIELD T_HTLINE LENGTH FLE1 IN BYTE MODE.
      DESCRIBE FIELD t_htline LENGTH fle1
                                  IN CHARACTER MODE.
    DESCRIBE FIELD X_OBJCONT LENGTH FLE2 IN BYTE MODE.
      DESCRIBE FIELD x_objcont LENGTH fle2
                                   IN CHARACTER MODE.
      CLEAR x_objcont.
      REFRESH x_objcont.
      LOOP AT t_htline.
        htabix = sy-tabix.
        MOVE t_htline TO hfeld+off1.
        IF htabix = hltlines.
          fle1 = STRLEN( t_htline ).
        ENDIF.
        off1 = off1 + fle1.
        IF off1 GE fle2.
          CLEAR x_objcont.
          x_objcont = hfeld(fle2).
          APPEND x_objcont.
          SHIFT hfeld BY fle2 PLACES.
          off1 = off1 - fle2.
        ENDIF.
        IF htabix = hltlines.
          IF off1 GT 0.
            CLEAR x_objcont.
            x_objcont = hfeld(off1).
            APPEND x_objcont.
          ENDIF.
        ENDIF.
      ENDLOOP.
    LOOP AT t_email.
       x_receivers-receiver = t_email-smtp_addr.
       x_receivers-rec_type = c_u.
       APPEND x_receivers.
    ENDLOOP.
    x_receivers-receiver = p_lemail.
    x_receivers-rec_type = c_u.
    APPEND x_receivers.
    DESCRIBE TABLE x_objcont LINES sy-tfill.
    READ TABLE x_objcont INDEX sy-tfill.
    email_data-doc_size = ( sy-tfill - 1 ) * 255 + STRLEN( x_objcont ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = sy-tfill.
    objpack-doc_type = 'RAW'.
    APPEND objpack.
    email_data-obj_descr = 'Notification'.
    APPEND email_data.
    IF x_receivers[] IS NOT INITIAL.
       CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
           document_data = email_data
           put_in_outbox = 'X'
           commit_work   = 'X' "used from rel. 6.10
         TABLES
           packing_list  = objpack
           object_header = email_fname
           contents_bin  = email_text
           contents_txt  = x_objcont
           receivers     = x_receivers.
    endif.
      CLEAR x_objhead.
      REFRESH x_objhead.
      CLEAR x_object_hd_change.
      x_object_hd_change-objnam = 'EMAIL'(t04).
      header = 'Procter & Gamble'(t05).
      x_object_hd_change-objdes = header.                         "Title
      x_object_hd_change-objla = c_english.                       "Language
      x_object_hd_change-objsns = c_f.
      x_object_hd_change-objlen = temp_filesize.
      x_object_hd_change-file_ext = c_pdf_format.
    Transfer the email address to an internal table which will be used
    in the function that will send a PDF file to a email address
      CLEAR x_receivers.
      REFRESH x_receivers.
      LOOP AT t_email.
        x_receivers-sndex = c_true.
        x_receivers-sndpri = c_1.
        x_receivers-recesc = c_u.
        x_receivers-recnam = c_recipient_name.
    Populate the email address of the customer
        x_receivers-recextnam = t_email-smtp_addr.
        x_receivers-recesc = c_english.
        x_receivers-sndart = c_int.
        APPEND x_receivers.
      ENDLOOP.
      x_receivers-sndex = c_true.
      x_receivers-sndpri = c_1.
      x_receivers-recesc = c_u.
      x_receivers-recnam = c_recipient_name.
    Populate the Local mail address
      x_receivers-recextnam = p_lemail.
      x_receivers-recesc = c_english.
      x_receivers-sndart = c_int.
      APPEND x_receivers.
    Calling a SAP function to send out email with attachment of PDF file
      CALL FUNCTION 'SO_OBJECT_SEND'
        EXPORTING
          object_hd_change           = x_object_hd_change
          object_type                = c_document_type
          outbox_flag                = c_true
        IMPORTING
          sent_to_all                = x_sent_to_all
        TABLES
          objcont                    = x_objcont
          objhead                    = x_objhead
          receivers                  = x_receivers
        EXCEPTIONS
          active_user_not_exist      = 1
          communication_failure      = 2
          component_not_available    = 3
          folder_not_exist           = 4
          folder_no_authorization    = 5
          forwarder_not_exist        = 6
          note_not_exist             = 7
          object_not_exist           = 8
          object_not_sent            = 9
          object_no_authorization    = 10
          object_type_not_exist      = 11
          operation_no_authorization = 12
          owner_not_exist            = 13
          parameter_error            = 14
          substitute_not_active      = 15
          substitute_not_defined     = 16
          system_failure             = 17
          too_much_receivers         = 18
          user_not_exist             = 19
          x_error                    = 20
          OTHERS                     = 21.
      IF sy-subrc NE 0.
        w_error_found = c_true.
        t_error-kunnr = p_w_data_kunnr.
        t_error-comm  = 'Error in sending email.'(e09).
        APPEND t_error.
        CLEAR t_error.
      ELSEIF sy-subrc EQ 0.
        COMMIT WORK.
    *Transmit Mail
        SUBMIT rsconn01 WITH mode = c_int
        WITH output = c_space
        AND RETURN.
      ENDIF.
    ENDFORM.                    " F3600_SEND_DATA_VIA_EMAIL
    *&      Form  F3200_GET_EMAIL_ADDR
          text
         -->P_T_REPORT_DISPLAY  text
    FORM f3200_get_email_addr USING p_w_data_kunnr.
      REFRESH t_customer.
      REFRESH t_adrt.
      REFRESH t_email.
      DATA: t_data TYPE STANDARD TABLE OF y_report_display.
    t_data = p_t_report_display.
      DATA : w_data LIKE LINE OF t_data .

    Sending mail with attachment
    This program will allowed you to send email with attachment.
    First, specify the attachment file from your local hardisk and execute.
    Next, specify the sender email address and click the send button.
    report y_cr17_mail.
    data method1 like sy-ucomm.
    data g_user like soudnamei1.
    data g_user_data like soudatai1.
    data g_owner like soud-usrnam.
    data g_receipients like soos1 occurs 0 with header line.
    data g_document like sood4 .
    data g_header like sood2.
    data g_folmam like sofm2.
    data g_objcnt like soli occurs 0 with header line.
    data g_objhead like soli occurs 0 with header line.
    data g_objpara like selc occurs 0 with header line.
    data g_objparb like soop1 occurs 0 with header line.
    data g_attachments like sood5 occurs 0 with header line.
    data g_references like soxrl occurs 0 with header line.
    data g_authority like sofa-usracc.
    data g_ref_document like sood4.
    data g_new_parent like soodk.
    data: begin of g_files occurs 10 ,
    text(4096) type c,
    end of g_files.
    data : fold_number(12) type c,
    fold_yr(2) type c,
    fold_type(3) type c.
    parameters ws_file(4096) type c default 'c:\debugger.txt'.
    Can me any file fromyour pc ....either xls or word or ppt etc ...
    g_user-sapname = sy-uname.
    call function 'SO_USER_READ_API1'
    exporting
    user = g_user
    PREPARE_FOR_FOLDER_ACCESS = ' '
    importing
    user_data = g_user_data
    EXCEPTIONS
    USER_NOT_EXIST = 1
    PARAMETER_ERROR = 2
    X_ERROR = 3
    OTHERS = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    fold_type = g_user_data-outboxfol+0(3).
    fold_yr = g_user_data-outboxfol+3(2).
    fold_number = g_user_data-outboxfol+5(12).
    clear g_files.
    refresh : g_objcnt,
    g_objhead,
    g_objpara,
    g_objparb,
    g_receipients,
    g_attachments,
    g_references,
    g_files.
    method1 = 'SAVE'.
    g_document-foltp = fold_type.
    g_document-folyr = fold_yr.
    g_document-folno = fold_number.
    g_document-objtp = g_user_data-object_typ.
    *g_document-OBJYR = '27'.
    *g_document-OBJNO = '000000002365'.
    *g_document-OBJNAM = 'MESSAGE'.
    g_document-objdes = 'sap-img.com testing by program'.
    g_document-folrg = 'O'.
    *g_document-okcode = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes = 'sap-img.com testing by program'.
    g_header-file_ext = 'TXT'.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = sy-uname
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header
    FOLMEM_DATA =
    RECEIVE_DATA =
    File from the pc to send...
    method1 = 'ATTCREATEFROMPC'.
    g_files-text = ws_file.
    append g_files.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = g_owner
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header
    method1 = 'SEND'.
    g_receipients-recnam = 'MK085'.
    g_receipients-recesc = 'B'.
    g_receipients-sndex = 'X'.
    append g_receipients.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = g_owner
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header.
    *-- End of Program
    also try this one for background scheduling the same
    Sending mail with attachment report in Background
    Pay attention because it’s working with output list from spool converted to pdf.
    =================================================================================
    z_send_email_fax_global
    FUNCTION-POOL z_gfaian_mail_fax. “MESSAGE-ID ..
    WORK TABLE AREAS
    TABLES: tsp01.
    INTERNAL TABLES
    DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
    lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
    DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
    DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
    TYPES: BEGIN OF y_files,
    file(60) TYPE c,
    END OF y_files.
    DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
    DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
    STRUCTURES
    DATA: folder_id LIKE soodk,
    object_id LIKE soodk,
    link_folder_id LIKE soodk,
    g_document LIKE sood4,
    g_header_data LIKE sood2,
    g_folmem_data LIKE sofm2,
    g_header_data LIKE sood2,
    g_receive_data LIKE soos6,
    g_ref_document LIKE sood4,
    g_new_parent LIKE soodk,
    l_folder_id LIKE sofdk,
    v_email(50).
    DATA: hd_dat like sood1.
    VARIABLES
    DATA: client LIKE tst01-dclient,
    name LIKE tst01-dname,
    objtype LIKE rststype-type,
    type LIKE rststype-type.
    DATA: numbytes TYPE i,
    arc_idx LIKE toa_dara,
    pdfspoolid LIKE tsp01-rqident,
    jobname LIKE tbtcjob-jobname,
    jobcount LIKE tbtcjob-jobcount,
    is_otf.
    DATA: outbox_flag LIKE sonv-flag VALUE ‘X’,
    store_flag LIKE sonv-flag,
    delete_flag LIKE sonv-flag,
    owner LIKE soud-usrnam,
    on LIKE sonv-flag VALUE ‘X’,
    sent_to_all LIKE sonv-flag,
    g_authority LIKE sofa-usracc,
    w_objdes LIKE sood4-objdes.
    DATA: c_file LIKE rlgrap-filename,
    n_spool(6) TYPE n.
    DATA: cancel.
    DATA: desired_type LIKE sood-objtp,
    real_type LIKE sood-objtp,
    attach_type LIKE sood-objtp,
    otf LIKE sood-objtp VALUE ‘OTF’, ” SAPscript Ausgabeformat
    ali LIKE sood-objtp VALUE ‘ALI’. ” ABAP lists
    CONSTANTS
    CONSTANTS: ou_fol LIKE sofh-folrg VALUE ‘O’,
    c_objtp LIKE g_document-objtp VALUE ‘RAW’,
    c_file_ext LIKE g_document-file_ext VALUE ‘TXT’.
    =================================================================================
    z_send_email_fax2
    FUNCTION z_faian_mail_fax2.
    ””Interface local:
    *” IMPORTING
    *” REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *” REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
    *” REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *” REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
    *” TABLES
    *” LT_BODY_EMAIL STRUCTURE SOLI
    *” EXCEPTIONS
    *” ERR_NO_ABAP_SPOOLJOB
    Fist part: Verify if the spool really exists
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc NE 0.
    RAISE err_no_abap_spooljob. “doesn’t exist
    ELSE.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION ‘RSTS_GET_ATTRIBUTES’
    EXPORTING
    authority = ‘SP01&#8242;
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = ‘OTF’.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION ‘RSPO_RETURN_SPOOLJOB’
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION ‘SO_FOLDER_ROOT_ID_GET’
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION ‘SO_DOCUMENT_REPOSITORY_MANAGER’
    EXPORTING
    method = ‘SAVE’
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    objcont = lt_body_email
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    CLEAR lt_rec_tab.
    lt_rec_tab-sel = ‘X’.
    lt_rec_tab-recesc = object_type. “This field for FAX/MAIL
    lt_rec_tab-recnam = ‘U-’.
    lt_rec_tab-deliver = ‘X’.
    lt_rec_tab-not_deli = ‘X’.
    lt_rec_tab-read = ‘X’.
    lt_rec_tab-mailstatus = ‘E’.
    lt_rec_tab-adr_name = fax_mail_number.
    lt_rec_tab-sortfield = fax_mail_number.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-sortclass = ‘5&#8242;.
    APPEND lt_rec_tab.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-recesc = object_type.
    lt_rec_tab-sndart = ‘INT’.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    lt_files-file = c_file.
    APPEND lt_files.
    begin of insertion by faianf01
    hd_dat-objdes = header_mail.
    CALL FUNCTION ‘SO_ATTACHMENT_INSERT’
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    end of insertion by faianf01
    send email from SAPOFFICE
    CALL FUNCTION ‘SO_OBJECT_SEND’
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    check_send_authority = ‘X’
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDIF.
    ENDFUNCTION.
    =================================================================================
    z_send_email_fax
    FUNCTION ZCBFS_SEND_MAIL.
    ””Interface local:
    *” IMPORTING
    *” REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *” REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *” TABLES
    *” LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
    *” EXCEPTIONS
    *” ERR_NO_ABAP_SPOOLJOB
    DATA: vg_achou(1) TYPE n.
    Fist part: Verify if the spool really exists
    vg_achou = 1.
    DO 60 TIMES.
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc IS INITIAL.
    CLEAR vg_achou.
    EXIT.
    ELSE.
    WAIT UP TO 1 SECONDS.
    ENDIF.
    ENDDO.
    IF vg_achou = 1.
    RAISE err_no_abap_spooljob. “doesn’t exist
    ENDIF.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION ‘RSTS_GET_ATTRIBUTES’
    EXPORTING
    authority = ‘SP01&#8242;
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = ‘OTF’.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION ‘RSPO_RETURN_SPOOLJOB’
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION ‘SO_FOLDER_ROOT_ID_GET’
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION ‘SO_DOCUMENT_REPOSITORY_MANAGER’
    EXPORTING
    method = ‘SAVE’
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    LOOP AT LIST_FAX_MAIL_NUMBER.
    lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
    lt_rec_tab-recesc = ‘U’.
    lt_rec_tab-sndart = ‘INT’.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    ENDLOOP.
    lt_files-file = c_file.
    APPEND lt_files.
    hd_dat-objdes = header_mail.
    CALL FUNCTION ‘SO_ATTACHMENT_INSERT’
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    send email from SAPOFFICE
    CALL FUNCTION ‘SO_OBJECT_SEND’
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDFUNCTION.
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Can you create a pdf e-mail attachment with working hyperlinks?

    I'm trying to figure out how to generate an e-mail with working hyperlinks where the recipient doesn't have to open the pdf for the links to work...in other words, when they open the e-mail and view the pdf as it is displayed, the links are visible and the viewer can click on them and go to a URL. I see this all the time, and can't figure out how to do it with a pdf (I've added the links with the link took in pdf and they display within the application window, but disappear when the file is an e-mail attachment) or with html. I've attached the pdf that I'm trying to make interactive within an e-mail message. Any help that can be provided is much appreciated!

    Michael your answer is colored by the fact you use an ASCII (Text only) News Reader.
    The answer is more along these lines:
    PDF's can be created with working hyperlinks.
    They can be automatically be brought over from programs such as MS Word, Open Office, and such  provided your on a PC Platform
    they can actually be viewed and clickable from Acrobat or Reader PC Versions, if created from a PC Version.
    they are not viewable or clickable if created from Mac version of Office.
    They are viewable and clickable from a PC if created from Mac version of Office (Word/Excel)
    The Mac can can not do so automatically you must do them Manually with in Acrobat.
    in Past it has been a Pain to do so though may be different in version 9
    If you use a browser Plugin such as Schubert's PDF Browser Plugin that works on Safari, fireFox, Camino, SeaMonkey Opera, OmniPage, iCab. Links you create in Mac version of Acrobat are viewable and clickable.
    Finally MS and Adobe have been having this on going problem since the day's PDF's first hit the market. (Version 1.) and MS  decided to support them. The hooks are there for both PC and Mac versions of Word. and either are capable of being created and acted upon on whether created by the Mac version of Office, or the PC version of Office, but only on a windows PC. Its clearly a problem of Acrobat/Reader on the Mac. Its either a problem Adobe won't own up to, or they can't solve or, this is one item they can't be bothered with to put in the Mac Versions.
    Some of this information is based on my participation in the msnews. nntp newsgroups for Office Mac. The experts there for the most part (MVP's) use both Mac and PC's and have investogated the problem themselves and been give information from the MacBU (Mac Business Unit) at MicroSoft. The basic internal code of Office 2003/2004 is the same. The UI is different and key cobinations are different. And same for 2007/2008 except office 2008 don't support VBA and Macros, and neither 2004 nor 2008 have MasterPages, And thankfully according the the MVP's Thankfully the Robbonis not supported on 2008.

  • XLS as MAIL attachment....points  Guranteed

    I am sending one xls file as mail attachment.
    The following code is sending the mail pefectly, but the attchment appears with a different icon, not as xls icon in the attchment, as it normaly does if we use so00 for sending a xls attchment thorugh mail.
    If i download the xls attchment in local pc after opening the mail, it does open with Excel application, but if double click on it in the mail itself, its not opening in normal text format in sap text-editor in read only mode, not as xls file.I suspect something is wrong...here is the code..please let me know about your suggestion..
    For Max, and those who answered my last question, i will reward point to deserving answer after this post.. i got disconnected while surfing...sory for the delay.
    REPORT  ZEMAIL_ATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    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:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *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.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY

    Sorry for a mistake...this the code..i was talking about
    REPORT ztest3.
    E-mail an Abap report *
    DATA : w_name TYPE sos04-l_adr_name.
    SELECT-OPTIONS :
    Recipient address
    s_name FOR w_name DEFAULT sy-uname NO INTERVALS.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    START-OF-SELECTION.
    E-mail Abap report
    PERFORM CREATE_XLS_FILE_DATA.
    PERFORM f_send_mail.
    Form f_send_mail
    FORM f_send_mail.
    Data Declaration
    DATA:
    l_datum(10),
    ls_docdata TYPE sodocchgi1,
    lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
    lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
    lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
    lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
    lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
    l_tab_lines TYPE i,
    l_att_type LIKE soodk-objtp.
    WRITE sy-datum TO l_datum.
    NOTE: Creation of attachment is finished yet.
    For your report, the attachment should be placed into table
    objtxt for plain text or
    objbin for binary content.
    Now create the message and send the document.
    Create Message Body
    Title and Description
    ls_docdata-obj_name = 'Sample Records From Ekpo in XLS Format'.
    CONCATENATE 'Sample Records From Ekpo' 'In XLS FORMAT'
                  into ls_docdata-obj_descr SEPARATED BY space.
    Main Text
    lt_objtxt = 'Sample Records From Ekpo in XLS Format'. "#EC *
    APPEND lt_objtxt.
    Write Packing List (Main)
    DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
    READ TABLE lt_objtxt INDEX l_tab_lines.
    ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    CLEAR lt_objpack-transf_bin.
    lt_objpack-head_start = 1.
    lt_objpack-head_num = 0.
    lt_objpack-body_start = 1.
    lt_objpack-body_num = l_tab_lines.
    lt_objpack-doc_type = 'RAW'.
    APPEND lt_objpack.
    Create Message Attachment
    Write Packing List (Attachment)
    LT_OBJHEAD = 'TEST.XLS'.
    APPEND LT_OBJHEAD.
    DESCRIBE TABLE it_attach LINES l_tab_lines.
    READ TABLE it_attach INDEX l_tab_lines.
    lt_objpack-doc_size = l_tab_lines * 255.
    lt_objpack-transf_bin = 'X'.
    lt_objpack-head_start = 1.
    lt_objpack-head_num = 1.
    lt_objpack-body_start = 1.
    lt_objpack-body_num = l_tab_lines.
    lt_objpack-doc_type = 'RAW'.
    lt_objpack-obj_name = 'ATTACHMENT'.
    lt_objpack-obj_descr = 'TEST.XLS'. "#EC *
    APPEND lt_objpack.
    Create receiver list
    LOOP AT s_name.
    lt_reclist-receiver = s_name-low.
    lt_reclist-rec_type = 'B'.
    APPEND lt_reclist.
    ENDLOOP.
    Send Message
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = ls_docdata
    put_in_outbox = ''
    TABLES
    packing_list = lt_objpack
    object_header = lt_objhead
    contents_bin = it_attach
    contents_txt = lt_objtxt
    receivers = lt_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.
    IF sy-subrc = 0.
    Document sent
    MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.
    ELSE.
    Document <&> could not be sent
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH ls_docdata-obj_name.
    ENDIF.
    ENDFORM. " F_SEND_MAIL
    *&      Form  CREATE_XLS_FILE_DATA
    form CREATE_XLS_FILE_DATA .
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
                       " DATA_RETRIEVAL
         CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
                                " BUILD_XLS_DATA_TABLE
    endform.                    " CREATE_XLS_FILE_DATA

  • Send Excel as attachment in Email

    Hi,
    I have an excel file attached as the original to a DIR.
    I want to send this excel file as an attachment in the external email.
    I am retrieving the data contents of original file in binary format using CVAPI_DOC_CHECKOUTVIEW
    Then I am converting binary to text using SCMS_BINARY_TO_TEXT
    and then sending the email with the data file as attachment using SO_DOCUMENT_SEND_API1.
    However, this attachment does not open when its type is .xls
    It does open with .txt, but the file is distorted and in non-understanable format.
    Regards,
    Reema

    hi,
    Check this Out...
    REPORT  ZEMAIL_ATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    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:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *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.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY
    Regards,
    Santosh

  • Sending Excel as attachment in Email (Unicode)

    Hi,
    I'm using SO_NEW_DOCUMENT_ATT_SEND_API1 FM to send excel attachments as emails to external addresses.
    However, this the SAP upgrade to ECC6.0 from R/3 4.6B
    then I cannot open BIG5 char excel, who does know how to sending Unicode excel as attachment in email.
    the Excel can show Chinese , BIG5 code ,Japanese ,Korea .
    OR which new funciton module in ECC6.0 like SO_NEW_DOCUMENT_ATT_SEND_API1 FM .
    Regards,
    Hank

    Hey,
    try this one.
        lv_string = str_data1.
          cl_bcs_convert=>string_to_solix(
            EXPORTING
              iv_string   = lv_string
              iv_codepage = '4103'  "suitable for MS Excel, leave empty
          iv_add_bom  = 'X'     "for other doc types
            IMPORTING
              et_solix  = binary_content
              ev_size   = size ).
        CATCH cx_bcs.
          MESSAGE e445(so).
      ENDTRY.
            send_request = cl_bcs=>create_persistent( ).
    Now  create document object from internal table with text
    document = cl_document_bcs=>create_document(
              i_type    = 'RAW'
              i_text    = main_text
              i_subject = l_var ).     
           document->add_attachment(
              i_attachment_type    = 'xls'                               i_attachment_subject = ' Details'                      i_attachment_size    = size
              i_att_content_hex    = binary_content ).
        add document object to send request
            send_request->set_document( document ).
        --------- add recipient (e-mail address) -----------------------
        create recipient object
            recipient = cl_cam_address_bcs=>create_internet_address( abc at abc.com).
           recipient = cl_cam_address_bcs=>create_internet_address( 'abc at abc.com' ).
        add recipient object to send request
            send_request->add_recipient( recipient ).
            sent_to_all = send_request->send( i_with_error_screen = 'X' ).
            COMMIT WORK.
    This will definitely work .if any doubts aask me.
    Neeraj

  • Urgent: Sending an Email with Excel sheet attachment

    Hi All,
    I am preparing a report and has to send mail with excel sheet attachement. In report i am getting everything fine. But in the mail i am not getting the data, data is passing to the FM succesfully. But in the mail, excel is not having full data.
    the below mentioned is my code.
    i_texts-line = c_stern.
      i_texts-line+254(1) = c_newline.
      APPEND i_texts.
      LOOP AT i_texc.
        i_att_line-line = i_texc.
        APPEND i_att_line.
      ENDLOOP.
      DATA: wa_doc_chng LIKE sodocchgi1.
      DATA: w_tab_lines LIKE sy-tabix.
      STATICS: c_body_start TYPE i VALUE '1'.
      CONSTANTS: lc_filename(10) TYPE c VALUE 'Attachment',
                 lc_atthead(30)  TYPE c VALUE 'Manually released invoices'.
      DATA: i_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: w_doc_name(30) TYPE c.
      DATA: l_text1(15),
            l_text2(12),
            l_text3(15),
            l_text4(15),
            l_text5(14),
            l_text6(17),
            l_text7(10),
            l_text8(20),
            l_text9(19),
            l_text10(19),
            l_text11(19),
            l_text12(16),
            l_text13(20),
            l_text14(19),
            l_text15(19),
            l_text16(30).
      DATA: DATE(10),
            DT(2),
            MON(3),
            YR(4),
            lc_final(50).
      CLEAR: i_texts, i_reci,i_att_line.                "i_bname,
      REFRESH: i_texts, i_reci,i_att_line.              "i_bname,
      WRITE sy-datum TO w_datex.
      WRITE sy-uzeit TO w_timex.
      l_text1 = text-003.
      l_text2 = text-004.
      l_text3 = text-005.
      l_text4 = text-006.
      l_text5 = text-007.
      l_text6 = text-008.
      l_text7 = text-009.
      l_text8 = text-010.
      l_text9 = text-011.
      l_text10 = text-012.
      l_text11 = text-013.
      l_text12 = text-014.
      l_text13 = text-015.
      l_text14 = text-016.
      l_text15 = text-017.
      l_text16 = text-026.
      CONCATENATE
      l_text1
      l_text2
      l_text3
      l_text4
      l_text5
      l_text6
      l_text7
      l_text8
      l_text9
      l_text10
      l_text11
      l_text12
      l_text13
      l_text14
      l_text15
      l_text16
      INTO i_texts SEPARATED BY
      c_horz_tab.
      i_texts-line+254(1) = c_newline.
      APPEND i_texts.
      CLEAR  i_texts.
      LOOP AT i_texc.
        i_att_line-line = i_texc.
        APPEND i_att_line.
      ENDLOOP.
      LOOP AT so_rec.
        i_reci-receiver = so_rec-low.
        i_reci-express = 'X'.
        i_reci-rec_type = 'U'.
        APPEND i_reci.
      ENDLOOP.
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      READ TABLE i_texts INDEX w_tab_lines.
      wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
      wa_obj_name   = 'ZFI_XX_REL_BLOCKED_INVOICE_01'.
      DT  = SY-DATUM+6(2).
      MON = SY-DATUM+4(2).
      YR  = SY-DATUM+0(4).
      CONCATENATE DT MON YR INTO DATE SEPARATED BY '-'.
      CONCATENATE lc_atthead date into lc_final separated by ' '.
      MOVE lc_final
                   TO wa_obj_descr .
      wa_doc_chng-obj_name  = wa_obj_name.
      wa_doc_chng-obj_descr = wa_obj_descr.
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 0.
      i_objpack-body_num = w_tab_lines.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
      APPEND LINES OF i_att_line TO i_texts.
      LOOP AT i_arseg INTO wa_arseg.
        i_xmplt_d-belnr = wa_arseg-belnr.
        i_xmplt_d-budat = wa_arseg-budat.
        i_xmplt_d-bukrs = wa_arseg-bukrs.
        i_xmplt_d-lifnr = wa_arseg-lifnr.
        i_xmplt_d-name1_lifnr = wa_arseg-name1_lifnr.
        i_xmplt_d-wrbtr = wa_arseg-wrbtr.
        i_xmplt_d-waers = wa_arseg-waers.
        i_xmplt_d-ebeln = wa_arseg-ebeln.
        i_xmplt_d-ebelp =  wa_arseg-ebelp.
        i_xmplt_d-reason = wa_arseg-reason.
        i_xmplt_d-dmeng = wa_arseg-dmeng.
        i_xmplt_d-dwert = wa_arseg-dwert.
        i_xmplt_d-bname = wa_arseg-bname.
        i_xmplt_d-name_text = wa_arseg-name_text.
        i_xmplt_d-udate = wa_arseg-udate.
        i_xmplt_d-comment =  wa_arseg-comment.
        APPEND i_xmplt_d.
      ENDLOOP.
      LOOP AT i_xmplt_d.
        CONCATENATE i_xmplt_d-belnr
                    i_xmplt_d-budat
                    i_xmplt_d-bukrs
                    i_xmplt_d-lifnr
                    i_xmplt_d-name1_lifnr
                    i_xmplt_d-wrbtr
                    i_xmplt_d-waers
                    i_xmplt_d-ebeln
                    i_xmplt_d-ebelp
                    i_xmplt_d-reason
                    i_xmplt_d-dmeng
                    i_xmplt_d-dwert
                    i_xmplt_d-bname
                    i_xmplt_d-name_text
                    i_xmplt_d-udate
                    i_xmplt_d-comment
                    INTO i_texts SEPARATED
                    BY c_horz_tab.
        i_texts-line+254(1) = c_newline.
        APPEND i_texts.
        CLEAR i_texts.
      ENDLOOP.
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      READ TABLE i_texts INDEX w_tab_lines.
      wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      i_objpack-transf_bin = ' '.
      i_objpack-head_start = 0.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = w_tab_lines.
      i_objpack-doc_type = 'XLS'.
      i_objpack-obj_name = 'Attachment'.
    i_objpack-obj_descr = w_doc_name.
      i_objpack-obj_descr = lc_filename.
      i_objpack-doc_size = w_tab_lines * 255.
      APPEND i_objpack.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
        TABLES
          packing_list               = i_objpack
          contents_txt               = i_texts
          receivers                  = i_reci
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc = 0.
        COMMIT WORK.
      ELSE.
        WRITE: / 'Error in send E-Mail' .
      ENDIF.
    please revert me asap. It is very urgent to me. thanks in advance.
    Bye

    hI
    Have you build your Excel Data table to get attachement in Mail? If no then please find the Eg. code for your reference to send Excel attachment..
    * End of Selection Event : Displaying the selected data                *
    END-OF-SELECTION.
        PERFORM EMAIL_EXCEL_ATTACHMENT.
    ******///form
    FORM EMAIL_EXCEL_ATTACHMENT .
    * Populate table with detaisl to be entered into .xls file
      PERFORM BUILD_XLS_DATA_TABLE.
    * Populate message body text
      PERFORM POPULATE_EMAIL_MESSAGE_BODY.
    * Send file by email as .xls speadsheet
      PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
                                   TABLES IT_MESSAGE
                                          IT_ATTACH
                                    USING S_EMAIL
                                          TEXT-042
                                          C_XLS
                                          'filename'
                                 CHANGING GD_ERROR
                                          GD_RECIEVER.
    *   Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    ENDFORM.                    " EMAIL_EXCEL_ATTACHMENT
    ********///form BUILD_XLS_DATA_TABLE
    FORM BUILD_XLS_DATA_TABLE .
      DATA :    LV_NETWR(20)     TYPE C,
                LV_BOL_DATE(20)  TYPE C,
                LV_KAWRT(20)     TYPE C,
                LV_FKDAT(20)     TYPE C,
                LV_WAERK(20)     TYPE C,
                LV_KURRF(20)     TYPE C,
                LV_SHIPDATE(20)  TYPE C,
                LV_DEPTDATE(20)  TYPE C.
      CONSTANTS:
          CON_TAB  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
          CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.  "#EC *
      DATA STR TYPE STRING.
    **********/ this parameter concatenate to get headers
      CONCATENATE STR
      'SLNO'
      'OWNER'
      'SERIAL NO'
      'FROM'
      'DESTINATION'
      'INVOICE VALUE'
      'DESCRIPTION'
      'CUSTOMER NAME'
      'BL NUMBER'
      'BL DATE'
      'VESSEL NAME/AIRLINE DETAILS'
      'MODE OF TRANSIT'
      'SHIPPING MARKS'
      'DUTY SUM INSURED'
      'FLAG'
      'OPEN COVERNO'
      'INVOICE DATE'
      'INVOICE NO'
      'LC WORDING'
      'QUANTITY'
      'PACKAGING DETAILS'
      'BASIS OF VALUATION'
      'EXCLUDE WAR SRCC'
      'CURRENCY'
      'EXCHANGE RATE'
      'ADDRESS'
      'VESSEL BUILT YEAR'
      'VESSEL FLAG'
      'VOYAGE NO'
      'SHIPMENT DATE'
      'DEPARTURE DATE'
      'SURVEYOR COUNTRY'
      'SURVEYOR CITY'
      'SURVEYOR AGENT'
      'SURVEYOR ADDRESS'
      'EXPORT CONSIGNMENT'
      'CONTAINER DETAILS'
      CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
      LOOP AT IT_FINAL.
    *******/ this is to pass body / row data
        WRITE : IT_FINAL-NETWR    TO LV_NETWR,              "#EC UOM_IN_MES
                IT_FINAL-BOL_DATE TO LV_BOL_DATE,
                IT_FINAL-KAWRT    TO LV_KAWRT,              "#EC UOM_IN_MES
                IT_FINAL-FKDAT    TO LV_FKDAT,
                IT_FINAL-WAERK    TO LV_WAERK,
                IT_FINAL-KURRF    TO LV_KURRF,
                IT_FINAL-SHIPDATE TO LV_SHIPDATE,
                IT_FINAL-DEPTDATE TO LV_DEPTDATE.
        CONCATENATE
               STR
               IT_FINAL-SLNO
               IT_FINAL-OWNER
               IT_FINAL-SRNO
               IT_FINAL-PORT_LOAD
               IT_FINAL-PORT_DSCHR
               LV_NETWR
               IT_FINAL-DESCRIP
               IT_FINAL-CUSTNAME
               IT_FINAL-BOL_NUM
               LV_BOL_DATE
               IT_FINAL-VESSELNAME
               IT_FINAL-SHP_TYPE
               IT_FINAL-SHP_MARK
               LV_KAWRT
               IT_FINAL-FLAG
               IT_FINAL-OPEN_CONO
               LV_FKDAT
               IT_FINAL-VBELN
               IT_FINAL-LC_WORD
               IT_FINAL-QUANT
               IT_FINAL-PACKDETL
               IT_FINAL-INCO1
               IT_FINAL-EXCWSR
               LV_WAERK
               LV_KURRF
               IT_FINAL-ADDPAY
               IT_FINAL-VESSBYR
               IT_FINAL-VESSFLG
               IT_FINAL-VOY_FLY_NO
               LV_SHIPDATE
               LV_DEPTDATE
               IT_FINAL-SURCOUNT
               IT_FINAL-INCO2
               IT_FINAL-EXPORT_CON
               IT_FINAL-SURAGT
               IT_FINAL-SURADD
               IT_FINAL-CONTRNO
       CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
      ENDLOOP.
      CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
        EXPORTING
          TEXT      = STR
        TABLES
          FTEXT_TAB = IT_ATTACH.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    ******// form POPULATE_EMAIL_MESSAGE_BODY
    FORM POPULATE_EMAIL_MESSAGE_BODY .
      REFRESH IT_MESSAGE.
      IT_MESSAGE = TEXT-043.  " Please find attached Insurance Certificate details
      APPEND IT_MESSAGE.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    *******'/ form SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       text
    *      -->PIT_MESSAGE           text
    *      -->PIT_ATTACH            text
    *      -->P_EMAIL               text
    *      -->P_MTITLE              text
    *      -->P_FORMAT              text
    *      -->P_FILENAME            text
    *      -->P_ATTDESCRIPTION      text
    *      -->P_SENDER_ADDRESS      text
    *      -->P_SENDER_ADDRES_TYPE  text
    *      -->P_ERROR               text
    *      -->P_RECIEVER            text
    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.       "#EC *
      DATA: LD_ERROR    TYPE SY-SUBRC,                          "#EC *
    *        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.                         "#EC *
    *  ld_email   = p_email.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT              = P_FORMAT.
      LD_ATTDESCRIPTION      = P_ATTDESCRIPTION.
      LD_ATTFILENAME         = P_FILENAME.
      LD_SENDER_ADDRESS      = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    * Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    * Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME  = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    * Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      DESCRIBE TABLE IT_ATTACH LINES W_CNT.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         W_CNT * 255 + STRLEN( IT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU  = SY-LANGU.
      W_DOC_DATA-OBJ_NAME   = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR  = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PIT_ATTACH[].
    * Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'raw'.
      APPEND T_PACKING_LIST.
    * Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM   = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE   =  LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR  =  LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME   =  LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE   =  T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    * Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      LOOP AT S_EMAIL.
        T_RECEIVERS-RECEIVER = S_EMAIL-LOW.
        T_RECEIVERS-REC_TYPE = 'U'.
        T_RECEIVERS-COM_TYPE = 'INT'.
        T_RECEIVERS-NOTIF_DEL = 'X'.
        T_RECEIVERS-NOTIF_NDEL = 'X'.
        APPEND T_RECEIVERS.
      ENDLOOP.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOC_DATA
          PUT_IN_OUTBOX              = 'X'
          SENDER_ADDRESS             = LD_SENDER_ADDRESS
          SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = W_SENT_ALL
        TABLES
          PACKING_LIST               = T_PACKING_LIST
          CONTENTS_BIN               = T_ATTACHMENT
          CONTENTS_TXT               = IT_MESSAGE
          RECEIVERS                  = T_RECEIVERS
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
    * Populate zerror return code
      LD_ERROR = SY-SUBRC.
    * Populate zreceiver return code
      LOOP AT T_RECEIVERS.
        LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
      ENDLOOP.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *******/form
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM INITIATE_MAIL_EXECUTE_PROGRAM .
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE = 'INT'
                    WITH OUTPUT = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *********end of code to trigger mail in excel format....
    If any other help please let me know......
    I am sure this example code will help you to resolve your problem...
    please analyse above code for your requirement...
    In my scenario the message you said is not displaying.....
    Reward Points

  • Issue with excel email attachment after upgrade

    Hi ,
    We have recently upgraded from ECC 5.0 non-unicode to ECC 6.0 unicode version.
    An existing program converts the data in an internal table into HTML code and then sends this as an email attachment(XLS format) using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Now if the mail attachment is sent from the non-unicode system , excel converts the HTML code and shows the data perfectly but when i open the mail attachment from the unicode system, the HTML code sits in a cell of the excel and therefore data is not visible.If i wish to see the data, i will have to cut the data from the cell and paste it .
    I anticipate that this is because of some issue with the unicode.
    Your inputs towards the issue resolution are highly appreciated.
    Thanks,
    Avanish Joshi

    I found the note 1151258 and as mentioned in it, i used the BCS class for sending excel attachments and it worked.
    My sincere apologies for not replying to those who posted queries to this question.
    Thanks.

  • Reg: Mail attachment

    Hi friends,
    1. I have created a report by using the function module 'SO_DOCUMENT_SEND_API1' to send mail to
    the user with attachments.But in my report i can able to send only one attachment. Now I want to send more
    than one attachment in the mail. How can i send?
    2. while using document type 'XLS' type , I can able to get '.XLS' attachment but i cant get the attached datas
    in correct alignment. Instead of getting line items one by one, i am getting all the line item details in a single line in the excel
    sheet. How can i clear this problem? Thanks in advance...
    Regards,
    Sakthivel.VT

    hi,
    yes you can send more then one attachment in a mail.
    see below/:-
    DATA:objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE, " internal tables declared for sending attachments to the mail
    "*Attachment
      n = 1.                                    "for sending 1st attachment
      DESCRIBE TABLE objbin1 LINES tab_lines.
      objpack-doc_size = tab_lines * 255.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = n.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'XLS'.
      docdata-obj_name = 'Excel_File_Attachment1'.
      objpack-obj_descr = 'Excel File Attachment1'.
      APPEND objpack.
      n = n + tab_lines.                       "for sending 2nd attachment
      DESCRIBE TABLE objbin2 LINES tab_lines.
      objpack-doc_size = tab_lines * 255.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = n.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'XLS'.
      docdata-obj_name = 'Excel_File_Attachment2'.
      objpack-obj_descr = 'Excel File Attachment2'.
      APPEND objpack.
      n = n + tab_lines.                       "for sending 3rd attachment
      DESCRIBE TABLE objin3 LINES tab_lines.
      objpack-doc_size = tab_lines * 255.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = n.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'XLS'.
      docdata-obj_name = 'Excel_File_Attachment3'.
      objpack-obj_descr = 'Excel File Attachment3'.
      APPEND objpack.
    *Create the list of recipients
      reclist-receiver = p_email1.
      reclist-rec_type = 'U'.
      reclist-express = 'X'.
      APPEND reclist.
    *Send the e-mail by using this function module
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = docdata
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = objpack
          contents_bin               = objbin_final
          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.
      COMMIT WORK.
    regards
    Ritesh

  • Mail attached dimension

    Dear all.
    I've a problem with the e-mail attached generated with a background process.
    If I want to automatically send a spool coming from a background job (e.g. a list from MB52), I obtain the follow situation.
    In SP01 I can see a spool of 68 pages; in the email I receive, I can see 18 pages; the same happens if I send the mail internally trough the SAP Office.
    Can anyone help me with this topic?
    Thanks in advance for your effort.
    Matteo

    Use the "attach" button to add the picture, then right-click or control-click the picture, and choose "View as icon".
    If you want to be extra-sure, go to the "Format" menu and choose "Make Plain Text" (if your only option is "Make Rich Text" then you're already sending a plain text message). But you lose text formatting too if you do this.
    But keep in mind that mostly changes your view of the email message. What other people see when they get their message depends on what software they are using to read their email. Some software just displays image attachments, no matter what you do when attaching them.
    Also, they can always download the images, even if they are displayed as embedded. Again, it doesn't matter much what you do, it's more an issue of  what software the other person is using to read their messages.

Maybe you are looking for

  • Newbie starting a database app need direction/suggestions

    I've been mucking about with C# and SQL databases for some time now and I've decided its time to try a serious project. I want to create an application for managing on the job training at work. I have played around the last week with SQLCE and making

  • Cant find my pictures on my phone

    so i just got a new iphone 5 and i synced it to my itunes... at the bottom where it says whats on your phone it says i have 220 photos but they are no where to be found i can only find 40 of them...

  • Adding styles to custom as3 components

    I understand how to add styles to custom components in Flex but can anyone shed light on the correct way to define a background image style in the class constructor? i.e what is the correct "type" for a backgroundImage: [Style(name="backgroundImage",

  • Unable to view ComboBox inside AdvancedDataGridColumn

    Hello, First I ahve to say that I am a beginner in Flex domain. I am trying to show options in combobox inside an AdvancedDataGridColumn. In total I have two columns. One is a regular data column and the other is a ComboBox. I am able to see the firs

  • Help!!! can't find domain file

    I wanted to update to iweb 08, but can't find the domain file, it's just anywhere!! Iweb works fine and I can save anything, because of that I think the domain file should be somewhere, shouldn't it? How can I find it if spotlight doesn't? Ist there