BSP File Download  - .TIF problems

Dear all!
I haven't been able to fix this problem,
please see my post for further information. I am using SAP.help coding to display files in BSPs (6.20, "BSP with flow logic" pages used). See the coding below.
Somehow .tif files can not be displayed. Every other mime type works fine.
Thanks,
Chris
Dear all!
In a quite complex file upload and download scenario which works fine we use the following coding to display files received from the backend in our page.
OnInitialization: receives file backend data such as filesize, content(xstring) and mimetype.
This works all fine. Mimetype is delivered correctly.
OnInputProcessing:
This has been taken from the help.sap.com documentation -
    runtime->server->response->set_data( mycontent ).
      runtime->server->response->set_header_field(
        name   = 'Content-Disposition'
        value = lv_downname ).
    runtime->server->response->set_header_field( name  = 'Content-Type' value = mymimetype ).
    runtime->server->response->set_header_field( name  = 'Content-Length' value = myfilesize ).
    runtime->server->response->delete_header_field( name = 'Cache-Control' ).
    runtime->server->response->delete_header_field( name = 'Expires' ).
    navigation->response_complete( ).
RESULT:
the file is displayed fine. When trying to save the displayed file locally on the hard disc, the mimetype is not available. The system (Windows XP) provides only .bmp as file type. Also the context menu entry "Properties" of the displayed file shows NOT AVAILABLE as mimetype.
Is this a common problem? How can I achieve to have the mimetype information available for a save?
Thankx,
Christoph
Message was edited by: Christoph Aschauer
Message was edited by: Christoph Aschauer
Message was edited by: Christoph Aschauer
Message was edited by: Christoph Aschauer

Hi,
I am getting an error, when I try to download the document from the bsp-page.
I have uploaded the document to the server-cache as mentioned above. If I test it on the standalone machine, everything works fine. But when I have to connect to the BSP-Application through an EP I am getting the error:
BSP Exception: Das Objekt test.doc in der URL /sap(bD1kZSZjPTEwMCZwPTM1MjUwJnY9NiUyZTQmaT0xJnM9U0lEJTNhQU5PTiUzYWR0aXRtZXpfVE1FXzA3JTNhLUVVb2Y3MHRUN2JnMGFYMUNLeUVPakRRWmZBTTJVVE5aS21Lc0FRQi1BVFQ=)/bc/bsp/sap/zportal_rueckme/test.doc?sap-syscmd=nocookie ist nicht gültig.
Test.doc is the name of the document I wish to download.
Here comes the sample code.
  DATA: cached_response TYPE REF TO if_http_response.
  CREATE OBJECT cached_response
    TYPE
      CL_HTTP_RESPONSE
    EXPORTING
      add_c_msg        = 1.
  cached_response->set_data( l_document_x ). " l_document_x is a xstring
  cached_response->set_header_field( name  =   
                                    if_http_header_fields=>content_type
                                                          value = l_mime_type ).
  cached_response->set_status( code = 200 reason = 'OK' ).
  cached_response->server_cache_expire_rel( expires_rel = 180 ).
  CONCATENATE
              RUNTIME->application_url
              '/' l_file_name INTO e_url.
    cl_http_server=>server_cache_upload( url      = e_url
                                         response = cached_response ).
Later I navigate to that URL:
        NAVIGATION->GOTO_PAGE( URL = e_url ).
Any suggestions are appreaciated!
Regards,
Max

