Excel with JSP

Hi everyone
I relly do need some help...
I have an Oracle Database and I need to:
1. View my results (of any request) in an excel spreadsheet using JSP (I think this part is the easiest...)
2. And that is my real problem: Use an excel spreadsheet to insert values in the database with JSP...
I hope I made it clear because even for me it's really tricky...
Thanks a lot...
Yassi

There is a example in Marty Hal;l's book"Core Servlets and JSP pages".
It is static, but the same idea would work coming from a database.
<HTML>
<HEAD>
<TITLE>Comparing Apples and Oranges</TITLE>
</HEAD>
<BODY>
<CENTER>
<H2>Comparing Apples and Oranges</H2>
<%
String format = request.getParameter("format");
if ((format != null) && (format.equals("excel"))) {
response.setContentType("application/vnd.ms-excel");
%>
<TABLE BORDER=1>
<TR><TH></TH><TH>Apples<TH>Oranges
<TR><TH>First Quarter<TD>2307<TD>4706
<TR><TH>Second Quarter<TD>2982<TD>5104
<TR><TH>Third Quarter<TD>3011<TD>5220
<TR><TH>Fourth Quarter<TD>3055<TD>5287
</TABLE>
</CENTER>
</BODY>
</HTML>

Similar Messages

  • Problem displaying data in Excel with Jsp

    HI,
    For some reason when i save data from jsp to excel, my Excel dont display data.This code was working fine from past 3 years all of sudden it starts givin this problem.
    However When i open my .xls file in notepad i see data there. The problem is because of XML declaration (<?xml version="1.0" encoding="UTF-8"?> which parsed generate. If i remove this it works fine.
    Out put in file looks like this
    <?xml version="1.0" encoding="UTF-8"?>
    <table border=1 width="100%">
    <tr>
    <TH>Name</TH>
    <TH>Last Name</TH>
    <TH>state</TH>
    <TH>Country</TH>
    <TH>Currency</TH>
    </tr>
    <tr>
    <TD class="odd">John</TD>
    <TD class="odd">Hayden</TD>
    <TD class="odd">IL</TD>
    <TD class="odd">USA</TD>
    <TD class="odd">USD</TD>
    </tr>
    <tr>
    <tr>
    <TD class="odd">Ricky</TD>
    <TD class="odd">Ponting</TD>
    <TD class="odd">IL</TD>
    <TD class="odd">USA</TD>
    <TD class="odd">EUR</TD>
    </tr>
    </tr>
    </table>
    Jsp Code
    String rptHTML = (String)session.getAttribute("ReportStrHTML");
         System.out.println(rptHTML);
         response.setHeader("Content-Disposition","attachment;filename=Test.xls");
         response.setContentType("application/vnd.ms-excel");
    Thanks

    In Excel, Tools > Macro > security > medicum and Trusted tab check To access VB.

  • Displaying an Image in an Excel Spreadsheet with JSP - URGENT

    Hi Peoples
    I can transfer the table I am using in to excel with JSP by doing:
    <%@ page contentType ="application/vnd.ms-excel" %>
    this works fine, though I have an image that sits within the table that I want to be displayed as well.
    Can this be done?? If so how???
    Thanks

    Try to insert the image into sheet from it's URL not from it's local file path
    Best regards

  • Date can not display correctly in excel from .jsp

    Hi,
    I create a .jsp report to export the data to excel. the report run OK, except the date field can not display correctly.
    for example in database :start date ='01-oct-2003'
    in the except it displays to 02/06/02.
    It seem all the date field can not be control in the report, and control by somthing else
    Doese anyone come accross this problem?
    Thanks

    Hi Rong,
    Are you using the following demonstration to build your JSP?
    http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html
    (Output to Excel with Oracle9i Report)
    I tried to do the same, and inserted a database date field in the JSP using Reports. I found the following:
    While making the template inside Excel, if I make sure that the format of the date cells is "Date" - some particular date format, the date field values from Reports does not get exported correctly.
    However, if you make sure that inside the template, the format of the date cells is not date, but "General", then the date field values are correctly exported to Excel.
    Pl try it and let us know.
    Navneet.

  • Report printing in excel with multiple sheets

    Hi Experts,
         I am working in Oracle Reports 10g.  I need to print the report in Excel....
    For this i have created .JSP file and now printing in Excel(Sheet1).
    My requirement is i need to print the report in multiple sheets.
    For example if i run the departments report then the generated excel file should be as below
    (Sheet1 - HR, Sheet2 - FINANCE, Sheet3 - MARKETING, etc.,)
    How can i do this?
    Thanks in Advance.

    Hi All,
       Is this possible  Report printing in excel with multiple sheets??
    Please give solution for my above post Report printing in excel with multiple sheets..
    Thanks,
    Su.gi

  • How GET Output to Excel with Oracle9i Report using OC4J

    how GET Output to Excel with Oracle9i Report using OC4J.
    I FINISHED THE SETPS CONCIDERING THE JSP CODE NEEDED TO GET THE EXCEL OUTPUT ON LOCAL MACHINE.
    I NEED TO PUBLISH THIS REPORT THROUGH APPLICATION SERVER.
    THE QUESTION IS:
    1- HOW TO START AN OC4J INSTANCE FROM ORACLE 9I DS FOR THIS REPORT?
    2- WHERE (PATH) TO PUBLISH THE REPORT ON THE APPLICATION SERVER?
    3- WHAT IS THE DEFAULT URL TO RUN THIS REPORT AND WHERE TO PUT IT?
    4- HOW TO MAKE MAPPING FOR DIRECOTRY PATH TO TRANSLATED AS URL FOR THIS REPORT?
    5- IF ANY ONE CAN GIVE ME THE FULL CODE TO RUN AND CALL SIMPLE JSP REPORT TO BE VIED IN INTERNET EXPLORER.
    THANK YOU

    Hi,
    I can't answer to all your questions, however I can tell you that:
    2) The directory where to put the report file is specifiend in a file named
    <serverName>.conf
    in the sourceDire property
    <property name="sourceDir" value="/directory/dove/mettere/i/report"/>
    that you can find under ORACLE_HOME/reports/conf
    3) The URL is
    http://<server IAS address>:<port number>/<jsp file path>/<repName>.jsp?server=<report server name>&userid=<user>/<pwd>@<DB conn string>[&<param>=<valore>[&...]]
    5) In IE you have only to set the previous URL in the address bar.
    Hope this helps you
    Bye
    Raffy

  • How to generate a report in Excel with multiple sheets using oracle10g

    Hi,
    I need a small help...
    we are using Oracle 10g...
    How to generate a report in Excel with multiple sheets.
    Thanks in advance.
    Regards,
    Ram

    Thanks Denis.
    I am using Oraclereports 10g version, i know desformat=spreadsheet will create single worksheet with out pagination, but my requirment is like the output should be generated in .xls file, and each worksheet will have both data and graphs.
    rdf paperlayout format will not workout for generating multiple worksheets.
    Is it possible to create multiple worksheets by using .jsp weblayout(web source) in oracle reports10g. If possible please provide me some examples
    Regards,
    Ram

  • Running other server-side applications with JSP

    Hi,
    I'd like to know, if is possible run with JSP (Servlet, or JavaBean) other application, which support COM. I used something like this in JavaScript:
    application=new ActiveXObject("excel.application");
    and I had all possibilities of its API. I'd like to use excel as data source for user-friendly data input.
    Thanks for all suggestions

    Hi,
    I don't realy understand your question.
    If your javascript work using activeX, this code is executed on the client side (like the excel application and the excel file).
    You can, with a JSP, generate the html page that contain the script.
    Where is the problem ?

  • Excel Report JSP Exception

    Hello All,
    I am unsuccessfully following the "Output to Excel with Oracle9i Report" tutorial found at http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html to create a web-based JSP report that automatically opens in Excel within the browser. I created the template using Excel, saved this as a web page, opened this in Reports Builder, etc. Once I complete the report in Reports Builder and save it as a Reports JSP, I can successfully run this within Reports Builder using the "Run Web Layout" feature. The problem is when I try to run this JSP within my web-application in JDeveloper using the in-line reports server. The browser launches Excel, but then the ReportsTag.doStartTag() method throws a JspException (see below). Anyone seen this problem or been successful achieving this? I have a normal web-based JSP report that is running fine within JDeveloper using the reports in-line server. Also, the only way I could get my web/paper-based report to be generated in PDF format and Paginated HTML was to start a separate reports server and submit my report to the rwservlet of this server. Shouldn't I be able to use the in-line server in JDeveloper? Any help or ideas would be greatly appreciated. Thanks!
    Exception I'm getting from Excel Report: javax.servlet.jsp.JspExceptionjavax.servlet.jsp.JspException
    at oracle.reports.jsp.ReportTag.doStartTag(ReportTag.java:341)
    at jsp.reports._schedule._Excel._jspService(_Excel.java:58)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:302)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:407)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:330)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:684)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:243)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)

    Hi Bill
    Let me clarify your doubts. You can use in-process Reports server with report servlet as well as from the jsp engine. The difference here is really on what Reports you can actually run from Reports servlet and jsp engine.
    For running from Report servlet:
    http://xx.x.xx.xxx:9004/reports/rwservlet?reports=...
    You would be using report definition file [rdf/jsp] which have paper layout information included in definition. You can run these paper reports to pdf/html/rtf/delimited/delimitedata format.
    Runnig a reports from jsp engine:
    http://xx.x.xx.xxx:9004/reports/examples/<reports_name.jsp>?server=...+userid=...
    You would be running a report definition [jsp/xml] which have reports jsp tags as part of reports web layout information. Please note these web layout reports which you mention using reports jsp tags, are run under the jspengine using reports tag libraries. The only format you can generate here is html [or excel output].
    Reports in-process server is a concept where if user has not started a exclusive Report server, Report servlet, and also reports tag libraries, would start a default reports server to run the particular request. This way it would make things easy for the user and he would need to manage a seperate report server of it own.
    Thanks
    Rohit

  • Hi guys Pls tell me a way to connect db4 database with jsp and which driver

    hi guys
    Pls tell me a way to connect db4 database with jsp and
    also tell me which driver i have to use
    also tell me how to connect with excel sheets

    take a look at the follwing links. There, you'll find all what you need :
    DB4:
    http://www.oracle.com/database/berkeley-db/je/index.html
    http://www.oracle.com/technology/products/berkeley-db/je/index.html
    http://www.oracle.com/database/berkeley-db/db/index.html
    http://www.oracle.com/database/docs/berkeley-db-je-datasheet.pdf
    Excel:
    http://64.18.163.122/rgagnon/javadetails/java-0516.html
    Hope That Helps

  • Integrating JasperReports with JSPs

    I'm developing a web application using JSPs on windows 2000 machine. I'm using apache+tomcat as the web server. Using Jasper Reports for report generation.
    Currently i'm developing reports using HTML. At the bottom of that report page i've a button named 'Export to Excel'. Upon clicking it, i'm exporting the html report to excel. Since i'm unable to include header and footer information and repitition of some fields on every page, i selected Jasper Reports for report generation. My problem is i don't know how to integrate Jasper Reports with JSPs. I don't know how to create reports. I created smaple reports using iReport visual editor for jasper reports. Now i want to integrate it with my we application.
    If anyone has any idea, please inform.
    Thanks.

    RTFM
    http://jasperreports.sourceforge.net/quick.how.to.html#classes
    Main classes to use when working with JasperReports
    net.sf.jasperreports.engine.JasperCompileManager
    net.sf.jasperreports.engine.JasperFillManager
    net.sf.jasperreports.engine.JasperPrintManager
    net.sf.jasperreports.engine.JasperExportManager
    This classes represent a fa���ade to the JasperReports engine. They have various static methods that simplify the access to the API functionality and can be used to compile an XML report design, to fill a report, to print it, or to export to PDF, HTML and XML files.
    net.sf.jasperreports.view.JasperViewer
    This can be used to view the generated reports.
    net.sf.jasperreports.view.JasperDesignViewer
    This can be used to view the report design.
    http://jasperreports.sourceforge.net/tutorial/index.html
    JasperReports is a powerful open source reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files. It is entirely written in Java and can be used in a variety of Java enabled applications to generate dynamic content.
    Its main purpose is to help creating page oriented, ready to print documents in a simple and flexible manner.
    JasperReports organizes data retrieved from a relational database through JDBC according to the report design defined in an XML file. In order to fill a report with data, the report design must be compiled first.
    The compilation of the XML file representing the report design is performed by the compileReport() method exposed by the net.sf.jasperreports.engine.JasperManager class.
    Through compilation, the report design is loaded into a report design object that is then serialized and stored on disk (net.sf.jasperreports.engine.JasperReport). This serialized object is then used when the application wants to fill the specified report design with data. In fact, the compilation of a report design implies the compilation of all Java expressions defined in the XML file representing the report design. Various verifications are made at compilation time, to check the report design consistency. The result is a ready to fill report design that will be then used to generate documents on different sets of data.
    In order to fill a report design, one can use the fillReportXXX() methods exposed by the net.sf.jasperreports.engine.JasperManager class. Those methods receive as a parameter the report design object, or a file representing the specified report design object, in a serialized form, and also a JDBC connection to the database from where to retrieve the data to fill the report.
    The result is an object that represents the ready to print document (net.sf.jasperreports.engine.JasperPrint) and can be stored onto the disk, in a serialized form, for later use, or can be delivered to the printer, to the screen or can be transformed into a PDF, HTML, XLS, CSV or XML document.

  • Output to Excel with Oracle9i Report -- DEMO DOWN

    The Viewlet "Output to Excel with Oracle9i Report" (as well as the others) at
    http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html
    Does not work. I keep getting a 'Incorrect skin. Stoppting' Error.
    Please update the viewlet or make it available to email or download.
    Thanks

    Actually you don't need to see that viewlet. Just follow the easy follow-by steps in Metalink Note 240819.1 "How to Generate Excel output in browser using Reports9i JSP". This is faster done than watching the viewlet! You can use it for 9i and as well for 10g.
    Please note the reference to note 271590.1 in the end of the document. Without that it won't work on 10g.
    Regards,
    Martin Malmstrom
    ORACLE Consulting

  • Download Excel with charts

    Hi my friends
    My client has a jsp web app running on Websphere. Currently, it has a function downloading data into excel sheet
    Now, they want to download excel with charts on it
    I know it is not so hard to do in fat clients but this case, we have a jsp webapp, and i don't know how to deal with the excel charts, templates from a jsp server
    What is the best way for me to archive that requirement.
    Thank you very much

    BIJ001 wrote:
    POI can emit binary MS Office documents, but there are also text- or xml-based alternatives like csv or the newer XML-based document formats.
    In our various projects we happily use all these approaches: POI/binary, csv, xml.Thanks,
    at least there is someone here who has experience with POI. I may need help when implementing it. I have background in EJB and did lot of work with servlet, jsp too but the only front ends I worked with are Swing(and AWT) and (HTML, javascript) web page, so I have not had to learn new things for long :D
    Now, with the new job, I have to deal with various projects and lot and lot of things I haven't done or even known
    Now, we are in design phase and I 'd like to know that whether or not we can do it
    So my question should be answered "yes, we can", right?
    Here is what I plan to do
    In the servlet, I should generate an excel sheet with data. Then generate the charts based on the data to attach to the excel file.
    Finally, dump all file into the output stream

  • Controlling the data formatting in excel using jsp.

    Hi,
    How to controlling the data formatting in excel using jsp with out using external jar files such as "jexcel" and "POI". And one more limitation is that it should be compatible with java 1.2.1

    dineshniot wrote:
    Hi - Is there any possibility to automatically display the chart for the logged datas using write to measurement file or write to data file? Please let me know as soon as possible.
    Thanks and Regards,
    Dinesh
    As an aside, "data" is already a plural.  The singular is "datum."
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Upload data from excel with vba by calling a function module

    Hello all,
    i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
    Can you give me some tips how can i
    upload data from excel with vba by click a button.
    The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results. 
    How can I call the function module correct with vba?
    Thanks a lot for your tips!!!!
    Chris
    Message was edited by:
            Christoph Kirschner

    HI
    Uploading data directly from Excel file format
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    <b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    *Title : Excel Uploading
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    * END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
    *       upload excel spreadsheet into internal table
    *      -->P_TABLE    Table to return excel data into
    *      -->P_FILE     file name and path
    *      -->P_SCOL     start column
    *      -->P_SROW     start row
    *      -->P_ECOL     end column
    *      -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    * Has the following format:
    *             Row number   | Colum Number   |   Value
    *      i.e.     1                 1             Name1
    *               2                 1             Joe
      DATA : ld_index TYPE i.
    * Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
    *     MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    Regards
    Pavan

Maybe you are looking for

  • How to reset password with Terminal?

    I've just had a new HD fitted and rebooted my system from time machine, the password to access my user account does not seem to work any more. I've been advised that the thing to do is to reset it with 'terminal' Can anyone help me wi this?

  • No batch in second company code

    Hi, I have very specific requirement i.e. i am maintaining batch for a material in plant 1000 in company code 1000. This company code has already been implemented. Now i do't want batch management for the same  material in plant 2000 in company code

  • Select OM aspect by default ?

    Hello Experts, This may be a silly question but i never managed to find an answer for it. In PPOSE or PPOME, there is an option in menu 'Settings' to select an aspect, which in effect reduces the list of object types and infotypes for each of them to

  • Changes related to bug 6865629

    Can anyone tell me what were the changes made related to Bug 6865629 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6865629?

  • New Music 9-8-2009

    iTunes has not updated it's store to show all the latest releases for today, 9-8-09. Is this because of the big event tomorrow? I really would like to see all the new releases now since it is Tuesday.