Upload excel file and display content in sapui5 table

hi:all
   how to upload  excel files and display its contents in the view of sapui5  table ,then  'create ' these data into the abap database using odataservice.
     Do you have any solutions ? I appreciate for your help.

Two possible way come to mind.
1. ADF DI (desktop integration): sorry, don't know enough about it to give a how to :-(
2. POI (http://poi.apache.org/) : open source project to read and write excel file with java. Using POI you can open the .xsl file, read it's contents and display it as af:table. For this you need to read the xsl into a data structure (this can be a temporary db table or a list of POJOs) and build a data control out of it. This you can drop on a page as table.
Timo
Edited by: Timo Hahn on 15.02.2010 13:59

Similar Messages

  • Upload unicode file and display content in a textarea

    Hi all,
    I am trying to do the following;
    1. upload a unicode file (file with some non-english characters)
    2. after uploading, read the uploaded file and show the content in a textarea in a jsp page.
    I use struts in my project. I use class org.apache.struts.upload.FormFile for uploading the file. The upload works fine. I do the upload with help of FormFile's getInputStream method. When i read and display the content in the textarea, the content is displayed junk. But i tried to open the uploaded file, its fine. I mean it is just as my source file. Please help me out for reading the uploaded unicode and displayed in a textarea.
    Below is the code that i use to upload the file;
    File tempFile = null;
    FileOutputStream fos = null;
    InputStream is = null;
    try {
         tempFile = "c:/ThaiText.txt";
         fos = new FileOutputStream(tempFile);
         is = theFile.getInputStream();
         // Transfer bytes from in to out
         byte[] buf = new byte[1024];
         int len;
         while ((len = is.read(buf)) > 0) {
              fos.write(buf, 0, len);
         logger.info("fileName$$=" + tempFile.getName());
    } catch (Exception e) {
            logger.error(e);
         throw e;
    } finally {
         closeOutputStream(fos);
    }Below is the code that i use for reading the uploaded file's content and store it to a string. I set this string to a form bean's string property.
    public static String readContentNonUTF8(String path) {
         FileInputStream fis = null;
         String value = "";
         try {
              fis = new FileInputStream(path);
              byte[] buf = new byte[1024];
              int len;
              while ((len = fis.read(buf)) > 0) {
                   String tmp = new String(buf, 0, len);
                   value = value.concat(new String(tmp.getBytes()));
         } catch (Exception e) {
              logger.error(e);
         } finally {
              try {
                   fis.close();
              } catch (Exception e) {
         return value;
    }

    Hi,
    Thanks for your reply. You meant that both method also can used to upload file and submit data? How about if i want to use the first method to upload file and submit data? How can i upload the file by using first method?

  • Uploading Excel File and Reading Data from that File

    <b>Hi
    Can anyone Please tell me how to upload an Excel File in to the Web Dynpro Application and After that i want to read the data from that uploaded excel file in the Web Dynpro Application to the Web Dynpro table.
    Plz help me to solve this.......
    Regards
    Chandran</b>

    Hi,
    Upload Excel file using File Upload UI
    1)Add jxl jar folder in the lib folder of ur project.
    2)Go to properties of ur project and add jar to ur project.
    3)Using the File upload ui ,browse and upload the file.
    4)Write the read file in to ur server location using fileoutput stream.
    5)then using code u can read the excelfile from the server location itself.
    Here is the code:
         IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
    /** get the name of excel file and storing it in the server with the same name and extention****/
    binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
    fileuploaded = binaryType.getFileName();
    byte b[] = wdContext.currentContextElement().getUpload();
    File filename =new File("
    <Server name>
    <folde name>
    " + fileuploaded);
    try {
    FileOutputStream out = new FileOutputStream(filename);
    out.write(b);
    out.close();
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    /**Readind from the server**/
    int iRows = 0;
    try {     Workbook wb = null;
         Sheet sheet = null;
         wb = Workbook.getWorkbook(filename);
         sheet = wb.getSheet(0);
         int iColumns = sheet.getColumns();
          iRows = sheet.getRows();
         int i = 0;
        //get Cell contents by (COLUMN, ROW);
        for (int r = 0; r < iRows; r++) {
       for (int c = 0; c < iColumns; c++) {
         Cell cell = sheet.getCell(c, r);
         characterarray<i> = cell.getContents();
    //wdComponentAPI.getMessageManager().reportSuccess("Row"r characterarray<i>);
    i++;
    wb.close();
    Declare Globally
    //@@begin others
    String fileuploaded;
    IWDModifiableBinaryType binaryType;
    String characterarray[] = new String[1000];
    //@@end
    Also look at this blog too  /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
    Thanks and Regards,
    Arun

  • BO Data Services - Reading from excel file and writing to SQL Server Table

    Hi,
    I would like to read data from an excel file and write it to a SQL Server Data base table without making any transformations using Data Services. I have created an excel file format as source and created target table in SQL Server. The data flow will just have source and target. I am not sure how to map the columns between source and target. Appreciate your quick help in providing a detailed steps of mapping.
    Regards,
    Ramesh

    Ramesh,
    were you able to get this to work? if not, let me know and I can help you out with it.
    Lynne

  • How to open a Excel file and display on the custom screen

    Guys, I am new to screen programming. In my first screen (SCREEN #9000) I want to put a field, where I must be able to select a file from my desktop and when I click the DISPLAY button, it should suck all the data from the spread sheet in to an internal table, and should display the next screen  (SCREEN #9001), displaying the data from the internal table along with a button called LOAD. Now when I click the LOAD button after reviewing the data, it must load the data to my custom table in R/3. I know how to load an Excel spreadsheet to R/3 without the custom screens. But my requirement now is to do from custom screens like I mentioned above. Any ideas how to do this? Thanks.
    Dan

    Hi Dan,
    In my first screen (SCREEN #9000) I want to put a field, where I must be able to select a file from my desktop and when I click the DISPLAY button, it should suck all the data from the spread sheet in to an internal table, and should display the next screen (SCREEN #9001)
    For  this create a MPP program and create a Push button. Write the code for this to open a file like use f4_filename.From here you are able to select a file.
    + displaying the data from the internal table along with a button called LOAD. Now when I click the LOAD button after reviewing the data, it must load the data to my custom table in R/3.+
    With the above you are able to open a file and now you have to load that data into internal table. Select the file from the desktop.
    Totally you have to create 1) Screen 2) Push button( Open File) 3) Load data ( From file) .
    [Create Push Buttons|http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba9a635c111d1829f0000e829fbfe/content.htm]
    Check this if there is any please post.
    Regards,
    Madhu.

  • Read Excel file and insert it into a table

    Hi All
    i'm developing a web app using jdeveloper 11.1.1.3
    I want to upload an excel file to a table, is there way in the frame work to do this easily
    Tx

    convert the excel fil to a .csv file and expose the csv file as a datacontrol and then use it in the table
    http://technology.amis.nl/blog/2306/uploading-csv-files-into-dynamic-adf-faces-tables-programmtically-creating-columns

  • Calculate the sum of values in excel file and import it to SQL table using SSIS

    Hi,
    Can some one help me how to do auto sum of columns in SQL table  using SSIS
    in SQL table the HRA , PF and Basic should not come, Only it should appear in basic pay as the sum of HRA , PF and Basic...

    RSingh, Thanks for the use
    of derived column.
    Instead of using record set i used  OLE DB destination
    its working Fine...
    but now the issue is if i put a new records in excel file its replicating in SQL table 
    How to get only the changed values in excel to SQL table.

  • Loop Through Excel Files and Load into SQL Server Table

    I'm following the example here.
    https://www.youtube.com/watch?v=_B83CPqX-N4
    I'm pretty sure I did all the steps, but for some reason my project is not running.  I'm thinking there is a 32-bit or 64-bit issue lurking in here somewhere.
    Here's my error message.
    SSIS package "C:\Users\Ryan\Documents\Visual Studio 2010\Projects\Loop through Multiple Excel sheets and load them into a SQL Table\Integration Services Project1\Package.dtsx" starting.
    Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
    Error: 0xC0209303 at Package, Connection manager "Excel Connection Manager": The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000.
    An OLE DB record is available.  Source: "Microsoft OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".
    Error: 0xC001002B at Package, Connection manager "Excel Connection Manager": The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
    For more information, see http://go.microsoft.com/fwlink/?LinkId=219816
    Error: 0xC020801C at Data Flow Task, Excel Source [2]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209303. 
    There may be error messages posted before this with more information on why the AcquireConnection method call failed.
    Error: 0xC0047017 at Data Flow Task, SSIS.Pipeline: Excel Source failed validation and returned error code 0xC020801C.
    Error: 0xC004700C at Data Flow Task, SSIS.Pipeline: One or more component failed validation.
    Error: 0xC0024107 at Data Flow Task: There were errors during task validation.
    SSIS package "C:\Users\Ryan\Documents\Visual Studio 2010\Projects\Loop through Multiple Excel sheets and load them into a SQL Table\Integration Services Project1\Package.dtsx" finished: Failure.
    The program '[5392] DtsDebugHost.exe: DTS' has exited with code 0 (0x0).
    I have 32-bit Excel and 64-bit SQL Server.  Is that the issue?  Can someone tell me what's wrong here?
    Thanks!!
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Sa-weeettttttt!!  Thanks.  I figured that's what it was.  For the benefit of others, this link shows you exactly how to make the modification recommended above.
    http://help.pragmaticworks.com/dtsxchange/scr/FAQ%20-%20How%20to%20run%20SSIS%20Packages%20using%2032bit%20drivers%20on%2064bit%20machine.htm
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • SharePoint 2013 Foundation error when uploading Excel files

    Hello 
    I have a specific problem. I have an xlsx file that I cannot upload in SharePoint. Normally our SharePoint can upload Excel files and other file formats normally but this one has data with nearly 5000 rows. The size of the file is less then 500 KB. The error
    message is: "The URL is invalid. Perhaps it refers to a nonexistent file or folder, or it refers to a valid file or folder in the current Web." When I am uploading this file I am getting the same error message in every library. When I save
    the file as a 97-2003 compatible xls then it works. Sometimes even Excel files with Macros won't upload. 
    Kind regards
    ivicapro1987

    Hi,
    This issue occurs when the Version column is configured as an Indexed Column. 
    To work around this issue, remove the Version column from the list of Indexed Columns for the list that has this issue. To do this, follow these steps:
    Browse to the list where the issue exists.
    In the ribbon, click the Library tab, and then click
    Library Settings.
    In the fields list, click Indexed Columns.
    In the Indexed Columns list, click Version.
    Click Delete, and then click OK.
    Upload any files that you previously experienced the issue with.
    Reference:
    https://support.microsoft.com/kb/2796640?wa=wsignin1.0
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Reading contents of uploaded excel file in web dynpro java

    Hi All.
    I am aware how to provide facility to upload files in web dynpro java. But my requirement is that on uploading a particular file (for eg. an excel file having 10 columns), I need to read the contents of that file and store it in a table in R/3.Can anyone suggest a way how I can read the contents of the uploaded file?
    Thanks and Regards,
    Saurabh.

    Hi.
    I am having the following requirement : I have a FileUpload UI element where user clicks Browse button, selects a file from the local system and presses a Upload button. Upon pressing Upload, the name of the selected file and the contents of the file should be shown.
    In the View context, I have two value attributes: FileName of type String and FileResource of type binary.
    This is the code that I have in the Upload button action handler :
      public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload(ServerEvent)
        IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(
                 IPrivateReadExcelView.IContextElement.FILE_RESOURCE);
        IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attributeInfo.
                 getModifiableSimpleType();
        IPrivateReadExcelView.IContextElement element = wdContext.createContextElement();
        String fname = binaryType.getFileName();
        wdComponentAPI.getMessageManager().reportSuccess("File selected - "+fname);  //Statement 1
         try {
              wdComponentAPI.getMessageManager().reportSuccess("Successful");    // Statement 2
              InputStream in = new FileInputStream(fname);
              HSSFWorkbook wb = new HSSFWorkbook(in);
              wdComponentAPI.getMessageManager().reportSuccess("Successful");    //Statement 3
              int sheetsNo = wb.getNumberOfSheets();
              for (int i=0;i<sheetsNo;i++) {
                   HSSFSheet sheet = wb.getSheetAt(i);
                   Iterator rowsNo = sheet.rowIterator();
                   while(rowsNo.hasNext()) {
                        HSSFRow rows = (HSSFRow)rowsNo.next();
                        Iterator colsNo = rows.cellIterator();
                        while(colsNo.hasNext()) {
                             HSSFCell cell = (HSSFCell)colsNo.next();
                             wdComponentAPI.getMessageManager().reportSuccess("File uploaded" +
                                  "successfully");
                             if(cell.getCellType()==1) {
                                  wdComponentAPI.getMessageManager().reportSuccess("00000"+
                                       cell.getStringCellValue());
                             else if(cell.getCellType()==0) {
                                  String str=""+cell.getNumericCellValue();
                                  wdComponentAPI.getMessageManager().reportSuccess("11111"+str);
         catch(Exception e) { wdComponentAPI.getMessageManager().raisePendingException();
        //@@end
    On pressing Upload button, name of selected file is being shown(Statement 1). I am also getting Statement 2 in the output. However I am not getting Statement 3 onwards.
    Where am I going wrong? Can anyone shed some light on this?

  • Help on retriving the content from a excel file and web page

    hi,
    i need help on identify the content on a webpage. how to do this ?
    in myproject i need to read an excel file how to read an excel file , in java?
    after reading the excel file ,i have to open a webpage based on the link available in the excel file.
    how to perform this action?
    and from the web page i need to retrive the each individual text
    how to perform these action?
    please help .... urgent
    regards,
    valli

    sales team will enter data in excel file .
    the excel file will have a list of links ,
    i need to access the excel file and open that link.
    from the link i will get some information ,such as
    company name, address, phone no, contact details.
    i need to identify each individual (address, email
    id) from the web page and store that data in the data
    base .
    how to access a excel file from java?
    i found in google jakartha-poi-jar file.
    but ther eare many jar file. which one i have to
    download?
    how to identify from a web page these different
    items?
    thanksPlease answer DrClaps's question from reply #3.

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • Reading from a text file and displaying the contents with in a frame

    Hi All,
    I am trying to read some data from a text file and display it on a AWT Frame. The contents of the text file are as follows:
    pcode1,pname1,price1,sname1,
    pcode2,pname2,price2,sname1,
    I am writing a method to read the contents from a text file and store them into a string by using FileInputStream and InputStreamReader.
    Now I am dividing the string(which has the contents of the text file) into tokens using the StringTokenizer class. The method is as show below
    void ReadTextFile()
                        FileInputStream fis=new FileInputStream(new File("nieman.txt"));
                         InputStreamReader isr=new InputStreamReader(fis);
                         char[] buf=new char[1024];
                         isr.read(buf,0,1024);
                         fstr=new String(buf);
                         String Tokenizer st=new StringTokenizer(fstr,",");
                         while(st.hasMoreTokens())
                                          pcode1=st.nextToken();
                               pname1=st.nextToken();
              price1=st.nextToken();
                              sname1=st.nextToken();
         } //close of while loop
                    } //close of methodHere goes my problem: I am unable to display the values of pcode1,pname1,price1,sname1 when I am trying to access them from outside the ReadTextFile method as they are storing "null" values . I want to create a persistent string variable so that I can access the contents of the string variable from anywhere with in the java file. Please provide your comments for this problem as early as possible.
    Thanks in advance.

    If pcode1,pname1,price1,sname1 are global variables, which I assume they are, then simply put the word static in front of them. That way, any class in your file can access those values by simply using this notation:
    MyClassName.pcode1;
    MyClassName.pname1;
    MyClassName.price1;
    MyClassName.sname1

  • Can a servlet read a jsp file and display its contents?

    Hi,
    I would like to know if Servlets can read a Jsp file and display its contents.. Right now for our website, I am using a html file to be displayed after a successful post operation through the Servlets...
    -Thanks!

    I posted this in another thread.
    Here's some code that reads using a URL. This doesn't work with JSPs as the server executes JSP when it connects but it's useful for other file types. Note that the filename is a URI</h1>This is <code>show.jsp</code></h1>
    <hr>
    <%! String file = null; %>
    <%! java.io.InputStream is = null; %>
    <%
    file = request.getParameterValues("filename")[0];
    try {
       is = (new java.net.URL(file)).openStream();
    } catch (java.io.IOException ioe) { out.write(file + " not found!<br>"); }
    java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(is));
    String line = "";
    %>
    <pre>
    <%
    while((line = in.readLine()) != null) {
    %>
    <%=line%>
    <%
    %>
    </pre>

  • How to upload the tif file and Display into Iframe

    Hi all,
       My requirement is to upload 'n' number of tif files and display the file name in dropdown.
       If i select the file name, it should display the file in Iframe.
    My problem is i am not able to upload the tif file.
    try{
          byte []by=new byte[wdContext.currentContextElement().getPhotoResource().read(true).available()];
          wdContext.currentContextElement().getPhotoResource().read(true).read(by);
          String ext=wdContext.currentContextElement().getPhotoResource().getResourceType().getFileExtension();
          WDWebResourceType res=wdContext.currentContextElement().getPhotoResource().getResourceType();
          IWDResource resource=null;
          resource=WDResourceFactory.createResource(by,"sample",WDWebResourceType.getWebResourceTypeForFileExtension(ext));
           wdContext.currentContextElement().setPhoto(resource.toString());
              catch(Exception e){
    In the above code Photo is Iframe Context variable.
    If i upload tif file means it directly giving Save and Open options is giving.
    Please how to slove this probelm...........................
    Thanks,
    Suni

    Hi Satya,
    In HTML a TIF file can be displayed as"
    <html>
    <body>
    <object height="100%" width="100%"
    type="image/tiff" data="PO.tif">
    </object>
    </body>
    </html>
    Hope it helps.
    Regards,
    Alka

Maybe you are looking for