Problem downloading .xls file

Hi All,
Im getting problem when trying to export a spread sheet. Initially teh filename was hardcoded and so it was working fine in IE. The code then was
response.setHeader("Content-disposition", "attachment; filename=Details.xls");     
outStream.write(Results.toString().getBytes());
outStream.close();
later the reqmt changed to some new naming conventions for the file and so i modified the code like
SimpleDateFormat formatter = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss");
java.util.Date currentDate = new java.util.Date();
String dateString = formatter.format(currentDate);
String fileName = dateString+".xls";
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition", "attachment; filename="+fileName);
the problem im facing now is the in the pop up for download the file name is my servlet name appended with some unknown string which includes numbers and characters. the file type shown is html.If you click save open then a new html page is been displayed with all the values.
Please help me with this issue.
Thanks
Noufal

Thank you so much Shanu. Its working now. It was my carelesness or rather my ignorance which caused this prob.
But Im still having a query, the excel sheet is having a [1] appended to the file name for ex 19-Jun-2006 06-46-05[1] and the client is not happy with that.
What is the reason for that square bracket and is there any way we can cut that off? your help will be greatly appreciated.
Thanks
Noufal

Similar Messages

  • Problem downloading a file via http

    Hi
    I'm just getting started with WLS (sp5) and am having a problem downloading
    a file via http. The document is stored in the main html docs directory and
    whenever I link to it or try to download it directly (eg:
    http://<host>:<port>/myfile.doc) I get the following error in a message box:
    Your current security settings do not allow this file to be downloaded.
    Can anyone point me in the right direction as to where I grant permissions
    to do this - I've tried using the weblogic.security.URLAclFile and adding
    the directory as a weblogic.io.fileSystem (a desperation move, I know).
    Thanks in advance,
    Peter Villiers

    PLEASE IGNORE THIS POST
    The problem was caused by someone (me though I honestly don't remember doing
    it), setting the content security level to high in my web browser which
    stopped this type of download.
    Peter

  • How to get Header in Downloaded .xls file using  GUI_Download function

    How to get Header in Downloaded .xls file using  GUI_Download function ???
    How to use the the Header parameter available in GUI_Download function .

    HI,
    see this sample code..
    data : Begin of t_header occurs 0,
           name(30) type c,
           end of t_header.
    data : Begin of itab occurs 0,
           fld1 type char10,
           fld2 type char10,
           fld3 type char10,
           end   of itab.
    DATA: v_pass_path TYPE string.
    append itab.
    itab-fld1 = 'Hi'.
    itab-fld2 = 'hello'.
    itab-fld3 = 'welcome'.
    append itab.
    append itab.
    append itab.
    append itab.
    append itab.
    t_header-name = 'Field1'.
    append t_header.
    t_header-name = 'Field2'.
    append t_header.
    t_header-name = 'Field3'.
    append t_header.
      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          default_extension     = 'XLS'
        IMPORTING
          fullpath              = v_pass_path.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_pass_path
          filetype                        = 'DBF'
        TABLES
          data_tab                        = itab
          FIELDNAMES                      = t_header
    Cheers,
    jose.

  • HT203200 has anyone ever had this problem? seems to be a problem in itunes, as i am having no problems downloading other files."There was a problem downloading "Outlander / Howard McCain". An unknown error occurred (-50)."

    has anyone ever had this problem? seems to be a problem in itunes, as i am having no problems downloading other files."There was a problem downloading “Outlander / Howard McCain”. An unknown error occurred (-50)."
    kinda suck to pay for something you cant use!..

    Try fixing up the validation issues...
    http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.stereogol.com%2Faudi o%2Fwimpy_podcast.php
    Not promising it will help, but it's worth a shot.

  • Download(xls) file fm ABAP using background job

    Hi,
    My request is how to download(xls) file fm ABAP using background job. ( Daily 3 times download )
    Pls advise...

    Hello Rajesh,
    Actually it is not the function module WRITE_DATASET but command OPEN DATASET. Check this link for more info:
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/content.htm
    Also for this please contact your ABAP collegues. It is their job and they should have the expertise.
    Regards.
    Ruchit.

  • Issues to use GUI_LOAD to download xls file

    Hi Guru's, we are using the fm GUI_DOWNLOAD for downloading xls files to the physical system.  We are facing  following issues.
    1. File contains the currency fields. When downloaded the file to desktop or any location  after decimal zero's are not printing in currency field.
    how to get zero's after decimals in the currency fields. Please let us know the solution if any.
    2. If we click the open option under file tab on the opened xls file which is downloaded from SAP then one wizard popup is coming and prompting the user to click the 'FINISH' button.
    Please let me know how to avoid this wizard popup.
    Thanks in advance.
    Regards,
    j.p

    Myself

  • Problem downloading JAR files after PIX 7.2(3) upgrade

    Hello, I have upgraded a PIX 515 Firewall from Version 6.3(4) to
    7.2(3) and am now experiencing problems downloading .jar files from
    some web servers. I have tried disabling the "inspect http" option but
    still not joy. I also tryied this:
    http://www.cisco.com/warp/public/110/pix-asa-70-browse.pdf
    But no luck.
    Have anyone had similar problems.
    Thanks in advance.

    1. Turn router off for 30 seconds and on again
    2. Settings>General>Reset>Reset Network Settings
    3. Settings>General>Reset>Reset All Settings

  • Problem downloading avi files

    Hi,
    I have recently had problems downloading avi files from rapidshare.de, because the avi files do not download to my desktop (a new ticket system prevents me from manually clicking on the link, and instead begins downloading the files automatically), but open and play in my browser (Internet Explorer 5.2). I cannot save these files to my computer or open them in my QuickTime application. Can I get some help as to how I can configure my browser to download avi files to my desktop, instead of opening them in the browser

    Hi erikson1,
    If the link is a direct liink to the avi file, you can just hold the 'control' key - click and hold the mouse over the link and then select "Download linked file to disk."
    If the link is to a html or other similiar web page that will play the file in it then it gets a little more complicated to get that avi file. Then you may have to view source of that page and find the direct link to the avi file for download.

  • Problem downloading .dmg files.

    Problem downloading .dmg files (Flash, Chrome, Firefox). Once I hit the download option Safari screen goes blank, actually grey and nothing downloads.

    Back up all data, then uninstall "Speed Download" according to the developer's instructions.

  • Problem reading .xls file from App Server

    Hi Everyone......
    I hope this might be a common problem but i searched for similar problem......i did'nt find the solution my problem is
    I'm trying to download .xls(excel file data into an internal table using OPEN DATASET FOR INPUT IN TEXT MODE ENCODING DEFUALT and read dataset for reading it).But in the read dataset syntax all stange values like **$#@&&& are getting uploaded???? I dont now why......
    Is it happing because i'm trying to upload .XLS file ???
    My coding is as follows...........
      OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc NE 0.
          IF sy-batch IS INITIAL.
            MESSAGE i001(zz) WITH 'Error opening file for upload'.
            EXIT.
          ELSE.
            MESSAGE s001(zz) WITH 'Error opening file for upload'.
            EXIT.
          ENDIF.
        ENDIF.
    *First Uploading the data into structure
        DO.
          READ DATASET p_file INTO l_wa_tab.   "My internal table work area
          IF sy-subrc = 0.
            APPEND l_wa_tab TO  l_tab.
          ELSE.
            EXIT.
          ENDIF.
          ADD 1 TO count.
        ENDDO.
        CLOSE DATASET p_file.
    Any solution for above problem.........

    Hi,
    Check whether path ur providing to the open data set stmt is correct or not in debugging mode.
    * File upload to internal table from UNIX Directory
        IF NOT p_i1file IS INITIAL AND NOT p_path IS INITIAL.
          CONCATENATE p_path p_i1file INTO v_file.
          CONDENSE v_file.
          OPEN DATASET v_file FOR INPUT IN TEXT MODE MESSAGE v_msg.
          IF sy-subrc EQ 0.
            WRITE:  / 'INPUT FILE CONTAINS NO RECORD :'(010), v_file.
            DO.
              CLEAR tbl_input.
              READ DATASET v_file INTO tbl_input.
              IF sy-subrc NE 0.
                EXIT.
              ELSE.
                APPEND tbl_input.
              ENDIF.
            ENDDO.
    * Close Input File
            CLOSE DATASET v_file.
          ELSE.
            WRITE:/'Error uploading file: '(008),v_file.
            STOP.
          ENDIF.
        ENDIF.
    It should work.check the sy-subrc value and file value in debug mode.
    Thanks
    Parvathi

  • Download .XLS-File in Background

    Hallo
    I should download data from an internal table into a real .XLS-file. It should run as a job in background (without upcoming pop-ups). At the end a real .xls-file should be saved on my harddisk and/or on a Windows NT-server.
    Excel and file don't need to be openend during runtime of job.
    I'm trying with FM 'MS_EXCEL_OLE_STANDARD_DAT' , but I have following problems (code of testreport is below):
    1. Doesn't run in the background.
    2. .xls-file stays open, when running in the foreground.
    3. Strange formatted fields in .xls-file.
    I have nearly no knowledges object-oriented development. System is R/3 Release 4.6C.
    Can anybody help me?
    Thanks, Martin.
    Code:
    REPORT yr_0001_test .
    TYPES: BEGIN OF t_excel,
           fld1(20) TYPE c,
           fld2(20) TYPE c,
           fld3(20) TYPE c,
           END OF t_excel.
    DATA: it001 TYPE TABLE OF t001.
    DATA: xt001 TYPE t001.
    DATA: iexcel TYPE TABLE OF t_excel.
    DATA: flditab TYPE TABLE OF t_excel.
    DATA: xexcel TYPE t_excel.
    xexcel-fld1 = 1000.
    xexcel-fld2 = 'testtext1'.
    xexcel-fld3 = 'testplace1'.
    APPEND xexcel TO iexcel.
    xexcel-fld1 = 2000.
    xexcel-fld2 = 'testtext2'.
    xexcel-fld3 = 'testplace2'.
    APPEND xexcel TO iexcel.
    xexcel-fld1 = 'BUKRS'.
    APPEND xexcel TO flditab.
    xexcel-fld1 = 'BUTXT'.
    APPEND xexcel TO flditab.
    xexcel-fld1 = 'ORT'.
    APPEND xexcel TO flditab.
    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
      EXPORTING
        file_name                       = 'C:TEMPSAPWORKDIRTEST'
    *   CREATE_PIVOT                    = 0
        data_sheet_name                 = 'SHEET1'
    *   PIVOT_SHEET_NAME                = ' '
    *   PASSWORD                        = ' '
    *   PASSWORD_OPTION                 = 0
      TABLES
    *   PIVOT_FIELD_TAB                 =
        data_tab                        = iexcel
        fieldnames                      = flditab
      EXCEPTIONS
        FILE_NOT_EXIST                  = 1
        FILENAME_EXPECTED               = 2
        COMMUNICATION_ERROR             = 3
        OLE_OBJECT_METHOD_ERROR         = 4
        OLE_OBJECT_PROPERTY_ERROR       = 5
        INVALID_FILENAME                = 6
        INVALID_PIVOT_FIELDS            = 7
        DOWNLOAD_PROBLEM                = 8
        OTHERS                          = 9
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CLEAR: iexcel,flditab.
    REFRESH: iexcel,flditab.

    If you are downloading a true xls file, then you cannot avoid the pop-ups and you will not be able to create it in the background as the EXCEL interface is not available to the backend. Your only option is to download it as tab or comma delimited.
    Imagine it this way, excel is a user driven application that runs on the user's desktop and requires inputs from the user. The current mechanism of creating an excel file from SAP works on the same principle of user interaction. In the background, since there is no user interaction, it will not be possible.

  • Problem downloading a file from popup

    Hi,
    I have scenario like this.
    popup on a page.
    region on that popup. when i click on a button inside the region i want to close the popup and download a file of type excel.I am able to close the popup.but the problem is the download of file is not happening.I think when i hide the popup the response is coming back as the parent page.but i want to download the file.Is there any way i can achieve this?
    Here is the code for downloading and hiding the popup.closePopup method is being called from the action Listener of the button.
    public void closePopup(ActionEvent actionEvent) {
    // Add event code here...
    RichPopup parentpopup = getMyPopup(actionEvent.getComponent());
    parentpopup.hide();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    PrintWriter pw= null;
    HttpServletResponse httpServletResponse =
    (HttpServletResponse)facesContext.getCurrentInstance().getExternalContext().getResponse();
    try {
    pw = httpServletResponse.getWriter();
    httpServletResponse.setContentType("application/vnd.ms-excel");
    httpServletResponse.setHeader("Content-disposition", "attachment; filename=" + "test");
    pw.write("test");
    pw.flush();
    pw.close();
    FacesContext.getCurrentInstance().responseComplete();
    } catch (Exception e) {
    e.printStackTrace();
    private RichPopup getMyPopup(UIComponent component){
    if(component ==null){
    return null;
    if(component instanceof RichPopup){
    return (RichPopup)component;
    return getMyPopup(component.getParent());
    please guide me here.

    use following code
        public void fileDownloadListener(FacesContext facesContext,
                                         OutputStream outputStream) {
            OutputStreamWriter outputStreamWrite =
                new OutputStreamWriter(outputStream);
            //PrintWriter pw = null;
            HttpServletResponse httpServletResponse =
                (HttpServletResponse)facesContext.getCurrentInstance().getExternalContext().getResponse();
            try {
                //pw = httpServletResponse.getWriter();
                httpServletResponse.setContentType("application/vnd.ms-excel");
                httpServletResponse.setHeader("Content-disposition",
                                              "attachment; filename=" + "test.xls");
                outputStreamWrite.write("test");
                outputStreamWrite.flush();
                outputStreamWrite.close();
                FacesContext.getCurrentInstance().responseComplete();
            } catch (Exception e) {
                e.printStackTrace();
        }

  • Trying to download xls file with IE7 but browser tries to download as htm

    Hi!
    I have got a problem with downloading files using a hyperlink.
    I've got a hyperlink and i did set the url property to: /resources/file.xls
    when using IE7 and clicking Save As... the save as dialog appears and suggests file.htm as the filename and the file typ is shown as: HTML Document
    Firefox works fine, it suggests file.xls and the type as: Microsoft Office Excel 97-2003 Worksheet
    Next i typed in the url of the resource folder: http://localhost:29080/myProject/resources/
    The file was shown as file.xls in the directoy listing, but when i tried to download the file from here, both browsers behaved the same way as before.
    gif-files and others worked fine in both browsers.
    Does anyone have an idea?
    greets,
    Remi

    I'd first try downloading an installer from the Apple website using a different web browser:
    http://www.apple.com/itunes/download/
    If you use Firefox instead of IE for the download (or vice versa), do you get a working installer?

  • "Unable to read file" error in Excel 2010 when downloading .xls file from IE11

    We have lots of reports that have links for our users to be able to download report results in Excel format. We accomplish this by using the Excel mime type in our .asp pages. Sporadically, we are seeing "Unable to read file" errors in Excel 2010
    after choosing Open from the IE11 save dialog. Choosing Save/Save As and the file will open just fine.
    Also, we can sometimes cause the error to occur more frequently by switching windows during the time when the file is downloading.
    If the file is opened directly from /Temporary Internet Files then it opens just fine.
    Window 7 64-bit
    Thanks in advance!

    Hi,
    I found you replied in a similar thread, did you try the workaround (Reset the IE) that provided there? Did you change a browser to test?
    Then, I suggest we use Process Monitor to do further troubleshooting. Please collect all the actions of IE.exe and Excel.exe, and check the if there are some
    error message/code during you open XLS file from IE 11.
    Hope it's helpful.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Problem downloading pdf file in Safari

    My website has a link which downloads a pdf file, which opens in a new browser window. In OS X, this works properly using the latest Safari update (4.0.5), as well as in Firefox and several other browsers (the file opens in Preview). I also run Windows XP using Boot Camp. I updated Safari to 4.0.5 in Windows, and also installed the latest version of Adobe Reader. But when I link to the pdf file in Windows using Safari, the program freezes. Both Firefox and Internet Explorer download the pdf file properly in Windows (the file opens in Adobe Reader).
    I'm pretty sure that earlier Windows Safari versions correctly downloaded pdf files. Could this be a problem with Safari 4.0.5? Is there plugin in the new Safari that I'm missing, or something that needs to be set in either Safari or Adobe Reader?

    I went through the recommended uninstall/reinstall procedure, but unfortunately it didn't fix the problem. When I first ran the new Safari install and clicked on the link to download the pdf, it opened a new window with a message that it couldn't find the server on which the pdf file is located (but of course it's on the same server as the parent page). After churning (hourglass cursor) for a couple of minutes, the new page (now running Adobe Reader, I think) displayed a small cube with question marks (missing file). On subsequent tries, Windows shut down Safari as "not responding".
    I suspect that the problem is with Adobe Reader 9.3.1 and its interaction with Safari. (The other browsers continue to download the pdf properly.) I checked the Adobe site but didn't see an obvious way to install an earlier version of Reader, but willl investigate this further.
    Many thanks for your help. (I've been forced to learn more about Windows than I really wanted to know.)
    Charles Hearn

Maybe you are looking for

  • Mac Mini Late 2012 i5 Slow On Mavericks

    Hi, I am running a late 2012 i5 Mac Mini with 4gb of ram. I have had the machine since new for about 8 1/2 months. It is connected to 2 monitors and is my main machine at home. I have noticed that if I am running the machine on mountain lion it works

  • What program will open .JPG in email attachment

    Searched the forum but couldn't find an answer.  I keep getting emails with .JPG attachments but it says that there is no program on the phone to open the attachment.  Went to the Play Store and tried a couple but they didn't work.  Probably somethin

  • Error when reading the data of infoprovider

    Hello, I have a problem when excecuting the transaction 'listcube' on a specific infocube. It occurs an error message which complains problem when reading the data of the infoprovider. The message text sounds as follows: Error reading the data of Inf

  • Drive not recognizing Blank Princo DVDs

    I just ordered and received 200 Princo 4x DVD-Rs because I have one of the early G5s with the Sony DVD RW DW-U10A, that is a 4x writer. These Princo blanks seemed to be some of the only 4x DVDs still around. Now when I put them in drive, my G5 doesn'

  • Moving Around CS2  -- like in "Alt" in Quark

    Is there a shortcut to access the hand/move tool in CS2? I am looking for the same feature as simply pressing the Alt key when using Quark. No matter which tool you have selected, by clicking Alt, it changes your curser to the hand tool. It makes it