Similar Messages

  • Accessing BSP File Download using HTTPS URL

    Hi,
    I'm struggling with a problem of downloading a file from a https url. I wrote a BSP App for downloading a file from a unix server.. It works fine when I use a http URL with port 8080 and does not work when I use https.!!
    Example:
    https://comms.gmsanet.co.za/supplier [ download does not work ]
    http://comms.gmsanet.co.za:8080/supplier [ download works ]
    When I try to download using https.. it does not pull the file name and path
    see code  below and suggest me if anything to be chnaged.
    In the Form Initialization method:
    event handler fr data retrieval
    DATA: i_file        type string,
          s_fields      TYPE tihttpnvp,
          s_fields_line TYPE ihttpnvp,
          multipart_form type ref to if_http_entity,
          file_upload    type xstring,
          lv_backend     type string,
          success        type string,
          entity         type ref to if_http_entity,
          file           type xstring,
          content_type   type string,
          content_filename type string,
          content_length type string,
          content_disposition type string,
          num_multiparts type i,
          i              type i value 1,
          doEcho         type string value 'X',
          value          type string,
          filename       type ZFILETAB-fileinfo,
          ext1           type string,
          ext2           type string,
          dsn            type string,
          bptype         like sy-uname,
          itab           TYPE ZFILETAB,
          itab_line      TYPE ZFILETABLINE,
          file_ext       type ZFILETABLINE,
          fileinfo       type c,
          zcount         type i.
        filename = '/NewMessge.doc'.
        content_filename = filename.
    Check the extension and assign the content type
        split filename at '.' into ext1 ext2.
        case ext2.
          when 'zip'.
            content_type = 'application/x-zip-compressed'.
          when 'doc'.
            content_type = 'application/msword'.
          when 'txt'.
            content_type = 'text/plain'.
          when 'ppt' or 'pps'.
            content_type = 'application/vnd.ms-powerpoint'.
          when 'xls' or 'exe'.
            content_type = 'application/octet-stream'.
          when 'gif'.
            content_type = 'image/gif'.
          when 'jpg' or 'jpeg'.
            content_type = 'image/pjpeg'.
          when 'htm' or 'html'.
            content_type = 'text/html'.
        endcase.
        dsn = filename.
        OPEN DATASET dsn FOR INPUT IN BINARY MODE.
        IF sy-subrc NE 0.
          zmessage = 'Error opening file'.
          navigation->set_parameter( name = 'zmessage' value = zmessage ).
          navigation->goto_page( 'downloaderror.htm' ).
          exit.
        ENDIF.
        DO.
          READ DATASET dsn INTO <b>file</b>.
          EXIT.
        ENDDO.
        CLOSE DATASET dsn.
    set response data to be the file content
      runtime->server->response->set_data( <b>file</b> ).
      runtime->server->response->set_header_field(
                                    name  = 'Content-Type'
                                    value = content_type ).
      concatenate 'attachment; filename=' filename into content_disposition.
      runtime->server->response->set_header_field(
                                    name = 'Content-Disposition'
                                    value = content_disposition ).
    set the file size in the response
      content_length = xstrlen( file ).
      runtime->server->response->set_header_field(
                                name  = 'Content-Length'
                                value = content_length ).
      runtime->server->response->delete_header_field(
                                name = 'Cache-Control' ).
      runtime->server->response->delete_header_field(
                                name = 'Expires' ).
      navigation->response_complete( ).
    Thanks
    Ajay

    Hi Brian,
    I have the same problem as Ajay Yeluguri. In http mode I can generate a download of an Excel document but when we use the portal in https it doesn't work.
    When I try to download using https it does not pull the file name and path and when I choose download I have a error message : "Internet Explorer cannot download from ..."
    I've test the point 3.2 "... including file up/download" of the BSP application IT00 and it works fine in http and https mode. My problem is not the upload but the download. And in this application the uploaded document is opened in the Internet Explorer window but I want to generate a Save as... window to download the file.
    Have you an idea what i can do to solve my problem.
    Thanks
    Yann

  • File Download - new Problem

    Hi java guru's
    I'm trying to write a download pgm using servlet and JSP. The actual problem is, when i'm trying to download a file, the output stream writes all the comtent of the file on the browser itself even if it's a .exe file instead of opening a "Save as" dialog box
    Can you guru's suggest me a best way to overcome this problem!
    Thanks in advance

    Hello friends,
    We can download any files in two ways
    1. calling java script function
    2. read/write operation(io).
    Both codes are working fine. try it and if u face any problem.Please let me know,
    Friendly,
    Jawahar
    bangalore. India
    [email protected]
    =================================
    java script code
    ==============================
    <%
    <!-- file relative path is here -->
    String path ="/jsp/xxx.xls";
    <!-- file name is here -->
    String fileName="xxx.xls";
    %>
    <html>
    <head>
    <title>Down load forms</title>
    </head>
    <body onLoad="window.open('<%=path%>');">
    <table border="0" align="center" width="100%">
    <tr><td height="181"><font face="verdana" color="#5599cc" size="2" align="center">you have selected the file <%=fileName%</font> </td></tr> </table></body></html>
    ==========================================
    Read/write IO operation is here
    ==========================================
    <%
    String files = null;
    String fileName=null;
    <!-- file path is here -->
    String file=".... any path";
    File f = new File(file);
    FileInputStream in = new FileInputStream(f);
    int length = (int)f.length();
    if(length != 0)
    byte[] buf = new byte[length];
    ServletOutputStream op = response.getOutputStream();     
    response.setContentType ("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment; filename=\""+fileName+"\"");
    while ((in != null) && ((length = in.read(buf)) != -1))
    System.out.println("BUFFER $"+buf.length+"$");
    System.out.println("Bytes read in: " + Integer.toString(length));
    op.write(buf,0, buf.length);
    op.close();
    %>     
    <%@ page import="java.io.*,javax.servlet.*,java.util.*,java.sql.* " contentType="text/html" %>
    <html>
    <head>
    <title>Welcome to the download form page</title>
    </head>
    <body bgcolor=#FFFFFF>
    ==========================================

  • Need urgent help on file download servlet problem in Internet Explore

    I have trouble to make my download servlet work in Internet Explore. I have gone through all the previous postings and done some research on the internet, but still can't figure out the solution. <br>
    I have a jsp page called "download.jsp" which contains a URL to download a file from the server, and I wrote a servlet (called DownloadServlet) to look up the corresponding file from the database based on the URL and write the file to the HTTP output to send it back to the browser. <br>
    the URL in download.jsp is coded like <a href="/download/<%= currentDoc.doc_id %>/<%= currentDoc.name %>">on the browser, it will be sth like , the number 87 is my internal unique number for a file, and "myfile.doc" is the real document name. <br>
    in my web.xml, "/download/" is mapped to DownloadServlet <br>
    the downloadServlet.java looks like
    tem_name = ... //read DB for file name
    // set content type
    if ( tmp_name.endsWith(".doc")) {
    response.setContentType("application/msword");
    else if ( tmp_name.endsWith(".pdf")){
    response.setContentType("application/pdf");
    else if ( tmp_name.endsWith(".ppt")){
    response.setContentType("application/vnd.ms-powerpoint");
    else if ( tmp_name.endsWith(".xls")){
    response.setContentType("application/vnd.ms-excel");
    else {
    response.setContentType("application/download");
    // set HTTP header
    response.setHeader("Content-Disposition",
    "attachment; filename=\""+tmp_name+"\"");
    OutputStream os = response.getOutputStream();
    //read local file and write back to browser
    int i;
    while ((i = is.read()) != -1) {
    os.write (i);
    os.flush();
    Everything works fine in Netscape 7.0, when I click on the link, Netscape prompts me to choose "open using Word" or "save this file to disk". That's exactly the behavior I want. <br>
    However in IE 5.50, the behavior is VERY STRANGE.
    First, when I click on the URL, the popup window asks me to "open the file from its current location" or "save the file to disk". It also says "You have chosen to download a file from this location, ...(some url).. from localhost"
    (1) If I choose "save the file to disk", it will save the rendered "download.jsp" (ie, the currect page with URL I just clicked, which isn't what I want).
    (2)But if I choose "open the file from its current location", the 2nd popup window replaces the 1st, which also has the "Open ..." and "Save.." options, but it says "You have chosen to download a file from this location, MYFILE.doc from localhost". (notice it shows the correct file name now)
    (3) If I choose "Save..." on the 2nd window, IE will save the correct file which is "myfile.doc"; if I choose "Open ...", a 3rd replaces the 2nd window, and they look the same, and when I choose "Open..." on the 3rd window, IE will use Word to open it.
    any ideas?
    </a>

    Did you find a solution to this problem? I've been wrestling with the same issues for the past six months. Nothing I try seems to work. I've tried setting the contentLength(), inline vs. attachments, different write algorythms, etc. I don't get the suggestion to rename the servlet to a pdf file.

  • PSE4 - No thumbnails for .TIF files (Fuzzy TIF problem?)

    My PSE4 newly installed on my Win XP. But, I just catalogued the first 100 of my black-and-white photos into the PSE Organizer. These were all a standard format of 4x6" at 300 dpi gray scale files. But, while the .jpg files show thumbnails in the Organizer, the .tif thumbnails show up as black rectangles. Still these .tifs can be viewed in the PSE editor, and when I resave them as a .psd file, a thumbnail shows up in the Organizer for the .psd. (Oh, an attempt to resave the original file in PSE as .tif didn't help).
    Post script -- I just tried to catalogue a few of my more recent 4x6" gray scale .tif files as I described above. I noted that the thumbnails for the .tif files showed up in PSE Organizer for just a second or two, and then promptly changed to black rectangles. Interesting
    But I have hundreds of such .tif photos still to be catalogued: (1) Am I going to have to resave each file as .psd, and (2) is there any downside to .psd as long as I'm using Adobe software? I just noted that my online photo processor (Fuji) doesn't accept .psd files.
    I saw in the forum about PSE4 encountering the "fuzzy .tiff" problem but couldn't find a full explanation anywhere. I had the impression that not all .tiffs are created equal! I think most of mine were created by Adobe Photoshop 7 that I once had access to. I'm really worried that PSE4 is not going to work out for me.

    Check out this thread:
    Carol Baidinger, "Photos turn black" #12, 14 Dec 2005 5:55 pm
    I don't use Windows, so I don't know if you'll find anything helpful, but I'm sure you'll at least get some comfort from knowing you're not the only person experiencing a problem with TIFF files in PSE 4.0. :(

  • File Download - 403 problem

    Hi Folks,
    From long time away from here, I am back.
    In my application we are using only ADF Faces. There is a functionality in my application to download some files that have been previously uploaded by any user.
    The problem is that the file is not written in a file system. It is inside database.
    When the user clicks the download button from an af:table, it starts a method from a backing bean that goes to the database and gets the binary code from there.
    It writes the binary array in the response output but since the download has not started by the user the IE 7 and 8 shows the information bar stating that Internet Explorer has blocked this site from download...
    I have read that it is a default behaviour from IE7 and 8 when the user does not click in a link directly pointed to a file in a server.
    I tried to put the site in Trusted Sites.
    The only solution that I found was to enable "Always prompt for downloading". It works but I cannot use this solution since the application is going to run in a big Brazil TV Channel company throughout the country and change it is very difficult.
    I so that the difference between the REQUEST HEADERS is the Transfering-Enconding chunked, but it is related to content-lenght, when it is not specified. I tried to specify content-lenght and it did not work.
    When I click the bar and choose download file option, it redirects to the same page that I was, changing the afrSOMETHINGMode from 0 to 2 and adding the afrWindow to null.
    It gets me a 302, another two other GETs are done witouht success to the context root and at the last one I get the 403.
    Does any body have any light?
    Thanks in advance.

    Hi Mr. Puthanampatti,
    I used your above code for a download button.
    When I click the button the window will arise and we can download the file.
    But after that the button will not become enable.
    Normally when the task is over the button will automatically enabled. Butt here it is not happening and we can click the button only one time without refreshing the page.
    (I assumed you have used res for HttpServletResponse)
    the code I had used is mentioned below. Please tell me what can I do...??
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext = facesContext.getExternalContext();
    HttpServletResponse response = (HttpServletResponse)externalContext.getResponse();
    File file = new File(dir1, pdffile1);
    BufferedInputStream input = null;
    BufferedOutputStream output = null;
    try {
    input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE);
    response.reset();
    response.setContentType("application/pdf");
    response.setContentLength((int)file.length());
    response.setHeader("Content-disposition", "inline; filename=\"" + pdffile1 + "\"");
    output = new BufferedOutputStream(response.getOutputStream(), 10240);
    byte[] buffer = new byte[10240];
    int length;
    while ((length = input.read(buffer)) > 0) {
    output.write(buffer, 0, length);
    output.flush();
    } finally {
    close(output);
    close(input);
    facesContext.responseComplete();Thanks a lot.
    Dinuka.

  • While opening BSP File download popup opens

    HI Experts,
    While opening BSP application(appraisal) in UWL work items a popup window opens.
    this happens on particular PC of the user only,we are able to open the same on our PC.
    this must be because of browser setting,but not sure
    please suggest,points will be awarded accordingly
    With Regards,
    Dayakar.

    Hi Dayakar ,
    Comapre your browser settings with his and see if there is any discrepency . What is the message in Pop up window?
    Try adding  portal's and the application's URL to trusted sites and then see .
    Regards
    Mayank

  • Problem with file downloads - please help

    Good morning. Since upgrading to BT Infinity 2, I have been experiencing the following problems:
    Cannot update Sonos firmware to version 5 - download times out and gives error 30
    Cannot download most files from safari - all start for the first few kb and then just hang
    Cannot download larger PDF files from Mac Mail
    These problems manifest themselves over wireless and wired connections, with the BT Homehub 5 and an Asus router. My ipad has no problems when on other networks or if I access my email from my work computer. When talking to BT technical support over the chat facility yesterday the connection dropped once every 10-30 seconds before reconnecting again. All of this leads me to believe that I have an intermittent failure on my broadband connection however BT insist that there is nothing wrong with the line or the router. I have changed channels on my router but this does not seem to make things better. Internet is working fine on all my devices for web browsing - only file downloads experiencing problems.
    Please help.

    Oh sorry, I thought from your description you were using an ASUS connected to the HH5, but it turns out you're using them separately.
    Is there a firmware update you can get on the ASUS?
    If you found this post helpful, please click on the star on the left
    If not, I'll try again

  • Typical Problem !! File Download UI related

    Dear All,
    I'm stuck in a typical problem. I upload files thru the File Upload UI and generate uique IDs against every upload document.
    For displaying the documents, the user goes thru a web page that has URL to a WDA application.
    This WDA application has the unique Number as application paramater.
    The problem : If the default view of the WDA has a button and on click the uploaded file opens properly. But if I write the same code in WDINIT , the code gets executed but doesn't open the uploaded file. Reason??? I fail to understand !!!
    Any help would be highly appreciated.
    Regds,
    Srini

    Are you using the attach file to response API?  Basically in the WDDOINIT, the page is being built for the first time. Therefore the framework on the client side isn't rendered yet to be able to download a file.  If you want a file download to trigger "automatically" upon a page load; consider using a timedTrigger UI element set to 1 second and then download the content upon the event of the timedTrigger.
    Is this WDA only being used to download the files via a Link?  If so consider if you really need WDA for this.  That's a heavy weight framework if you are only wanting to push the download of a file. A stateless BSP or even a ICF handler class might be much better options.

  • I am having problems downloading files from the web. After a number of files are downloaded, the system become sluggish, and then hangs. I traced the problem to the download history file: downloads.sqlite.

    After downloading a number of 1.0 MB files, the system became very sluggish, and I started to get lots of (Not Responding) messages when trying to download or just use Firefox for browsing. Using Performance Monitor, I observed that the Firefox executable was growing larger and larger - up to as large as 1.2 GB on a system with 2.0 GB memory. Page faults were off the chart.
    Looking for a similar problem, I found one that discussed the downloads.sqlite file becoming corrupted. I first noticed that this file was over 600 MB in size, so I deleted it. I then downloaded additional files, and observed that the new downloads.sqlite file would increase in size by about 150% of the size of each file that was downloaded. Once it would get up to 500 MB in size, the system started slowing down again.
    I don't know the purpose of this file, but it appears that it keeps a full copy of every file downloaded, which may be the function of a download history file, but it does not seem correct that the file should grow in size without limit, and thus impact the system.
    I would also appear that the Firefox executable is trying to read the entire contents of this file each time a new file is downloaded, which does not seem right.
    Temporary fix is to periodically delete the downloads.sqlite file when it gets too large and starts impacting performance.. Apparently it is smart enough to open a new file if the old one is not found. I am not sure what the correct behavior for this file should be. Apparently is does not re-initialize when a new Firefox session is initiated.
    Please feel free to contact me if more information is desired. I'm not sure what details you might need to troubleshoot this type of problem.

    Hi Katy, and a warm welcome to the forums!
    What is the exact name of the file?
    Is it aim.bin?
    Which requires either Stuffit Expander, or the Unarchiver to deflate.
    http://www.apple.com/downloads/macosx/systemdiskutilities/theunarchiver.html

  • I am using Windows XP SP3, I have problem with file download while resuming downlod giving error "file...could not be saved, because the source file could not be read." Please help me

    I am using Fire Fox 5 beta version. After pausing the long file download, when I press the Resume download button the above message appear each time asking "Contact to Administrator". This problem was not with Fire Fox version 3 and above. Please Help Immediately. Thanks in advance...

    It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files by Firefox.
    Try to disable the real-time (live) scanning of files in your anti-virus software temporarily to see if that makes downloading work.
    * http://kb.mozillazine.org/Unable_to_save_or_download_files

  • Problem in File Download

    In some thread, i had this problem with file download that instead of opening File Save..popup, the contents of file on the server were being rendered statically as HTML. I have figured out the solution to that but now the thing is in every file, there are some \n\r being added in the beginning of the file. Can anybody help. Here's is my code.
    <%@ page import="java.io.*"%>
    <%
         try
              response.setContentType("APPLICATION/OCTET-STREAM");
              String strProjectInfoPageHeader = "Attachment;Filename=\"" + request.getParameter("txtProjectInfoPageFileName") + "\"";
              response.setHeader("Content-Disposition", strProjectInfoPageHeader);
              File fileToDownloadProjectInfoPage = new File(request.getParameter("txtProjectInfoPageFilePath"));
              FileInputStream fileInputStreamProjectInfoPage = new FileInputStream(fileToDownloadProjectInfoPage);
              int varProjectInfoPage;
              while ( (varProjectInfoPage=fileInputStreamProjectInfoPage.read()) != -1 )
                   out.write(varProjectInfoPage);
              out.flush();
              out.close();
              fileInputStreamProjectInfoPage.close();
         catch(Exception e)
              out.println(e);
    %>Thanks and regards
    Vikram

    JSPs will invariably have newlines and whitespace in them, even if you don't explicitly put them. Instead of wasting time trying to fix it, just move your code to a servlet and map it to the same path. That's the fastest and most sensible solution. It also follows the convention that JSPs are to be used for display only and servlets for processing.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
    ----------------------------------------------------------------

  • Problem With File Download Dialog Box

    Hi all,
    I have jsp page that allows a user to export oracle data to excel.
    I have these code in my page:
    <%@ page contentType="application/vnd.ms-excel" %>
    response.setContentType ("application/vnd.ms-excel");
    response.setHeader ("Content Disposition",
    "filename=\"historicalrate.xls\"");
    I run the page and it popups a file download dialog box with Open and Save buttons.
    When I click the Save button a Save As window opens with a hr.xsl file name and Microsoft Excel Workbook(*.xls) as save type. It is what I want.
    The problem I have is when I click the Open button on the file download dialog box it displays data in excel format on a browser well. Then I click File > save as on browser's tool bar the Save As window pop up with no file name and a default Text(tab delimited)(*.txt).
    I need the file name and Microsoft Excel Workbook(*.xls) as default save type.
    Any help would be greatly appreciated.
    Please help
    Thanks

    I have the same problem with hui_ling.
    When user click on "Open", Excel start and open excel file correctly but the file name on excel title bar. 'Cause the file name is in Japanese characters. Any one can help me?
    Message was edited by:
    TNTVN

  • Unwanted File Download box in JSF - Problem while Saving State.

    Hi,
    I am having a situation wherin there are multiple command links dynamically generated in a dataTable.When I click on any one of the links a file download dialogue pops up to save/open a pdf doc.Irrespective of any operations on the download dialogue, if I click on anyother link (i.e this is the 2nd click on tat page)
    then the file download doesnt pop up and instead the page is refreshed.
    On the 3rd click , the file download again pops up.
    The code in the action method of the command link goes like this
    public void showPDF() {
    byte[] pdf = // gets the data from another place.
    FacesContext faces = FacesContext.getCurrentInstance();
              HttpServletResponse response = (HttpServletResponse) faces.getExternalContext().getResponse();
              response.setContentType("application/pdf");
              response.setContentLength(pdf.length);
              response.setHeader("Content-disposition", "attachment");
              response.setHeader("Cache-Control", "cache, must-revalidate");
              response.setHeader("Pragma", "public");
              try {
                   ServletOutputStream output = response.getOutputStream();
                   output.write(pdf);
              } catch (IOException e) {
                        log.debug("IOException in viewPdf: " + e.toString());
         faces.responseComplete();
    }To fix the above problem ...I have included the following 2 lines of code just before invoking the responseComplete() method :
      StateManager stateManager = (StateManager)    
                                                                    faces.getApplication().getStateManager();
         stateManager.saveSerializedView(faces);This solves the above problem but causes another problem for which I need help :
    There is a value change listener in my jsp.When I change the value in a drop down list in the same page, the file download dialogue is poping up. which shuld only pop up when am clicking any one of the command links.
    I debugged thru the code and found out that after the value change listener action method is finished executing it jumps and executes the above showPDF() method.
    Seems its something to do with saving of the client state.
    It will be of great help anyone can advise on this.
    Thanks
    Archan

    Hi,
    I am having a situation wherin there are multiple command links dynamically generated in a dataTable.When I click on any one of the links a file download dialogue pops up to save/open a pdf doc.Irrespective of any operations on the download dialogue, if I click on anyother link (i.e this is the 2nd click on tat page)
    then the file download doesnt pop up and instead the page is refreshed.
    On the 3rd click , the file download again pops up.
    The code in the action method of the command link goes like this
    public void showPDF() {
    byte[] pdf = // gets the data from another place.
    FacesContext faces = FacesContext.getCurrentInstance();
              HttpServletResponse response = (HttpServletResponse) faces.getExternalContext().getResponse();
              response.setContentType("application/pdf");
              response.setContentLength(pdf.length);
              response.setHeader("Content-disposition", "attachment");
              response.setHeader("Cache-Control", "cache, must-revalidate");
              response.setHeader("Pragma", "public");
              try {
                   ServletOutputStream output = response.getOutputStream();
                   output.write(pdf);
              } catch (IOException e) {
                        log.debug("IOException in viewPdf: " + e.toString());
         faces.responseComplete();
    }To fix the above problem ...I have included the following 2 lines of code just before invoking the responseComplete() method :
      StateManager stateManager = (StateManager)    
                                                                    faces.getApplication().getStateManager();
         stateManager.saveSerializedView(faces);This solves the above problem but causes another problem for which I need help :
    There is a value change listener in my jsp.When I change the value in a drop down list in the same page, the file download dialogue is poping up. which shuld only pop up when am clicking any one of the command links.
    I debugged thru the code and found out that after the value change listener action method is finished executing it jumps and executes the above showPDF() method.
    Seems its something to do with saving of the client state.
    It will be of great help anyone can advise on this.
    Thanks
    Archan

  • Problem in XML file download

    types: begin of type_s_data,
             record(65000) type c,
           end of type_s_data.
    data: w_xml_out type string.
    data: t_xml_tab type table of type_s_data with header line,
    Source code
          t_code    type table of type_s_data with header line,
    After populating t_code table,
    convert internal table data into XML document
      call transformation id
           source code = t_code[]
           result xml w_xml_out.
    append XML docu to internal table
      append w_xml_out to t_xml_tab.
    Download to XML file
      call function 'GUI_DOWNLOAD'
        exporting
      BIN_FILESIZE                    =
         filename                        = filename
         filetype                        = 'BIN'
        append                        =
      write_field_separator           = sep
      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                        = t_xml_tab
      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 e016 with 'Error during file download'(002).
      endif.
    Problem here is when intrernal table data/size is large, only part of the data is getting displayed in the file and at the bottom of the file showing an error message
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End element was missing the character '>'. Error processing resource 'file:///C:/Documents and Settings/sowjanya.suggula/De...
    RECORD
    ^
    >RECORD>
      </item>
    wehn i change data  declaration as
    data: t_xml_tab type table of string with header line.
    when i execute the program, giving me a short dump.please suggest me a soluion for this.
    Regards,
    Sowjanya

    Hi Sowjanya,
    Kindly go through this link below:
    It Uploads XML to internal table and vice versa :
    Upload XML to internal table and vice versa in SAP 4.6C
    Hope it helps
    Regrds
    Mansi

Maybe you are looking for

  • CR XI landscape report not printing correctly on one particular server

    Post Author: BronxJedi CA Forum: General I have a report that was designed in Crystal XI (11.5.0.313) that is not previewing or printing correctly when the users access it on our production server. The report is designed as a landscape report, for an

  • IPhone won't vibrate anymore..

    My phone makes a funny noise when it vibrates, almost like you can hear it stop working. It sounds like it's just winding up at times, and it will not vibrate, just make that noise. Anybody having this same problem, or any tips on what's wrong? Thank

  • Document Number range autmatically getting updated

    Hi, I m in SAP ECC 6.0 and new GL concept is activated. I am posting a document. Document number is generated. But the update error is given. When i saw the document number range status in document number in general ledger view, the document number i

  • Why does the Phone Version appear as desktop version when it is online

    I designed a website in Adobe Muse. I also did a Phone Layout. Now the site is online. On the phone the site opens in the phone Layout but after using the navigation the site changes to the desktop version, which is not readable on the phone. What ca

  • Making a new private network.

    I want to build a network - private network. I have 80-90 sites with up to 14 hosts on each site. The hosts comunicate with a server. Not much trafic. Can I use a couple of 2924-XL-EN to connect the sites together? And from the switches a connection