How to download report output to excel file??

Hi all,
I have a problem with downloading a report output to an excel file? May i know is there any functions or methods to do it?
My situation is like this. I used Write function to print out the report. After user click on the execute button. The report output will show to the user in a table format. And there is one button 'Save To Excel' in the report output dipslay screen for user to click to save it into excel format.
Appreciate if you could help.
Thanks.
Regards,
Rachel

Hi Rachel,
       You can use FM GUI_DOWNLOAD for transferring the data from your report program into excel sheet.
And while saving give the filename extension as .xls.
Reward if helpful.
With regards,
Syed

Similar Messages

  • HOW TO DOWNLOAD SAP OUTPUT TO EXCEL FILE

    Hi SAP Gurus,
        I would like to ask if you have any Function Module or codes on how to download SAP Output into Excel file. Thanks! Hope you could help me.

    You can transfer the contents of internal table to excel using this code..
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    *  CALL METHOD OF H_EXCEL 'OPEN' EXPORTING  #1 = 'C:DMC_REC.XLS'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.                    " FILL_CELL

  • How to export report output into excel file

    hi friends,
    i would like to get the solution from you for how to export the report output into a .xls file. i know how to convert it into .rtf and .txt files but i think it's difficult to do this .xls way, could you help me to comeover this problem?
    thankyou very much.

    The official answer is "delimited", which
    generates adequate comma or other delimited
    text. No formatting, and without extra
    effort no support for non-ASCII characters.
    Might be sufficient for you.
    Note that Excel can read html files - we
    built programs to generate html files with
    name of "blah.xls" and some Excel-ish
    extensions, so Excel is automatically opened
    and the document is all nice and pretty.
    (Oracle html output has some odd logic about
    choosing number of columns, we didn't use
    it.)
    -- Allan Plum

  • How to export report output into excel.

    Hi all
    how to export report output into excel sheet can any on give me answer step by step please as soon as possible
    kk

    Hi Prashanth,
    If you are executing Query from WAD  ---> Right click on Table (only on Characteristics Data)  --> Enhanced Menu ---> Export as --> CSV file or MS Excel
    assign points if this helps,
    Thanks,
    Sudhakar

  • How to Download displayed output to Excel Using Bsp Application

    Hi Experts,
    please give me some idea because I am New In BSP.
    How to Download displayed output to Excel Using Bsp Application.
    If any sample code please do send me.
    In my condition I am getting data in  2-3 table view formats on one page and i want download that in Excel.
    please help me.
    Regards & Thanks,
    Yogesh

    Hi,
    This is more a question for the BSP forum.
    Anyway, as such it's realy easy since you can use HTML in order to import to Excel. All you need to do is add
    runtime->server->response->set_header_field( name = 'Contnet-Type'
    value = 'application/vnd.ms-excel' ).
    runtime->server->response->delete_header_field( name = 'Cache-Control' ).
    runtime->server->response->delete_header_field( name = 'Expires' ).
    runtime->server->response->delete_header_field( name = 'Pragma' ).
    Also check threads like
    Download BSP data into Excel
    export bsp-table to excel
    Export BSP Table to Excel
    Eddy
    PS. Reward useful answers and earn points yourself

  • Convert report output into excel file

    hiii,
    Can we convert output of report into excel file format?
    Plz tell me the.
    Thanks in advance

    Hello,
    http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_paptoexcel.htm
    29 Building a Report for Spreadsheet Output
    Regards

  • Report output on excell file

    Hi,
    I am running a report as
    desformat=spreadsheet destype=file desname=c:\ssss.xls
    now after getting the message "SUCCESSFULLY RUN" this file is generating in server's c: drive, is there anyway to save it on the local PC from where the report is being run? or to open the .xls file just after running the report?
    Thanks
    I have got the solution.
    Thanks
    Edited by: Suman... on Mar 6, 2012 3:01 AM

    Run report with destype=cache and mimetype=application/vnd.ms-excel. Now your report output will open in MS Excel. Then you can save the output.

  • ALV report output to excel file, zip it and send to email

    my requirement is to run a report then the result will be sent to email. Attachment is an excel file that is zipped since file size is about 25MB
    I've search several forums and found a sap template in sending email with excel file attachment, it is BCS_EXAMPLE_7
    but it should be zipped, what i found is this CL_ABAP_ZIP, but with my understanding, the file needs to be in PDF format to be able to zip
    has anyone had the same requirement before?
    Would be thankful to your input guys, thanks!

    any ideas guys?

  • How to download internal structure in Excel file ?

    Hi,
    In a ABAP 4.7 program, we need to download internal table/structures in a excel file. Automatically (as manually with breakpoint and Excel export button),
    The SAP_CONVERT_TO_XLS_FORMAT doesn't work (empty file) certainly cause non STANDARD TABLE used.
    There is various internal tables/structures, see one below
    TYPES:
      BEGIN OF gty_rup,
        kunnr                   LIKE           bsid-kunnr,
        xref1                   LIKE           bsid-xref1,
        xref3                   LIKE           bsid-xref3,
      END OF gty_rup.
    TYPES:
      BEGIN OF gty_rup_tiers,
        zztie                   LIKE           bseg-zztie,
        zzdat                   LIKE           bseg-zzdat,
        zzsea                   LIKE           bseg-zzsea,
      END OF gty_rup_tiers.
    TYPES:
      BEGIN OF gty_data_solde,
        wrbtr                   LIKE           bsid-wrbtr,
        shkzg                   LIKE           bsid-shkzg,
        belnr                   LIKE           bsid-belnr,
        hkont                   LIKE           bsid-hkont,
        buzei                   LIKE           bsid-buzei,
        bldat                   LIKE           bsid-bldat,
        gjahr                   LIKE           bsid-gjahr,
        blart                   LIKE           bsid-blart,
      END OF gty_data_solde,
    DATA:
      BEGIN OF lt_prps            OCCURS         0,
        key_client              TYPE           gty_rup,
        key_tiers               TYPE           gty_rup_tiers,
        data                    TYPE           gty_data_solde,
      END OF lt_prps.
    Does someone know function working with only the table/structure name as parameter ?
    Thanks
    Herve

    here's what I did....I opened the xfile2.txt with Excel 2007 and stepped through the import wizard as a tab-delimited file.  You're quite right it seems about the XLS function module.... I couldn't get a file downloaded that I could open with that thing.  So I dropped it and just did the following:
    TYPES: BEGIN OF gtypx.
    INCLUDE TYPE gty_rup.
    INCLUDE TYPE gty_rup_tiers.
    INCLUDE TYPE gty_data_solde.
    TYPES END OF gtypx.
    DATA: lt_prps TYPE STANDARD TABLE OF gtypx WITH HEADER LINE.
    START-OF-SELECTION.
      lt_prps-kunnr = '1234'.
      APPEND lt_prps.
      LOOP AT lt_prps.
        WRITE:/ lt_prps-kunnr.
      ENDLOOP.
      DATA:  lv_filen type string value 'c:\xfile2.txt'.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *     BIN_FILESIZE                    =
          filename                        = lv_filen
         FILETYPE                        = 'ASC'
    *     APPEND                          = ' '
         WRITE_FIELD_SEPARATOR           = 'X'
    *     HEADER                          = '00'
    *     TRUNC_TRAILING_BLANKS           = ' '
    *     WRITE_LF                        = 'X'
    *     COL_SELECT                      = ' '
    *     COL_SELECT_MASK                 = ' '
    *     DAT_MODE                        = ' '
    *     CONFIRM_OVERWRITE               = ' '
    *     NO_AUTH_CHECK                   = ' '
    *     CODEPAGE                        = ' '
    *     IGNORE_CERR                     = ABAP_TRUE
    *     REPLACEMENT                     = '#'
    *     WRITE_BOM                       = ' '
    *     TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *     WK1_N_FORMAT                    = ' '
    *     WK1_N_SIZE                      = ' '
    *     WK1_T_FORMAT                    = ' '
    *     WK1_T_SIZE                      = ' '
    *     WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *     SHOW_TRANSFER_STATUS            = ABAP_TRUE
    *   IMPORTING
    *     FILELENGTH                      =
        tables
          data_tab                        =  lt_prps
    *     FIELDNAMES                      =
    *   EXCEPTIONS
    *     FILE_WRITE_ERROR                = 1
    *     NO_BATCH                        = 2
    *     GUI_REFUSE_FILETRANSFER         = 3
    *     INVALID_TYPE                    = 4
    *     NO_AUTHORITY                    = 5
    *     UNKNOWN_ERROR                   = 6
    *     HEADER_NOT_ALLOWED              = 7
    *     SEPARATOR_NOT_ALLOWED           = 8
    *     FILESIZE_NOT_ALLOWED            = 9
    *     HEADER_TOO_LONG                 = 10
    *     DP_ERROR_CREATE                 = 11
    *     DP_ERROR_SEND                   = 12
    *     DP_ERROR_WRITE                  = 13
    *     UNKNOWN_DP_ERROR                = 14
    *     ACCESS_DENIED                   = 15
    *     DP_OUT_OF_MEMORY                = 16
    *     DISK_FULL                       = 17
    *     DP_TIMEOUT                      = 18
    *     FILE_NOT_FOUND                  = 19
    *     DATAPROVIDER_EXCEPTION          = 20
    *     CONTROL_FLUSH_ERROR             = 21
    *     OTHERS                          = 22
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • Save ALV report output as excel file in background

    Hi all,
    As the no. of records is huge and the running time is long, I'd like to modify my program to be able to run in background mode with excel as output..
    Is there any method to generate the result list in ALV format and save it as an excel file while running the program in background mode?
    And any limitation?
    Thanks!

    Try to create ALV output to spool in background then try to use any of the below mentioned fm
    SAP_CONVERT_TO_XLS_FORMAT
    MS_EXCEL_OLE_STANDARD_DAT
    RSPO_DOWNLOAD_SPOOLJOB
    RH_START_EXCEL_WITH_DATA
    or
    create CSV using OPEN DATASET & TRANSFER

  • ALV ( How to save the output as Excel file whenever we runs the Report )

    Hi,
          Can any one please let me know , how we can automatically save a ALV Grid Display report in Excel Format in presentation server whenever we execute the Report.
    Regards
    Avi.

    Hi,
    This report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Please note that this example maybe slow at filling the excel table
    (perhaps four fields per second on a 900 MHz machine - almost 30 seconds
    for a short example).
    To get the data on properties and methods - there is a bit of smoke and mirrors
    going on here; they are EXCEL properties and methods, not sap ones - so you need
    to look at excel help to determine how a particular function is structured. then
    build the block in sap, as shown in the example.
    If you only want to transfer the data to Excel like when you transfer the data from
    ALV to Excel simply use the Function Modules:
    XXL_SIMPLE_API
    If you want more modifications when you transfer it to Excel use:
    XXL_FULL_API
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • How to Schedule Report Output in EXCEL (.cvs) format for Planning 11.1.2.1

    Hi all,
    I'm using Planning 11.1.2.1 for entering data and generating reports manually via Workspace. I wanna set up an automation process with a batch scheduler.
    I've gone over the documentation. I've read about creating batches first then scheduling batches next.
    However, the biggest issue I have is that I want to extract all my reports into EXCEL Spreadsheet (.cvs) format and according to the docs, it only supports output in PDF or HTML for 11.1.2.1.
    Is this true? Is there a way to work around this by using Business Rules at command prompt?
    Thanks,
    N

    If you have the Financial Report open there are two options:
    - in the bottom right hand corner of the report click the link: "Export In Query ready Mode"
    (this opens the report so you can use it as an Excel retrieve)
    - from the Hyperion menu, select File>Export>Excel
    (this exports the headers as objects and the data grid, so you can manipulate in Excel).
    Cheers, Iain

  • How to Generate Report Output to Flat File

    Hi All,
    how to generate a report's output to a flat file(fixed length file).
    Thanks and appreciated.

    Hi
    In the object navigator u have a node called builtin packages. in that you can see text_io package.and in help you can have a detailed exaplination abt that. if your version is 9i then search in web for webutil program which also does the same work.
    Thank you
    Sasi

  • How to generate report output in csv file and send it to user email inbox

    Hi All,
    We have requiremnt to generate the csv file from the report (Bex query)automatically and need to send that file automatically to user email address every week.
    It should be done automatically and one more thing the file name should contain that particuar date
    for example if we generate file automatically today the file name should be like below.
    US_04_15_2009.CSV
    Any one have any ideas?
    Regards,
    Sirisha

    Hi Arun Varadarajan.
    Thanks for your reply.We are in BI 7.0.Can you tell me how to  broadcast the query as CSV.Please let me know  if there is any possiblity to display or change the file name dynamically  based on system date.
    Regards,
    Sirisha
    Edited by: sirisha Nekkanti on Apr 16, 2009 4:08 AM

  • How to download a text, bat, excel file from a page

    Hi All,
    I have written a jsp code that will list all the present in a particular folder. Those are displayed as links and on click, I want to download the file (pop-up message with the option to open or save it)...
    But this is working properly for files like .exe, .pdf, .so etc. But when I am trying to download a .txt, .dat, .xls or .jpg (even .bat or .zip) files, it's getting opened in the same browser (files like .doc, .xls or .zip are opening in unreadable format). Even if, I right click on the link and click on 'Save Target As...', the file is getting saved as .html format.
    I am attaching the jsp code:
    <%@ page import = "java.io.File"%>
    <h3><u>Right-click on the link and select 'Save Target As...' to download</u></h3>
    <%
         String directory = "C:/My Drive/my_context/my testings/file upload 2/files/";
         File file = new File(directory);
         File[] content = file.listFiles();
         for (int i=0; i<content.length; i++)
    %>
              <a href="./files/<%=content.getName()%>"><%=content[i].getName()%></a>
              <br>
    <%
    %>
    <br><br>
    BACK
    But I don't think that there is anything to do with the code. Can anybody help me on this.
    Thanks in Advance,
    Ujjal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi All,
    I have written a jsp code that will list all the present in a particular folder. Those are displayed as links and on click, I want to download the file (pop-up message with the option to open or save it)...
    But this is working properly for files like .exe, .pdf, .so etc. But when I am trying to download a .txt, .dat, .xls or .jpg (even .bat or .zip) files, it's getting opened in the same browser (files like .doc, .xls or .zip are opening in unreadable format). Even if, I right click on the link and click on 'Save Target As...', the file is getting saved as .html format.
    I am attaching the jsp code:
    <%@ page import = "java.io.File"%>
    <h3><u>Right-click on the link and select 'Save Target As...' to download</u></h3>
    <%
         String directory = "C:/My Drive/my_context/my testings/file upload 2/files/";
         File file = new File(directory);
         File[] content = file.listFiles();
         for (int i=0; i<content.length; i++)
    %>
              <a href="./files/<%=content.getName()%>"><%=content[i].getName()%></a>
              <br>
    <%
    %>
    <br><br>
    BACK
    But I don't think that there is anything to do with the code. Can anybody help me on this.
    Thanks in Advance,
    Ujjal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • TS2771 both cameras on my iPod touch 4 gen (iOS 6.1.2) haven't worked since i updated the software. any ideas?

    my ipod touch has been through a lot before this issue and the cameras have always worked. it wasn't until i updated the sotware on the ipod that the camera "shutters" haven't opened. at first i thought nothing of it because before when that would ha

  • Missing .wmv .movie files on conversion to Mac

    I recently upgraded to a mac OSX 10.8.4 and have loaded Photoshop Elements 10.  I am trying to find a number of movie files that are .wmv files. There are about 10 files in all.  I have them all saved in a folder MacintoshHD/Users/saved files.  About

  • Oracle OLEDB PRovider with ASP

    hi, Can anyone provide me a piece of code which demonstrates how to call an Oracle sp from asp using the Oracle OLEDB provider. I would also appreciate if the Oracle package code could be provided too, since with the Provider we have to have a differ

  • OTL- Timecard: How can associate Project with Time

    Hello gurus, I have an OTL requirement where users are required to enter no more than 8 hours of sick time a week. I have an idea on how to accomplish this but I am not sure how to count the hours when Project = Sick. Can somebody give me an idea how

  • OLAP or Datagrid to present

    Hello, I have been struggling with this and would appreciate if anyone can guide me here. I am getting a resultset from a database and I need to present it in a particular format. I tried with DataGrid and it doesnt work, I read through OLAP document