Implementing file "Save as" functionality for file download api

Hi,
I want to implement File Download (Open/Save as/Cancel dialogue box) programmatically.
I am displaying list of links to document in a web dynpro table and I dont want to set IWDResource data for all entries in table.
And on Click of a button/link to action, I want to open up a File download box.
I have URL to the file with me and I'm able to convert it to IWDResource.
Following are the things available with me for a selected file:-
-- Complete name of file along with extension
-- byte[] of file.
Please help.
Thanks and regards,
Amey Mogare

I could achieve it with following code:-
     String l_str_LinkValue = null;
     String l_str_LinkName = null;
     URL l_url = null;
     InputStream  l_is_inputS = null;
     try {
          l_str_LinkValue = wdContext.currentCtx_vn_KmFolderDataElement().getLinkValue();
          l_str_LinkName = wdContext.currentCtx_vn_KmFolderDataElement().getLinkName();
          l_url = new URL(l_str_LinkValue);
          l_is_inputS = l_url.openStream(); 
          IWDResource res = WDResourceFactory.createResource(l_is_inputS, l_str_LinkName, WDWebResourceType.UNKNOWN, true);
          if(res != null){
               wdContext.currentContextElement().setFileRes(res);
          }else{
               myMessage.reportException("Unable to create file", true);
     catch (MalformedURLException mfurle) {
          myMessage.reportException("MalformedURLException : "+mfurle.toString(), true);
          wdContext.currentContextElement().setFileRes(null);
     catch (IOException ioe) {
          myMessage.reportException("IOException : "+ioe.toString(), true);
          wdContext.currentContextElement().setFileRes(null);
     catch (Exception e) {
          myMessage.reportException("Exception : "+e.toString(), true);
          wdContext.currentContextElement().setFileRes(null);

Similar Messages

  • File-Save : Keeps asking for file name even if in a file

    In the sql worksheet if you edit a file, the File->Save button shows as disabled.
    Also, if you try Cnrtl S, the Save dialog window to select a file keeps coming up - very annoying. In my opinion, that should only come up for SaveAs. Thanks!

    Thanks! I have a slight disagreement with the Ctrl S functionality - if you are in the file that you opened, CtrlS should just Save to the file you are in and not pop up the SaveAs dialog. This is the basic functionality of CnrtlS in Word, Toad .....

  • BI IP --- Planning function for File Upload

    Hai All,
    In BI IP , When I am trying to load the data (text file) by using Planning function for File Upload. I am getting an error message When I am clicking on Update .
    Error Message : Inconsistent input parameter (parameter: <unknown>, value <unknown>).
    In Text file I am using Tab Separation for each value
    Anyone help me out.
    Thanks,
    Bhima

    Hi Bhima
    Try one of these; it should work:
    1. If you are on SP 14 you would need to upgrade to SP 15. It would work fine
    2. If not, then -
         a] apply note 1070655 - Termination msg CL_RSPLFR_CONTROLLER =>GET_READ_WRITE_PROVIDS
         b] Apply Correction Instruction 566059 [i.e: in Object - CL_RSPLFR_CONTROLLER GET_READ_WRITE_PROVIDS,
    delete the block: l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = p_infoprov ).
    and insert block - l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = i_infoprov ).
    Goodluck
    Srikanth

  • How to skip(do not wnat to get display) save dialogue box for file download

    I am having servlet for downlading a file from server. When I call this servelt I am able to get the file from server but I get a save dialog box which I do not want. I want that this file should be stored at a specific location given by me in a servlet.
    So haoe I can avoid that save dialog box and where I should specify the specific location?
    Thanks in advance
    package com.txcs.sms.server.servlet;
    import java.io.*;
    import java.util.zip.GZIPOutputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class DownloadServlet extends HttpServlet
        public DownloadServlet()
            separator = "/";
            root = ".";
        public void init(ServletConfig servletconfig)
            throws ServletException
            super.init(servletconfig);
            context = servletconfig.getServletContext();
            String s;
            if((s = getInitParameter("dir")) == null)
                s = root;
            separator = System.getProperty("file.separator");
            if(!s.endsWith(separator) && !s.endsWith("/"))
                s = s + separator;
            root = s;
        public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            doPost(httpservletrequest, httpservletresponse);
        public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            Object obj = null;
            String s = "";
            s = HttpUtils.getRequestURL(httpservletrequest).toString();
            int i;
            if((i = s.indexOf("?")) > 0)
                s = s.substring(0, i);
            String s1;
            if((s1 = httpservletrequest.getQueryString()) == null)
                s1 = "";
            else
                s1 = decode(s1);
            if(s1.length() == 0)
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter = httpservletresponse.getWriter();
                printwriter.println("<html>");
                printwriter.println("<br><br><br>Could not get file name ");
                printwriter.println("</html>");
                printwriter.flush();
                printwriter.close();
                return;
            if(s1.indexOf(".." + separator) >= 0 || s1.indexOf("../") >= 0)
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter1 = httpservletresponse.getWriter();
                printwriter1.println("<html>");
                printwriter1.println("<br><br><br>Could not use this file name by the security restrictions ");
                printwriter1.println("</html>");
                printwriter1.flush();
                printwriter1.close();
                return;
            File file = lookupFile(root + s1);
            if(file == null)
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter2 = httpservletresponse.getWriter();
                printwriter2.println("<html>");
                printwriter2.println("<br><br><br>Could not read file " + s1);
                printwriter2.println("</html>");
                printwriter2.flush();
                printwriter2.close();
                return;
            if(!file.exists() || !file.canRead())
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter3 = httpservletresponse.getWriter();
                printwriter3.println("<html><font face=\"Arial\">");
                printwriter3.println("<br><br><br>Could not read file " + s1);
                printwriter3.print("<br>Reasons are: ");
                if(!file.exists())
                    printwriter3.println("file does not exist");
                else
                    printwriter3.println("file is not readable at this moment");
                printwriter3.println("</font></html>");
                printwriter3.flush();
                printwriter3.close();
                return;
            String s2 = httpservletrequest.getHeader("Accept-Encoding");
            boolean flag = false;
            if(s2 != null && s2.indexOf("gzip") >= 0 && "true".equalsIgnoreCase(getInitParameter("gzip")))
                flag = true;
            if(flag)
                httpservletresponse.setHeader("Content-Encoding", "gzip");
                httpservletresponse.setHeader("Content-Disposition", "attachment;filename=\"" + s1 + "\"");
                javax.servlet.ServletOutputStream servletoutputstream = httpservletresponse.getOutputStream();
                GZIPOutputStream gzipoutputstream = new GZIPOutputStream(servletoutputstream);
                dumpFile(root + s1, gzipoutputstream);
                gzipoutputstream.close();
                servletoutputstream.close();
            } else
                httpservletresponse.setContentType("application/octet-stream");
                httpservletresponse.setHeader("Content-Disposition", "attachment;filename=\"" + s1 + "\"");
                javax.servlet.ServletOutputStream servletoutputstream1 = httpservletresponse.getOutputStream();
                dumpFile(root + s1, servletoutputstream1);
                servletoutputstream1.flush();
                servletoutputstream1.close();
        private String getFromQuery(String s, String s1)
            if(s == null)
                return "";
            int i = s.indexOf(s1);
            if(i < 0)
                return "";
            String s2 = s.substring(i + s1.length());
            if((i = s2.indexOf("&")) < 0)
                return s2;
            else
                return s2.substring(0, i);
        private void dumpFile(String s, OutputStream outputstream)
            String s1 = s;
            byte abyte0[] = new byte[4096];
            try
                BufferedInputStream bufferedinputstream = new BufferedInputStream(new FileInputStream(lookupFile(s1)));
                int i;
                while((i = bufferedinputstream.read(abyte0, 0, 4096)) != -1)
                    outputstream.write(abyte0, 0, i);
                bufferedinputstream.close();
            catch(Exception exception) { }
        private String decode(String s)
            StringBuffer stringbuffer = new StringBuffer(0);
            for(int i = 0; i < s.length(); i++)
                char c = s.charAt(i);
                if(c == '+')
                    stringbuffer.append(' ');
                else
                if(c == '%')
                    char c1 = '\0';
                    for(int j = 0; j < 2; j++)
                        c1 *= '\020';
                        c = s.charAt(++i);
                        if(c >= '0' && c <= '9')
                            c1 += c - 48;
                            continue;
                        if((c < 'A' || c > 'F') && (c < 'a' || c > 'f'))
                            break;
                        switch(c)
                        case 65: // 'A'
                        case 97: // 'a'
                            c1 += '\n';
                            break;
                        case 66: // 'B'
                        case 98: // 'b'
                            c1 += '\013';
                            break;
                        case 67: // 'C'
                        case 99: // 'c'
                            c1 += '\f';
                            break;
                        case 68: // 'D'
                        case 100: // 'd'
                            c1 += '\r';
                            break;
                        case 69: // 'E'
                        case 101: // 'e'
                            c1 += '\016';
                            break;
                        case 70: // 'F'
                        case 102: // 'f'
                            c1 += '\017';
                            break;
                    stringbuffer.append(c1);
                } else
                    stringbuffer.append(c);
            return stringbuffer.toString();
        public String getServletInfo()
            return "A DownloadServlet servlet ";
        private File lookupFile(String s)
            File file = new File(s);
            return file.isAbsolute() ? file : new File(context.getRealPath("/"), s);
        private static final String DIR = "dir";
        private static final String GZIP = "gzip";
        private ServletContext context;
        private String separator;
        private String root;
        private static final String VERSION = "ver. 1.6";
        private static final String CPR = "A DownloadServlet servlet ";
    }

    Can't be done, for obvious security reasons.
    Would you want someone downloading something into your windows\system directory when you navigate to their webpage?

  • Presenter forces permanentely the file save dialog even for unchanged documents

    Presenter permanentely forces the "Do you want to save the changes ..." file save dialog to appear even for unchanged documents when I try to close it.
    To confirm the saving all times is not the solution because then I will loose the file's time/date stamp for the last real change.
    Not confirming the saving can be risky in case of any changes to the document which I am not aware anymore for that moment.
    Especially in case of having multiple documents open - this drives me really crazy.
    Deactivating the Adobe Presenter Add-in would solve the issue - so it is a problem related to Adobe Presenter (and not related to Powerpoint).
    I am using:
    Adobe Presenter 9.0.2
    Microsoft Office Professional Plus 2010
    Windows 7, 64 bit, Service Pack 1
    Thanks for your help
    Stefan

    The easiest way to solve the problem is to temporarily deactivate Adobe Presenter when you don't need it.
    In PowerPoint, go to File / Options / Add-Ins, select "COM Add-Ins" at the bottom of the window and click "Go".
    Then un-check the Adobe Presenter PowerPoint COM AddIn:
    You can easily reverse the process when you next need to use Presenter.

  • Presenter forces the file save dialog even for unchanged documents

    Presenter always forces the "Do you want to save the changes ..." file save dialog to appear even for unchanged documents.
    To confirm the saving all times is not the solution because then I will loose the file's time/date stamp for the last real change.
    Not confirming the saving can be risky in case of any changes to the document which I am not aware anymore for that moment.
    Especially in case of having multiple documents open - this drives me really crazy.
    Deactivating the Adobe Presenter Add-in would solve the issue - so it is a problem related to Adobe Presenter (and not related to Powerpoint).
    I am using:
    Adobe Presenter 9.0.2
    Microsoft Office Professional Plus 2010
    Windows 7, 64 bit, Service Pack 1
    Thanks for your help
    Stefan

    The easiest way to solve the problem is to temporarily deactivate Adobe Presenter when you don't need it.
    In PowerPoint, go to File / Options / Add-Ins, select "COM Add-Ins" at the bottom of the window and click "Go".
    Then un-check the Adobe Presenter PowerPoint COM AddIn:
    You can easily reverse the process when you next need to use Presenter.

  • BAPI functions for file upload

    Hi All,
    can anyone  tell me Bapi functions for the file or image upload using?
    With best regards,
    Suneetha

    Hi,
    Uploading LOGO in SAP
    http://www.sap-img.com/ts001.htm
    Upload graphics on
    The program RSTXLDMC can be used to upload graphics (file extension .tif on PC files) into individual standard text.
    <b>ws_upload</b>
    Transfer files from the frontend to the application server.
    Rgds,
    Prakash

  • Have file save dialog configure csv file type

    I am saving a program recipe file in csv format.
    I can save and retrieve the file without problems.
    What I would like to do is have the save file dialog box show a file type of *.csv instead of the default all file types *.* and then depend on the user to enter file.csv
    Does anyone know a way to do this programitically?
    Solved!
    Go to Solution.

    Hi Clark,
    the FileDialog has some "pattern label" inputs. Have you used them or read the context help for that function?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • No File Save as or no File capability

    Vista environment with MS browser. I travel to a web site that provides regular PDF's for me to download (Adobe Reader 8.1.0)and save. I download the PDF and attempt to rename and save. I do not have a file > save as menu nor does the small diskette shown in the tool bar of the downloaded document allow me to know where a supposed copy is located. Trying to find this solution via product Help is a real exercise in futility. It appears that I need more menu options on the downloaded document, but how to get them is a real mystery. Thanks for your input. Mike

    >when I attempt to use save a copy nothing occurs that allows me to name a file or select a folder.
    Ok...
    > And after searching no copy is saved.
    I'd expect that, it wouldn't be saved without asking.
    >
    >If I had a menu bar at the top of the PDF I could save as without a problem .
    It isn't clear to me whether you are viewing the PDF file in a browser
    window, such as Internet Explorer, or in an Adobe Reader window. If
    it's Adobe Reader you can use F9 to switch the menu bar on and off.
    Aandi Inston

  • ActiveX Save As function for Microsoft Excel 97- Excel 2003 & 5.0/95 Workbook (*.xls)

    Can someone show me how to use Active X - Save As function?
    I want to save it in  Microsoft Excel 97- Excel 2003 & 5.0/95 Workbook (*.xls)
    thanks in advance!
    Best regards,
    Krispiekream
    Solved!
    Go to Solution.

    Oh,
    I thought people stopped reading my other post so I posted another.
    sorry.
    but i found the solution
    FileFormat variant name integer code
    Microsoft Excel Workbook xlWorkbookNormal -4143
    Web Page xlHTML 44
    Template xlTemplate 17
    Text (Tab Delimited) xlCurrentPlatformText -4158
    Unicode Text xlUnicodeText 42
    Microsoft Excel 5.0/95 Workbook xlExcel5, xlExcel7 39
    Microsoft Excel 97-2000 & 5.0/95 Workbook xlExcel9795 43
    CSV (Comma Delimited) xlCSV 6
    Microsoft Excel 4.0 Worksheet xlExcel4 33
    Microsoft Excel 3.0 Worksheet xlExcel3 29
    Microsoft Excel 2.1 Worksheet xlExcel2 16
    Microsoft Excel 4.0 Workbook xlExcel4Workbook 35
    WK4 (1-2-3) xlWK4 38
    WK3, FM3 (1-2-3) xlWK3FM3 32
    WK3 (1-2-3) xlWK3FM3 15
    WK1, FMT (1-2-3) xlWK1FMT 30
    WK1, ALL (1-2-3) xlWK1ALL 31
    WK1 (1-2-3) xlWK1 5
    WKS (1-2-3) xlWKS 4
    WQ1 (Quattro Pro/DOS) xlWQ1 34
    DBF 4 (dBASE IV) xlDBF4 11
    DBF 3 (dBASE III) xlDBF3 8
    DBF 2 (dBASE II) xlDBF2 7
    Formatted Text (Space Delimited) xlTextPrinter 36
    Text (Macintosh) xlTextMac 19
    Text (MS-DOS) xlTextMSDOS 21
    CSV (Macintosh) xlCSVMac 22
    CSV (MS-DOS) xlCSVMSDOS 24
    DIF (Data Interchange Format) xlDIF 9
    SYLK (Symbolic Link) xlSYLK 2
    I know that its saving in the correct format. BUT I don't know why it wouldnt save 2 worksheets, but instead it only have 1.
    Best regards,
    Krispiekream

  • Callback Functions for the Enterprise API

    I'm using VB to write some API functions to pull journal detail from Enterprise 6.0, but having trouble with the callbacks. I did find some syntax errors in the toolkit.bas file, correct those and am able to pull specific data points, but the enum functions just crash. Because the documentation is scetchy at best, I'm not sure if my functions are wrong, if there are other syntax errors in the .bas file or if the dll's are corrupt.<BR><BR>I'd really appreciate some help from someone who has experience writing callback functions to the Enterprise API.<BR><BR>Thanks in advance.

    Hey there...
    I think part (if not all) of your question can be answered by abstracting it a level. Think of all the tools that are available through PL/SQL or JAVA in the database. For instance...
    * Heterogeneous Services that allow you to access any ODBC/JDBC data source directly from within the Oracle database.
    * DBMS_JOB that allows the scheduling of jobs to run at a given time/interval.
    * DMBS_FILE_UTL that allows Oracle to interact with the file system.
    That doesn't even take into account the things you can do with Java in the database.
    In short, just about everything you mentioned can be done in one shape or form with tools that reside in or around the oracle database.
    HTMLDB is a front end interface tool that has access to all of the tools available to you at database level.
    So in short (and in my opinion): Yes, it is capable of creating Enterprise level applications. I'm building a fairly complex one right now that interfaces with 2 external (non-oracle) databases via Heterogeneous services, and which used DBMS_JOB to schedule jobs to collate data from an external file system.
    I hope this helps..
    Doug Gault
    TXI

  • Can I restore the prior File print command functionality for Google maps?

    Printing Google Maps, recently the file command on Firefox only prints the map and not the directions also. The map and directions both used to print. I am aware that there is the print link near the map, this prints a much larger map and causes trouble with our ISA server. This link requires full access to the Google.com site. We have restricted access to the maps.google.com for employee productivy reasons. My question is can I restore the prior printing functionality? The printing works fine with I.E.

    It's either that or finding other software for your scanning needs. For example, Image Capture comes with OS X, VueScan 9.2.09, ExactScan Pro 2.24.
    Alternatively, partition your hard drive and install Snow Leopard on another volume.
    To resize the drive do the following:
    1. Open Disk Utility and select the drive entry (mfgr.'s ID and size) from the left side list.
    2. Click on the Partition tab in the DU main window. You should see the graphical sizing window showing the existing partitions. A portion may appear as a blue rectangle representing the used space on a partition.
    3. In the lower right corner of the sizing rectangle for each partition is a resizing gadget. Select it with the mouse and move the bottom of the rectangle upwards until you have reduced the existing partition enough to create the desired new volume's size. The space below the resized partition will appear gray. Click on the Apply button and wait until the process has completed.  (Note: You can only make a partition smaller in order to create new free space.)
    4. Click on the [+] button below the sizing window to add a new partition in the gray space you freed up. Give the new volume a name, if you wish, then click on the Apply button. Wait until the process has completed.
    You should now have a new volume on the drive. Use the Snow Leopard installer DVD to install Snow Leopard on your new volume.
    It would be wise to have a backup of your current system as resizing is not necessarily free of risk for data loss.  Your drive must have sufficient contiguous free space for this process to work.

  • Write to measurement file will not ask for file name once as selected.

    When using the Write to Measurement file Express VI.  I select "Ask user to choose file" and "Ask only once" with the intention that the data from each iteration simply be appended to the chosen file.
    I select "Run continuous" and the VI asks for me to choose a file repeatedly anyway instead of just appending the first file.  Selecting "Write to one file" properly appends data to the file specified in the box.
    Am I doing something wrong?

    DianeS wrote:
    Personally I can't figure out why that particular button even exists (I'm told it's occasionally useful for debugging).  
    I find it useful if I am creating a subVI that is supposed to be a part of another VI.  No while, loop just some inputs and outputs as a function.  If I want to test it out stand alone and try a variety of inputs, then Run Continuous and change the inputs, then I see immediate feedback on the outputs.  Once I'm satisfied its working right, then there is no need to clean up.  Just save it and drop it in the large VI as a subVI.
    Beyond that, I see no need for Run Continuous.

  • How to implement the documentation help function for webdynpro application

    We have implemented SAP Travelmanagement ESS services which uses ABAP Webdynpro. In each of the screen there is a "help" link on the top right corner. I would like to know how to use this function to link a help file that explains what needs to be done on each screen.
    My requirement is to provide screen specific help information as a document for each of the screen in my webdynpro application.
    Any suggestions, options, samples from the experts would be most appreciated.
    Regards
    Vivek

    Hi Vivek,
    seems to be your WDA are built by FPM, thats how by default you will be getting help link in top corner.
    when you click on help link it has to display the help related data.
    for this sap calls the standard wdc: WDHC_COMPONENT and the view:WDHC_APPL_HELP in this view you will see the element as: TEXT to fill some text which is your help data.
    there might be some way to fill this TEXT (text view) try this.
    or else i will check and upate you soon.
    all the best.
    Regards,
    Mahesh.Gattu

  • When I save a file on Google Chrome the file saves as a Firefox File. How do change it so that the file saves as a Google Chrome file?

    Recently i have updated my Google Chrome and this has never been an issue. Im using Mac OS X Lion 10.7.5
    I have tried to Change Default settings in Google Chrome (did not work) also i have restarted my mac but the same problem still occurs.

    No.. sorry.. it does not seem possible effect .. if you can write you must be able to read..
    Are you using the TC with user profiles?
    What security are you using for disk access?
    What happens if you do turn on full guest access to read and write.. ?
    When the Mac that can save but cannot read does drop the file onto the TC,, can the other Mac's see that file? In other words is the file really there.. has it copied correctly. I still think if it has copied and you cannot read it back there is some permissions issues.
    Try creating a new user on the Mac that has issues.. and see if the new user and read and write correctly. Make sure the new user has at least equal rights as the users on the Mac's that can read and write without issues.
    Your intial question suggested this problem was spread over more than computer.. your second reply has reduced the issue to just one computer.. logically the issue is not the TC.. it is that computer. Ironically I have found logic for computer troubleshooting falls well behind voodoo. 

Maybe you are looking for

  • Windows Exlporer and iTunes 7.5

    I just got the new iPod nano and need to update my itunes - however, when trying to install 7.5, I get an error message that says one of the files that needs updating is opened and to close the following: Windows Explorer Process ID #### (there have

  • Cant burn cds (unkown error occurred: 4280) help

    i cant burn cds an error always pops up (4280)ive read a bunch of discussions and tryed all of the different burning speeds and none of them work can someone plz help me...! Microsoft Windows XP Professional Service Pack 2 (Build 2600) TOSHIBA Satell

  • Could not install Firefox 4 on Mac OS 10.4.11

    I'am using Mac OS X 10.4.11 (8S2167) Version du noyau : Darwin 8.11.1 Processor Intel ref ICH7-M AHCI Taille : 1 Go Memory Type : DDR2 SDRAM speed : 667 MHz État : OK the installation of Firefox 4 failed each tim

  • PROBLEME COMPILATION RT

    Bonjour, J'ai créé un projet RT avec communication de variable entre mon PC RT et mon PC Windows. Quand j'utilise mon VI RT principal à partir de Labview je n'ai aucun soucis, mon vi RT ne me génére aucune erreur. Mais quand je compile mon projet RT

  • HOW TO CARRY FORWARD RG1 CLOSING BALANCE TO OPENING BALANCE FOR NEW FISCAL

    Hi Experts How to carry forward the RG1 closing stock at the year end to opening balance of Rg1 for new year. Wt are the steps required for closing activity of RG1 and carry forward closing balance of last year to opening balance of  new year. Thanks