How to process Excel attachment contents?

I'm looking to read excel attachments to an instance and use attachment contents in the process. Any help will be highly appreciated.
Thnx,
MK
Edited by goelmk at 11/19/2007 10:19 AM

I can think of two alternatives:
1- Use COM (introspect Excel, and use it to open the files)
2- Use a Java library that can read Excel (for example:
http://poi.apache.org/ )
You must first download the attachment to a temporary folder. The filename
should be unique (i.e.: you can use the instance number as part of the
name 'this.id.number')
The following code should download all attachments:
bytesWritten as Int
fileName as String
files as String[]
//Download all attachments
for each attachment in attachments
do
     fileName = attachment.fileName + "_" + this.id.number
     writeFromBinaryTo BinaryFile
          using data = attachment.contents,
               name = fileName,
               append = false
          returning bytesWritten
     if bytesWritten != attachment.contentSize then
          //Something is wrong, handle de error...
     else
          files[] = fileName
     end
end
for each file in files
do
     //Use the desired API to process each of the files
end
Which choice of API you use, depends on the environment, performance
constraints, etc. If you choose COM, you must make sure that the
downloaded files are available on the machine where the COMBridge is
running (for example by using a network share), and that you're not
overloading Excel (i.e. not too many concurrent instances, Excel is not
intended for heavy concurrent use).
POI should be easier to work with, but your mileage may vary depending on
how 'standard' the Excel files are (macros that run on load, probably
won't work).
Hope this helps,
Juan
On Mon, 19 Nov 2007 15:19:36 -0300, Manoj Goel wrote:
I'm looking to read excel attachments to an instance and use attachment
contents in the process. Any help will be highly appreciated.
Thnx,
MK
Edited by goelmk at 11/19/2007 10:19 AM--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Similar Messages

  • How to process SOAP attachment at web service??

    Hi
    I am implementing a web service to upload a file to server using SOAP message. How do I get to know that SOAP msg contains attachment and if so how to process it?
    Please help.

    Hi Praveen,
    Thanks for your help...
    I am new to web services and I am running short of the time to implement the sample code...
    Can you guide me to the step by step sample code for the same if you have one?
    Any how the link seems to be usefulllllllllllll
    thanks once againnnnn

  • Please tell me How to send   excel file content  to   MAILBOX

    Hello ,
    Can anybody tell me how to send  Excel  file  data to  Mailbox

    Hi,
    Check this sample code.
    INITIALIZATION .
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    gf_etb = cl_abap_char_utilities=>horizontal_tab. "For horrizontal tab
    gf_cr = cl_abap_char_utilities=>cr_lf. "For enter
    gf_lf = cl_abap_char_utilities=>newline. "For new line
    Declaration
      DATA:    lwa_hd_change TYPE sood1,
               lt_objcont    TYPE STANDARD TABLE OF soli,
               lwa_objcont   TYPE soli,
               lt_receivers  TYPE STANDARD TABLE OF soos1,
               lwa_receivers TYPE soos1 ,
               lt_att_cont   TYPE STANDARD TABLE OF soli,
               lwa_att_cont  TYPE soli,
               lt_packing    TYPE STANDARD TABLE OF soxpl,
               lwa_packing   TYPE soxpl,
               lf_sent       TYPE sonv-flag,
               lf_size       TYPE i.
      CONSTANTS: lc_obj(11)  TYPE c VALUE 'BOMSouthco',
                 lc_desc(20) TYPE c VALUE 'BOM Download',
                 lc_lang(1)  TYPE c VALUE 'E',
                 lc_raw(3)   TYPE c VALUE 'RAW',
                 lc_net(1)   TYPE c VALUE 'U',
                 lc_mail(4)  TYPE c VALUE 'MAIL',
                 lc_xls(3)   TYPE c VALUE 'XLS',
                 lc_ext(3)   TYPE c VALUE 'EXT'.
    Passing values to the strutures used in SO_OBJECT_SEND function module
      lwa_hd_change-objla      = lc_lang.
      lwa_hd_change-objnam     = lc_obj.
      lwa_hd_change-objdes     = lc_desc.
      lwa_hd_change-objlen     = 255.
      lwa_objcont-line = text-t29.
      APPEND lwa_objcont TO lt_objcont.
      CLEAR lwa_objcont.
      lwa_receivers-recextnam  = text-t31.
      lwa_receivers-recesc     = lc_net.
      lwa_receivers-sndart     = lc_mail.
      lwa_receivers-sndex      = 'X'.
      lwa_receivers-sndpri     = 1.
      lwa_receivers-mailstatus = 'E'.
      APPEND lwa_receivers TO lt_receivers.
      CLEAR lwa_receivers.
      lwa_receivers-recextnam  = text-t30.
      lwa_receivers-recesc     = lc_net.
      lwa_receivers-sndart     = lc_mail.
      lwa_receivers-sndex      = 'X'.
      lwa_receivers-sndpri     = 1.
      lwa_receivers-mailstatus = 'E'.
      APPEND lwa_receivers TO lt_receivers.
      CLEAR lwa_receivers.
    Passing values for the attachment file
      LOOP AT gt_output INTO gwa_output.
        CONCATENATE gf_lf  gwa_output-matnr  gf_etb  gwa_output-idnrk  gf_etb
                    gwa_output-type   gf_etb  gwa_output-menge   gf_etb
                    gwa_output-meins  gf_etb  gwa_output-comp    gf_etb
          INTO lwa_att_cont-line.
        APPEND lwa_att_cont TO lt_att_cont.
        CLEAR lwa_att_cont.
      ENDLOOP.
      CHECK lt_att_cont IS NOT INITIAL.
      DESCRIBE TABLE lt_att_cont LINES lf_size.
      lwa_packing-transf_bin = ' '.
      lwa_packing-head_start = 1.
      lwa_packing-head_num   = 0.
      lwa_packing-body_start = 1.
      lwa_packing-body_num   = lf_size.
      lwa_packing-file_ext   = lc_xls.
      lwa_packing-objlen     = lf_size * 255.
      lwa_packing-objtp      = lc_ext.
      lwa_packing-objdes     = lc_desc.
      lwa_packing-objnam     = lc_obj.
      APPEND lwa_packing TO lt_packing.
      CLEAR lwa_packing.
      CHECK gf_error IS NOT INITIAL. "Check if unix file is written
    FM to send email to the intended recipients
      CALL FUNCTION 'SO_OBJECT_SEND'
        EXPORTING
          object_hd_change           = lwa_hd_change
          object_type                = lc_raw
        IMPORTING
          sent_to_all                = lf_sent
        TABLES
          objcont                    = lt_objcont
          receivers                  = lt_receivers
          packing_list               = lt_packing
          att_cont                   = lt_att_cont
        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
          originator_not_exist       = 20
          x_error                    = 21
          OTHERS                     = 22.
      IF sy-subrc = 0.
        MESSAGE s004 WITH text-t34.
      ENDIF.
      COMMIT WORK.
    Reward if helpful.
    Regards,
    Ramya

  • How to format excel attachment through ABAP?

    Hi Experts,
    I am using FM ''SO_DOCUMENT_SEND_API1' to generate an email with excel attachment. Does anybody know if there is any way to format the contents of excel attachment? For example, framing, coloring or making the fields bold etc.
    Any inputs will be helpful.
    Thank you,
    Amol

    Hi,
    Check this blog.
    Downloading data into Excel with Format Options
    Thanks,
    Sree.

  • How to process Excel through JDBC

    Hi, there!
    In windows,we could build an ODBC Driver for excel,then how to write the sql statment to query and update the content of the excel through JdbcOdbcDriver?
    I have create an ODBC DataSource named Register,the excel file is RegisterInfo.xls and the name of the sheet that My data was stored in is RegisterInfo,How should I do?
    Thanks a lot.

    Your JDBC driver class is sun.jdbc.odbc.JdbcOdbcDriver
    The connection URL is jdbc:odbc:<name of your DSN>
    (I'm not sure how you would treat spaces in the DSN name, so I'd leave them out)
    To see the data
    SELECT * FROM "RegisterInfo$"
    Don't forget the quotes around the table name, because I'm not sure if the $ at the end isn't somehow interpreted. If you have spaces in the table name (=Worksheet) you need them anyway. The same goes for any columns that have a space in their name.
    Thomas

  • How to customise Siebel Attachment Content Check-In Form?

    I've customised my search form using the rules and now all the field from search form appears in the check-in form. How to customise fields list for the check-in form?
    Thanks in advance.

    Hi jiri.machotka
    I Know this link but what i want to do is generating dynamically a sub form (in checkin form) depending on choice
    For example when my choice is Person it generate a sub form containing
    Name (input with its label)
    Firstname
    Lastname
    Age
    Regard
    CABDiop

  • Excel with contents in web dynpro for ABAP application

    Hi Experts,
    I have excel file (example "http://xxxx/test.xls") with contents in remote system. I want to incorporate this excel file into my web dynpro application. For this I used Officecontrol UI element and set the following properties for Officecontrol
    1. datasource : binding with context attribute DATAS(xstring)
    2. document type : ms_excel
    I wrote code the following code in WDDOMODIFYVIEW method.
    data :   content TYPE xstring,
               url TYPE string VALUE 'http://xxx/test.xls'.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text           = url
    IMPORTING
       BUFFER         = content .
    wd_context->set_attribute( name = 'DATAS' value = content ).
    while running my application, I getting excel without contents and with one message "SAP IOS". Please suggest how to display excel with contents in view of my application.
    Can any one help me.....
    Thanks & Regards
    Sridhar

    >
    sridhar vadaga wrote:
    > Hi Experts,
    >
    >
    > CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    >   EXPORTING
    >     text           = url
    >  IMPORTING
    >    BUFFER         = content .
    >
    >
    > Thanks & Regards
    > Sridhar
    I think you are overestimating the power of the SCM_STRING_TO_XSTRING function module.  By supplying a URL as the value of the input text, it isn't going to magically go read the content from the remote location and convert that to a binary string.  It is going to take whatever value you supply in th importing TEXT parameter convert that to binary.  In other words it is literally converting the string http://xxx/test.xls to binary.  You will need some other mechanism to read the content from the remote location into ABAP memory before you can process it.  You will need to use the CL_HTTP_CLIENT class or call some sort of web service to retrive the content.

  • File to Mail with content as excel attachment

    Hi there,
    Can somebody please guide me in achieving this goal.
    I have a requirement in which I have to send the email content as an excel attachment which is very new to me.
    Requirement
    File.............XI............Mail
    Sender File: xyz.xml
    Mapped with standard mail.xsd and concat all the requested filed to the content but now the requirement is changed and I need to send the content as an excel attachment.
    I don't know JAVA & ABAP and this is the first time I am using mail adapter.
    Can somebody please guide me how to achieve this.
    In Another interface I have to send the source file name as a mail attachment, By Default mail adapter send the filename as untitled.
    Is there easy way to changed the name of the attachment to the source file name.
    File ............... XI.........Mail.
    Source file: xyz.xml
    No mapping required just send the file to the mail adapter but condition is that the file name should be the same.
    Mail (Attachment: xyz.xml)
    Please can somebody suggest me how to achieve this.
    Thanks,

    Hi,
    Please refer the blogs given which help you a lot regarding your requirement.
    /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    /people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
    /people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    /people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

  • How to get(copy) the contents i.e the cell of an excel sheet to other excel

    How to get(copy) the contents i.e the cells of an excel sheet to another excel sheet.
    I can read the contents i.e the text in the cells and able to display it in the Java console
    i want these contents to be copied to another excel sheet with the cells data.
    I am using Java Swing for the UI, POI framework for the excel work.
    Please anyone suggest some code to this requirement.

    [spreadsheets with poi|http://poi.apache.org/spreadsheet/converting.html] Hi
    on the poi apache site there's a number of good examples...
    I started with poi only a week ago, but just from reading these examples
    (especially SS Usermodel code) i managed all i needed to know (so far).
    kind regards
    BB
    Edited by: BugBunny on Feb 22, 2010 4:36 AM

  • How to display service for object (attachment content ) in script

    hi all
    In me23n we find services for object like attachment, private note, workflow etc...
    i need to display the attachment content in script ..
    how could i do this ? 
    any body give your valuable inputs to bring solution.
    Regards
    deepika

    Hi,
           Configure it for document type SDIORDER.
    sirish

  • Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Numbers does not have rotated text within cells.  You can place a text box over the cell that has rotated text but you cannot rotate text within a cell.

  • Process of incoming mails including Excel attachment

    Hello Forum,
    we are looking for a possibility to process incoming e-mails including an Excel attachment.
    We are already able to receive e-mails in SAP, but we are not able to process/read the attachment in Excel format.
    I already checked the blogs of Thomas Jung and Gregor Wolf, but both didn't help for the XLS-attachments.
    Any ideas? Please help...
    Thanks
    Matthias

    Okay, so the question is not really about mail (that's just the context).
    I deduce from "Excel = hex" that you have to process native Excel files. In that case, this will be an issue as SAP doesn't offer software to decode native files.
    From ABAP, the only possibility is to use OLE2 (ABAP statements CREATE OBJECT ... OF, CALL METHOD ... OF, etc.) but that can only work when code is executed in dialog workprocesses, that is not the case here as you are processing inbound mails.
    So, I think you can only:
    1) ask users to save Excel files as any text type (CSV, XML...)
    2) delay the processing of the native excel files, users will have to later launch online (dialog) transactions that will read these files using OLE2
    3) get a specialized software (free or not) to read native Excel files
    4) Install a server (Microsoft OS) with Excel installed (licence cost probably), which will be called by SAP to decode the file and return the result

  • How to send pdf or excel attachment as saved alv layout in email

    Hi Guru,
    I am developing a report in which, i am sending report as excel attachment after clicking a button on top of alv grid, and pdf attachment after clicking another button on top of alv grid. I am sending mail by two ways they are:
    1) I am populating my internal table value in separate internal table and converting that to string and sending email as excel attachment.
    2) And am converting report as spooljob, and using abapspool 2 pdf function module i am converting spool to pdf, after that am send that pdf as mail attachment.
    Now my requirement is i need to send email attachment as layout which is displayed in the alv screen, even i hide a column and  change the  layout  it is going with all the columns. What should i do for this problem.
    Regards,
    Rithika

    Hi,
    Check if the below steps will solve the problem.
    * Get the run time ALV layout (field catalog) using the below method.
         data: r_grid TYPE REF TO cl_gui_alv_grid.
         CALL METHOD r_grid->get_frontend_fieldcatalog
              IMPORTING
                   et_fieldcatalog = t_fcat.
    * Adjust the download table according to t_fcat.

  • How to handle more than 250 characters in excel attachment

    hi,
    i lokesh, actually i am sending a excel attachment through mail. i am using " SO_DOCUMENT_SEND_API1" function module, one problem what i facing is , this function module handle only 250 characters, i need to display more than 250 characters. pls any one knows about this, pls let me know.
    regards
    lokesh t

    Hi,
    Xls allows only 250 char.
    Cheers

  • How do I get Payload + Attachment-content into 1 xml using PayloadSwapBean?

    Hi all,
    For a customer I have to poll on a specific email-address on a mailserver until a mailmessage appears, read the attachment (.txt) and transform it to a destination-messagetype. For this purpose, I have used the XI-mailadapter (XIPAYLOAD) and the PayloadSwapBean. I now get the attachment-content in XI and can work with it. So far, so good...
    Now the problem is: I need not only the attachment-content, but also the payload of the mail-xml (with data like sender, CC, subject, body, etc). When I use the PayloadSwapBean, I only get the content from the attachment and I do not get the payload-data. When I do NOT use the PayloadSwapBean, I only get the payload-data and not the attachment-content....
    Is there a way to get both payload (of the email-message) AND attachment-content in 1 file, using this PayloadSwapBean?
    Thanks in advance for your help!
    Regards
    William

    This is not possible. You need a self-written adapter module to achieve this.
    Regards
    Stefan

Maybe you are looking for

  • Using new 7.3 Integrated Configuration Directory Services Objects

    I am trying to use the new IntegratedConfiguration objects. I can get the wsdl, create the classes and run everything in my local PC. However when I try to deploy the generated jar file in the PI 7.3 ESR it fails because some of the generated names f

  • What is the best program to create professional slideshows?

    Hi everyone, I'm only using stills. I've just started a trial of (my first Adobe product) Premiere Elements 13. Finding it slower to learn than some easier to use slideshow software I've trialed. I want to be able to hi-light specific sentences in im

  • Too close to the exchange to get Infinity???

    Hi, I wonder if anyone can verfiy te following please?.   I live on the outskirts of Reading and have been told by a neighbour, who managed to speak to someone at BT, that in our road we are never likley to be able to get BT Infinity the reason being

  • Named parameters support

    where can i get another driver except the ( JdbcOdbcDriver ) as it doesn`t support named parameters in the CallableStatement Thanks

  • How to access the contact list before i had updated.

    how to access the contact list before i had updated IOS7. My contact list has gone now....