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.

Similar Messages

  • How to send huge no. of excel sheet attachment to a mail ID

    HI ,
            I have mail functionality program which send mail to a mail id with multiple excel sheet attchment. I have done all these things.  When it sends small number of excel attchment  then it's ok. But when  it sends huge number of excel attchment (ex.- 1000 excel attchment) then it showing error message to the mail  id -
       'This message is larger than the size limit for messages. Please make it smaller and try sending it again.'
    I have used cl_bcs, cl_document_bcs these class. I have seen all related post in sdn but unable to get my requirement.
    i need your suggestion.

    Hi,
    Try this code::
    FORM MAIL_SEND .
      *Mail Body
      MOVE text-004 TO wa_text.  "Space
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE TEXT-003 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE text-005 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE TEXT-003 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE text-011 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      tl_contents[] = wt_text.
      TRY.
        TRY.
    **-- Create persistent send request
          l_send_request = cl_bcs=>create_persistent( ).
          CATCH CX_SEND_REQ_BCS.
       ENDTRY.
    *-- Get the length of the Document
          DESCRIBE TABLE tl_contents LINES l_cnt.
          READ TABLE tl_contents INTO wa_contents INDEX l_cnt.
          l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( wa_contents ).
    *-- Subject of the mail
          l_sub = 'TEST1'.
          I_SUBJECT = 'BP assignment report for Credit analyst and CrSeg'.
    **-- Create Document
          l_document = cl_document_bcs=>create_document(
                 i_type       = c_htm
                 i_text       = tl_contents
                 i_length     = l_doc_len
                 i_subject    = I_SUBJECT "'BP assignment report for Credit analyst and CrSeg
                 i_language   = sy-langu
                 i_importance = '1' ).
        CATCH CX_DOCUMENT_BCS.
    **-- Subject of the mail
          MOVE l_sub TO l_subj.
      ENDTRY.
      TRY.
    *-- Set the Message Subject
          CALL METHOD l_send_request->set_message_subject
            EXPORTING
              ip_subject = l_subj.
        CATCH CX_SEND_REQ_BCS.
      ENDTRY.
    **-- Add document to send request
      try.
          CALL METHOD l_send_request->set_document( l_document ).
        CATCH CX_SEND_REQ_BCS.
      endtry.
      CALL FUNCTION 'SPLIT_FILENAME'
        EXPORTING
          long_filename  = 'C:\BP_DETAILS.XLS'
        IMPORTING
          pure_filename  = p_name
          pure_extension = p_ext.
      TRANSLATE p_ext TO UPPER CASE.
      elpath = 'C:\BP_DETAILS.XLS'.
    *Upload the file
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = elpath
          filetype                = 'BIN'
        TABLES
          data_tab                = t_ann
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      try.
          IF t_ann[] IS NOT INITIAL.
    *-- File name of the Attachment
            l_subject  = p_name.
    *-- Extension of the Attachment
            l_att_type = p_ext.
            TRY.
                w_document = l_document.
    *-- Add Attachment to the Document
                CALL METHOD L_document->add_attachment
                  EXPORTING
                    i_attachment_type    = l_att_type
                    i_attachment_subject = l_subject
                    i_att_content_hex    = t_ann. "t_mailhex.
              CATCH cx_document_bcs.
            ENDTRY.
          ENDIF.
    *-- Do send delivery info for successful mails
          lv_msg = 'E'.
          CALL METHOD l_send_request->set_status_attributes
            EXPORTING
              i_requested_status = lv_msg  "Error status
              i_status_mail      = lv_msg. "Error status
          TRY.
              send_request = l_send_request->send_request.
            CATCH cx_bcs.
          ENDTRY.
    set outbox flag
          TRY.
              CALL METHOD send_request->set_link_to_outbox( 'X' ).
            CATCH cx_bcs.
          ENDTRY.
    request error status
          TRY.
              CALL METHOD send_request->setu_requested_status( req_stat ).
            CATCH cx_bcs INTO l_bcs_exception.
          ENDTRY.
    *-- Set sender
          l_sender = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD l_send_request->set_sender
            EXPORTING
              i_sender = l_sender.
          gs_mail-e_mail = 'mail ID1'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          gs_mail-e_mail = 'mail ID2'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          gs_mail-e_mail = 'mail ID3'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          loop at gt_mail into gs_mail.
            try.
                l_recipient = cl_cam_address_bcs=>create_internet_address(
                                                                    gs_mail-e_mail ).
              catch cx_address_bcs.
            endtry.
            CALL METHOD l_send_request->add_recipient
              EXPORTING
                i_recipient = l_recipient
               i_express   = 'X'
                i_copy      = 'X'.
          endloop.
    *-- Send Email
          CALL METHOD l_send_request->send(
              EXPORTING
                i_with_error_screen = 'X'
              RECEIVING
                result              = l_result ).
        CATCH cx_bcs INTO l_bcs_exception.
      ENDTRY.
      COMMIT WORK.
    ENDFORM.
    Thanks

  • Problem in opening of word and excell files downloaded from email attachment in MS office professional 2013 paper licence

    Hi,
    I am facing the problem in opening the word and excel files received through email in my MS office professional 2013 paper licence, Microsoft Windows 8.1 enviornment. please help in this matter
    regards
    Rajeev Bhagwat
    Administrative Officer-I
    Purchase and Store Section
    UGC-DAE Consortium for Scientific Research,
    University Campus, Khandwa Road, Indore (M.P.), India.
    Telefax-+917312361546

    I should further say the files I sent are .xlsx and .docx files.  They look fine my end and I send such files all the time without problems.
    However, I did try to cheat by going in via the Safari onto my 'live' online email account and the Safari automatically transfers them to winmail.dat files with the same result.
    Ahh - have just been on using my PC this time and you are right, it seems that the service provider does the transfer and then when my outlook opens the file (on the PC), it must reconvert to .xlsx etc again.
    Very strange.
    Ergo, I guess the question should be how I open wimail.dat files ??

  • Distinguishing between CSV and Excel file formats

    I am trying to distinguish between CSV and Excel files.   Most of the files I need to process are CSV, but some have been opened and re-saved in Excel format.  I know about the Excel toolbox available, but haven't used it yet. 
    I need to be able to open a spreadsheet file regardless of if it is in CSV or Excel format.  Any help would be greatly appreciated.
    Here are two example files, one CSV and one Excel.  Both have .XLS file extensions. 
    Attachments:
    20-4-XLS.xls ‏21 KB
    20-5-CSV.xls ‏8 KB

    Hi Paul,
    I think the matter is not the extention (xls or csv or whatever) but the format of the data written in your file.
    To see what I mean, open the xls file you posted with notepad... What does it look like ?
    You have tobe sure of the format of the file you want to read so that you can develop an appropriate VI... if you want to be able to read different type of data format, do a test before reading the file and then use an appropriate routine for each format.
    Hope this helps you...
    BTW, to read the one named CSV, a simple "read from spreadsheet file" VI will do the job
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • After I Update to IOS 7.1 I can't open the excel file attached in  my email

    After I updated my Iphone 5s from IOS7.0.6 to IOS7.1 when i check my email i can't open excel file attached in my email i check with my frineds phone thy have same issoue

    David_PDX wrote:
    Hi Alex,
    The trick to this whole thing is to scroll to the bottom of the message. There should be a dashed line at the bottom of the email message with text underneath it that says, "This message was downloaded as plain text." Underneath that it should say (in blue hyperlink text) "Download full message". Select that hyperlink, and the Excel file should download completely. You should then be able to select the document and have it open correctly.
    I have had the same concern regardless of file format that is sent, so I do not believe your issue is with file format. Hope this helps.
    I've seen the same thing happen with images, which it displays in a corrupted form. It's fixed by downloading the full message.
    There's a more serious side effect of this, which I've now seen with several types of files. If one FORWARDS the email to someone else, the attached files it sends them are CORRUPTED and unopenable too. In the case of a Word files I looked at, it had dropped the last two bytes of the file.
    The workaround for that is to download the full message before forwarding.
    I'm seeing this happening with so many types of attachments that I'm assuming it affects them all. Please everyone report this to Apple feedback (http://www.apple.com/feedback/). It's one thing not being able to open a file on your device, it's another to have files corrupted permanently just by forwarding.

  • Convert the spool to xls format and email through attachment to the user

    Hi all,
    When I execute a report in background, I get spool. I need to convert the spool to xls format and email through attachment to the user.The xls file should not be saved on local system.
    If I use the Spool Recepient tab in SM37 it mails the spool list as .txt file to the mail receipient. But I need to send it as an .xls file.
    Can any one help me on this

    Did you get the solution? i have the same problem.

  • Formating an excel file by BSP Download

    I have made a BSP application which can dowload file into an excel file.But now i have a requirement in which i have to format the excel file with colour and cell width.I have to colour the column  header of the excel file with some colours like blue,red etc.
    Please suggest me how we can achieve this?
    Thanks and regards,
    Manish Kumar

    Hi Manish,
    This can be achieved using javascirpts and active x objects. Check this wiki,
    http://wiki.sdn.sap.com/wiki/display/CRM/DownloaddatafromwebuitoExcelandPPT
    Regards,
    Arun

  • How to send HTML Format Mail using Java Mail in oracle 9i Forms

    Dear All
    could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
    if it is possible, could you please send me the sample code? please very urgent
    Thanks
    P.Sivaraman

    Hello,
    <p>Here is a Form sample.</p>
    Francois

  • Email with html body and a pdf attachment

    Hi,
    i try to send a email with html body and one attach in pdf
    in release 4.6c using the SO_DOCUMENT_SEND_API1.
    I've put the html in the txt table and the pdf in bin table but i obtain the following situation:
    1) with only the html in the body i see a right email in html
    2) with the html body AND the pdf attach i obtain a empty mail with two attach.
    what can i do ? I's possible to do this.
    Thanks in advance.

    Contact my basis guy is a problem !!
    maybe a need a function similar to SX_OBJECT_CONVERT_RAW_TXT to convert raw (containing html text) into real html ?
    my view V_SXCONV contain:
    ALI     HTM     2     SX_OBJECT_CONVERT_ALI_HTM
    ALI     PS     4     SX_OBJECT_CONVERT_ALI_PRT
    ALI     RAW     1     SX_OBJECT_CONVERT_ALI_RAW
    ALI     TXT     2     SX_OBJECT_CONVERT_ALI_TXT
    ICS     RAW     8     SX_OBJECT_CONVERT_ICS_RAW
    INT     RAW     8     SX_OBJECT_CONVERT_INT_RAW
    OBJ     HTM     2     SX_OBJECT_CONVERT_OBJ_HTM
    OTF     PCL     3     SX_OBJECT_CONVERT_OTF_PRT
    OTF     PDF     1     SX_OBJECT_CONVERT_OTF_PDF
    OTF     PS     2     SX_OBJECT_CONVERT_OTF_PRT
    OTF     RAW     9     SX_OBJECT_CONVERT_OTF_RAW
    RAW     SCR     6     SX_OBJECT_CONVERT_RAW_SCR
    RAW     TXT     7     SX_OBJECT_CONVERT_RAW_TXT
    SCR     OTF     1     SX_OBJECT_CONVERT_SCR_OTF
    TXT     INT     7     SX_OBJECT_CONVERT_TXT_INT
    URL     HTM     2     SX_OBJECT_CONVERT_OBJL_HTM
    thanks a lot.

  • End the result of an sql query by Email as an excel file attachement

    Hi,
    I would like to create a PL/SQL function that send the result of an sql query by Email as an excel file attachement.
    i'm newbie in pl/sql an d i dont know if it's possible to do such task.
    regards,

    i think a regular expression is he way to go in your case...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Macro to compare CSV and Excel file

    Team,
    Do we have any macro to compare CSV and Excel file.
    1) In Excel we should have two text boxes asking the user to select the files from the path where they have Stored
    2) First Text is for CSV file
    3) Second Text box is for Excel file
    4) We Should have Compare button that should run the Macro and Show the Differences.
    Thanks!
    Kiran

    Hi
    Based on my understanding, we need to convert the 2 files into the same format before comparing two different formats files. 
    Here are the options:
    1. Convert the CSV file and Excel file into 2-dim Arrays, then compare them, about how to load a CSV file into VBA array, you can search it from
    internet or ask a solution in VBA forum.
    VBA forum:
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
    2. Also you can import CSV file to Excel sheet, and then compare them.
    Here is the sample code for your reference:
    ‘import csv file
    Sub InputCSV()
    Dim Wb As Workbook
    Dim Arr
    Set Wb = GetObject(Application.GetOpenFilename("csv file,*.csv", , "please choose a csv file", , False))
    Arr = Wb.ActiveSheet.Range("A1").CurrentRegion
    Wb.Close False
    Range("A1").Resize(UBound(Arr), UBound(Arr, 2)) = Arr
    End Sub
    ‘compare sheet
    Sub CompareTable()
    Dim tem, tem1 As String
    Dim text1, text2 As String
    Dim i As Integer, hang1 As Long, hang2 As Long, lie As Long, maxhang As Long, maxlie As Long
     Sheets("Sheet1").Select
    Columns("A:A").Select
    With Selection.Interior
    .Pattern = xlNone
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    Range("A1").Select
    Sheets("Sheet2").Select
    Rows("1:4").Select
    With Selection.Interior
    .Pattern = xlNone
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    Range("A1").Select
    MaxRow = 250
    MaxColumn = 40
    For hang1 = 2 To maxhang
    Dim a As Integer
    a = 0
    tem = Sheets(1).Cells(hang1, 1)
    For hang2 = 1 To maxhang
    tem1 = Sheets(2).Cells(hang2, 1)
    If tem1 = tem Then
    a = 1
    Sheets(2).Cells(hang2, 1).Interior.ColorIndex = 6
    For lie = 1 To maxlie
    text1 = Sheets(1).Cells(hang1, lie)
    text2 = Sheets(2).Cells(hang2, lie)
    If text1 <> text2 Then
            Sheets(2).Cells(hang2, lie).Interior.ColorIndex = 8
    End If
    Next
    End If
    Next
    If a = 0 Then
    Sheets(1).Cells(hang1, 1).Interior.ColorIndex = 5
    End If
    Next
    Hope this will help.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Best way to view and edit OpenOffice files on my new iPad Mini (originally Word and Excel files). Thanks!

    Can someone tell me the best way to view and edit OpenOffice files on my new iPad Mini (originally Word and Excel files)? Thanks!

    wmf files is a MS Windows video file, you will need a tool to covert the wmf files to another file format OS X will read. Simply Google to find a converter you are interested in and use it.

  • My mac is converting Word and Excel files into Pages and Numbers files when I click to open them (or download and open them) from an email. I do I get this to stop? It's really aggravating.

    My mac is converting Word and Excel files into Pages and Numbers files when I click to open them from an email. Downloading them and opening them doesn't help. How do I make this stop? I don't use iLife and don't want to; my clients are using Office and it's easier for me, except when I have to copy and paste everything they send me from an iLife file back to Word and Excel. Help!!! It's like Apple has become Microsoft, forcing us to use their apps.

    Do you have Word & Excel installed, if yes, navigate in the finder to an example of each, right click and select 'Get Info' scroll down to 'Open With' and select the appropriate program, check the box that says 'Change All'

  • Excel file attachment withiout losing leading zeros

    Hi Expert,
    Can anybody tell me how to create the Excel file attachment for email generation without losing the leading zeros.
    Regards,
    Jyotsna

    Hi,
    If you want to pass a variable with leading zeros to excel sheet, please use the following:
      CONCATENATE  '=TEXT('  l_variable ',"000")'  INTO g_errcode1.
    It will display the leading zeros in excel sheet. I have done the same way in one of my program and it is working fine..
    Thanks & Regards
    Rocky Agarwal

  • Save as pdf and excel file

    Hi All,
    Can anyone tell me how to save data available in a node(model or value) as pdf and excel files?
    Thanks in advance.....
    Bhushan Reddy.

    Bhushan,
    check these links for saving as excel
    Excel Export - Funky Column Headers
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0
    Handling FileUpload and FileDownload in NetWeaver Developer Studio(NWDS) 2004S
    New Web Dynpro Java Tutorials - Uploading and Downloading Files in SAP NetWeaver 7.0
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71
    Thanks
    Bala Duvvuri

Maybe you are looking for

  • How can I get a DNS on a virtual network to resolve hostnames on a point-to-site machine?

    Hello, I set up an Azure virtual network with the following configuration: 1 Windows DNS Server (Local IP: 10.0.1.4) 1 Windows Server (Local IP: 10.0.1.5, FQDN: perforce.redbyte.com) 1 Ubuntu Server (Local IP: 10.0.1.6, FQDN: swarm.redbyte.com) From

  • Add a button to display Adobe Form through SPRO on T-code IQS22

    Hello All, I am trying to add a button to display Online Interactive Adobe Form through SPRO on T-code IQS22 but its not working. So please suggest me how can i add a button for it ASAP. Thanks and Regards: Anugrah

  • ACS Group mapping and restrictions

    hi, I would appreciate to receive some configuration steps on ACS to fulfill the following requirement and hope you can help me. ACS Groups Netadmin - need telnet/ssh/vpn/wireless wireless - only wireless authentication vpn - only vpn authenticaiton

  • Can airport be used with a PC?

    Can my airport be connected to a friends PC and then will I have access to wifi.

  • Please help in installing in Linux Programs

    I welcome, I don't know how to install programs in Linuxie. For the beginning I would like to install the Flash Player. Can somebody help? Witam , Nie wiem jak zainstalować programy w Linuxie . Na początek chciałbym zainstalować Flash Player . Czy kt