Download a file

hi i i've the following problem, i need download i fiel into web dynpro application i'm using file download action but thios action request me a node with suply file and a component of type xstring but when i invoke the follow code i can't insert the context from a internal an d i need download the context of the table from webdynpro
  data conv_out type ref to cl_abap_conv_out_ce.
  data struct type if_main=>element_file_suply.
fill the file content
  conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
  conv_out->convert(
    exporting
      data = here data
   importing
      buffer = struct-file ).
  node->bind_structure( struct ).
so i need download a table with all the column inside anyone know how i can do it

Hi John
You can use following funcntions. First one to create internal table to string and second FM SCMS_STRING_TO_XSTRING to convert String to XSTRING. Then this XSTRING value you can pass to CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE. here i created small test code. may be helpful for you.
data: tab_str type string.
  data: begin of it_tab1,
       name(20),
       age(10) ,
      end of it_tab1.
data : lv_name type xstring.
         data it_tab like STANDARD TABLE OF it_tab1.
         data: wa like line of it_tab.
         wa-name = 'naresh'.
         wa-age = '30'.
         append wa to it_tab.
         wa-name = 'naresh1'.
         wa-age = '31'.
         append wa to it_tab.
CALL FUNCTION 'SOTR_SERV_TABLE_TO_STRING'
IMPORTING
   TEXT                      = tab_str
  TABLES
    TEXT_TAB                  = it_tab
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
  EXPORTING
    TEXT           = tab_str
IMPORTING
   BUFFER         = lv_name
CALL METHOD CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE
  EXPORTING
    I_FILENAME      = 'c:\test.txt'
    I_CONTENT       = lv_name
    I_MIME_TYPE     = 'TXT'
Regards
Naresh

Similar Messages

  • Error while downloading a file via APEX screen

    While I try to download a file using the below code;
    an HTTP 404 error is coming although the proc is being called and the parameter is correctly being passed.
    Please help.
    create or replace procedure download_myfile1(p_id in number)
    as
    v_mime varchar2(255);
    v_length number;
    v_file_name varchar2(2000);
    Lob_loc BLOB;
    BEGIN
    -- -- Selecting the details from the table whoch contains the extracts
    select EXTRACT_FILE,FILE_NAME,dbms_lob.getlength(EXTRACT_FILE) into lob_loc,v_file_name,v_length from table_name where ID = p_id;
    -- -- set up HTTP header
    -- -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    owa_util.mime_header( 'application/octet', FALSE );
    -- set the size so the browser knows how much to download
    --v_file_name := substr(v_file_name,1,instr(v_file_name,'.')-1);
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment; filename="'||v_file_name|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( lob_loc );
    end download_myfile1;
    It shows a POP up window by which u can save or opens the file. But no pop up displayed in this case.
    -Shreya

    Hi,
    Made the same changes but still getting the same error.
    The earlier URL also that I had mentoned would dynamically make this url mentioned by you and then shows the pop up window.
    However when I am right clicking on the download link and then clicking 'Save target as' then this error message is provided:
    Internet Cannot download [schema name].download_myfile2 from [DNS name]
    Internet Explorer was not able to open this Internet Site.The requested site is either unavailable or cannot be found .Please try again.
    Please help..
    Thanks in Advance ...
    Shreya
    Edited by: 935203 on Jul 9, 2012 11:58 PM

  • Display save as dialog when downloading a file

    Hi,
    I want to display a save as dialog when the user downloads a file.
    Now I get a dialog where the user can choose to open or save it.
    I set these headers:
    res.setHeader("Content-disposition", "attachment; filename=" + filnamn);
    res.addHeader("Content-Type", "application/force-download");Thanks!

    Sorry!
    When the user downloads a file I want to open a dialog where the user
    can write a filename and then click Save to save the file.
    Today I get a dialog where the user first have to choose if he wants to open or save the file.
    When he clicks save then the dialog appears that I would want to be displayed.
    I hope this clearifies my question.

  • How to log in background and execute a function for downloading a file

    Hello,
    i have a problem.
    I have an application with logon functionality. Over the application there is function to create a xml file for downloading it to the pc.
    Now i want to download this file in background and save it to a server.
    My problem is here how can i do this. The main problem is how to logon with the userid and password in background and how to dowload the file.
    Thanks,
    Regards,
    Ronald

    hi Ps ,
    Can you please do small sample ,
    that would help me in clear understanding
    thanks in advance
    ashok.c

  • How to let user download multi files at the same time in WebDynpro ABAP?

    hi all:
    As you know, WeyDynpor has provided upload/download UI element, but it seems that it only support one file upload/downlaod at the same time.The following is the API method to download one file in Webdynpro:
        cl_wd_runtime_services=>attach_file_to_response(
         EXPORTING
           i_filename      = lv_filename
           i_content       = lv_content
           i_mime_type     = lv_mine_type
           i_in_new_window = abap_true
           i_inplace       = abap_false
    *      EXCEPTIONS
    *        others          = 1
    but if when use click one button, we want to provide user a html file plus 2 icons files which are used as this html file's resource file, then how to let user download these 3 files together at the same time?
    one simple way is calling the download api (cl_wd_runtime_services=>attach_file_to_response) 3 times,
    but it is very ugly that three popup windows are shown to let user select every file's download path, which is unaccepted.
    So anyone know more convienient way to handle it?
    thanks.

    Hi,
    I suggest you to zip the files and attach it to the response. Do the add file part for each of your files
         "References
         DATA lr_zip TYPE REF TO cl_abap_zip.
         "Variables
         DATA lv_zip_xstring TYPE xstring.
         DATA lv_zip_name TYPE string.
         DATA lv_file_content TYPE xstring.
         DATA lv_file_name  TYPE string.
         "Create instance
         CREATE OBJECT lr_zip.
         "Add file
         lr_zip_attachments->add(
           EXPORTING name = lv_file_name
                  content = lv_file_content ).
         lr_zip_attachments->save( RECEIVING zip = lv_zip_xstring ).
         "Attach zip file to response
         cl_wd_runtime_services=>attach_file_to_response(
           EXPORTING i_filename      = lv_zip_name
                     i_mime_type     = 'ZIP/APPLICATION'
                     i_content       = lv_zip_xstring ).

  • Downloading a file would bring up an option to open the file or save it - for some reason now it just downloads straight to the download folder. Why? Problem with Firefox or something else?

    Downloading a file would normally bring up an option to open the file with the appropriate program or save it - for some reason now it just downloads straight to the download folder. Why? Problem with Firefox or something else? It's very frustrating - sometimes you want the file opened first so it can be discarded or saved to a different location.

    Hey. that's great! Thanks for posting back with the outcome.

  • Problem on windows xp with downloaded zip file

    Hi,
    I have written a JSP to download file which is as follows
    try
    response.setContentType("application/download");
    response.setHeader("Content-Disposition","attachment;filename=<FileName>");
    int iRead;
    FileInputStream stream = null;
    try
    File f = new File(<FilePath>);
    stream = new FileInputStream(f);
    while ((iRead = stream.read()) != -1)
    out.write(iRead);
    out.flush();
    finally
    if (stream != null)
    stream.close();
    catch(Exception e)
    //out.println("Exception : "+e);
    After downloading zip file, could not extract files on windows XP by using any tool or built-in extractor i.e. compressed(zipped)folders (error: compressed folder invalid or corrupted).
    But this works on win2k or win98
    How can i work with it or can anyone tell me a solution to handle such a problem.
    Thanks in advance.
    Rajesh
    [email protected]

    This could be a problem with the built-in ZIP program in Win XP - it's possible that the ZIP you are downloading (uploading?) is simply incompatible with the XP program. In Win 98 & 2000, you would have to use your own ZIP program, e.g. Winzip, and that can handle more formats that the XP program.
    Try installing the same ZIP program that you have on w98/2k on your XP machine, and see if you can open the uploaded file using it.

  • How to download multiple files?

    I have an air app where a user can click a thumbnail and download that file to their download folder.
    My question is how to go about allowing the user to select more than one and download them instead of one at a time.
    Do i need to just put the download in a loop? Also My custom item renderer and stopped the tiles from looking like they are selected, how would i make them look selected?

    try this
    private function downloadFile(url:String):void{
                var urlStream:URLStream = new URLStream();
                   var request:URLRequest = new URLRequest(url);
                downloadFileName=getDownloadFilename(url);
                      urlStream.addEventListener(Event.COMPLETE, writeFile);
                      urlStream.addEventListener(IOErrorEvent.IO_ERROR , function (e:IOErrorEvent):void{
                      urlStream.load(request);
                urlStream.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
         private function getDownloadFilename(URL:String):String{
                return(URL.substring(URL.lastIndexOf("/"),URL.length));
            private function onIOError (e:IOErrorEvent):void
                trace("An Error Occured and it looked like this.", e.text);
             private function writeFile(event:Event):void { 
                 var fileStream:FileStream = new FileStream(); 
                 var file:File=//perfered filename with location              
                fileStream.open(file, FileMode.WRITE);     
                 var dataBuffer:ByteArray = new ByteArray(); 
                event.target.readBytes(dataBuffer, 0, event.target.bytesAvailable); 
                fileStream.writeBytes(dataBuffer, 0, dataBuffer.length); 
                 fileStream.close(); 
                event.target.close(); 
                downloadFile(NEXT_ONE); 

  • Firefox opens up an explorer window when I download a file

    Recently, Firefox started opening up an Explorer window every time I download a file. It's Better Explorer, actually, since I use that to replace the Microsoft version. The folder that opens is the target destination. So it creates multiple tabs, but I expect that it would just open up multiple instances of Windows Explorer if that's what I used.
    So if I download a dozen images, I get a dozen tabs opened. This doesn't happen with IE or Chrome. I do have multiple extensions installed, but I've gone through the options in Firefox and any relating to downloads and none of them seem to have anything that might cause this. I did check the Applications tab under the Firefox Options, since that seemed like a probable cause. But I don't see anything. And I don't recall changing anything recently, in any case. I can't see anything in Better Explorer that would cause this behavior. Which is borne out by this not occurring in other browsers. And I haven't changed anything it, either.
    I tried downloading something with NetVideoHunter and I get the same behavior. But it doesn't happen with DownloadThemAll!
    I've tried researching it on-line, but the queries I use are apparently too similar to the ones for other issues, because nothing that comes up is even close to my problem.
    As this is getting very annoying, any help would be greatly appreciated. Firefox remains my favorite desktop browser and I'm not prepared to give it up over this. But I'd hate to have to reinstall it, since I have it configure just the way I want it. And I'm not even sure that would fix the issue.
    Thanks

    Start Firefox in [https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode safe mode] to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    Do NOT click the Reset button on the Safe Mode start window.
    * https://support.mozilla.org/kb/Safe+Mode
    * https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    In Firefox Safe mode these changes are effective:
    * all extensions are disabled (about:addons)
    * default theme is used (no persona)
    * userChrome.css and userContent.css are ignored (chrome folder)
    * default toolbar layout is used (file: localstore-safe.rdf)
    * Javascript JIT compilers are disabled (prefs: javascript.options.*jit)
    * hardware acceleration is disabled (Options > Advanced > General)
    * plugins are not affected
    * preferences are not affected
    Your profile folder contains a user.js file, which includes preferences that were not created by Firefox.
    so you may want to also check for a user.js file and DELETE that.
    * https://support.mozilla.org/en-US/kb/how-to-fix-preferences-wont-save#w_user-js-file-overriding-preferences

  • Error while downloading PDF file from FTP Server

    Hi Friends,
    I have sent a PDF file with data to FTP , Then i want to check that uploaded pdf file , whether that is correct or not?
    for that , i have downloaded that file from FTP and i am trying to open the file . but it is giving this problem .
    "There was an error opening the document . The file is damaged and could not be repaired."
    will you suggest me regarding this.
    thanks in advance.
    balaji.T.

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
              EXPORTING
           SRC_SPOOLID                    = spoolno
                src_spoolid                    = wa_file-rqident
                no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
              IMPORTING
                pdf_bytecount                  = numbytes
                pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
                btc_jobname                    = jobname
                btc_jobcount                   = jobcount
              TABLES
                pdf                            = pdf
              EXCEPTIONS
                err_no_otf_spooljob            = 1
                err_no_spooljob                = 2
                err_no_permission              = 3
                err_conv_not_possible          = 4
                err_bad_dstdevice              = 5
                user_cancelled                 = 6
                err_spoolerror                 = 7
                err_temseerror                 = 8
                err_btcjob_open_failed         = 9
                err_btcjob_submit_failed       = 10
                err_btcjob_close_failed        = 11.
    because of this one PDF internal table is obtained.
           OPEN DATASET L_FILENAME  FOR OUTPUT in text mode  MESSAGE MSG.
      LOOP AT pdf.
        CONCATENATE pdf-tdformat       "Material group
                     pdf-TDLINE       "Basic Material
               INTO ITEXT-TLINE ..
        APPEND ITEXT.
        TRANSFER ITEXT TO L_FILENAME.
      ENDLOOP.

  • Downloading a file from App Server to User's Desktop

    Hi All,
    I know that there are many threads on file upload and download :-)
    I have tried to browse through most of them and could not find my solution.
    The requirement is to place a file in the unix app server directory and allow the user to download it using a link, to the user's desktop. In case you think that this has already been answered in an old thread, kindly give me the pointer. Any sample code for doing this, would be great.
    I know how to upload a file from desktop to table/app server. I know how to download a file from a BLOB column in database.
    Thanks,
    Amit

    You would not be able to use file upload or download beans, as they interact with the database and not the filesystem.
    You would need to write a simple file reader routing in plain java.
    Tapash

  • How to download a file from a folder

    hello frnds.. i've uploaded a file to a folder in tomcat server. Now how to download that file at the client side.. pls help me out... it would be better if you gimme the related code for it..

    Create a link to it.
    EG:
    Link
    Here I asked a similar question a while back. Link
    Edited by: gtRpr on 2008/12/15 10:08

  • 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

  • How do I stop firefox from pre-downloading a file during a file download prompt?

    I use DownThemAll as my download manager for files generally over 10MB, as my internet connection is generally too slow for firefox to download a file larger then this without firefox "finishing" a download before it's complete, corrupting the file. This never happens with DownThemAll.
    For some sites, either there is no download link to right click or it starts automatically, launching the download prompt. Firefox's internal download manager automatically starts downloading the file (not visibly, but in the background) before I can choose to use DownThemAll from the prompt instead.
    This wastes bandwidth. Even worse, some hosting sites have randomly generated download gates for each session that expire after disconnection or limit you to a single download in a given time frame. This means that I effectively can't use DownThemAll on certain websites because firefox's own download manager steps in and gets in the way.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How to edit a downloaded .pdf file?

    Hi! Have a downloaded .pdf file, (application for employment form) My options are to print out/fill out. I want to know if there is a way that I can edit the application so that I can fill it out on line (Neater) then print. Between a 2004 version of Word, plus Keynote, Pages and Adobe 8, I can't edit the application. I called Apple and they said there is no way that I edit a pdf file so that I can complete the application on line. There must be a way to do this, right? Thanks, Bill

    Bostonfan49 wrote:
    Hi! Have a downloaded .pdf file, (application for employment form) My options are to print out/fill out. I want to know if there is a way that I can edit the application so that I can fill it out on line (Neater) then print. Between a 2004 version of Word, plus Keynote, Pages and Adobe 8, I can't edit the application. I called Apple and they said there is no way that I edit a pdf file so that I can complete the application on line. There must be a way to do this, right? Thanks, Bill
    Yes, there is a way. First, if check the security on the pdf. Adobe has many levels of security, so that files can be printed but not edited and not made into smaller files, etc.
    Usually you would need the real Adobe app, not the reader. But then, even though Adobe can edit pdf files, it will not do so if the file is protected. You normally would be asked for a password when you attempt to modify a PW-protected pdf document.
    That all being said, if the document is protected I can only refer you to ghostscript, ghostview and GSView.

  • Mavericks 10.9.1. Freezes or trackpad becomes slow and unresponsive when viewing downloaded PDF files in Preview.Help!

    The earlier post was my first attempt at posting and had some typos. Repeated with typos corrected.
    I have a Macbook Pro Retina 13" Late 2013 with preinstalled Mavericks.I now have the 10.9.1 update. Almost from the time of purchase in Nov '13, I have been experiencing freezes and slow & unresponsive trackpad. I have more or less narrowed this symptom as happening when viewing downloaded PDF files. The only option is to force eject, if available or shut down. I spoke to Support as I thought it was a RAM issue and they told me that in Mavericks RAM showing almost full was normal as it uses RAM differently. They took me through some resets and cleaning up which has helped a little but freezing stll happens. This never happened with my Macbook AIr running Lion. Any suggestions?
    Shankar9
    Macbook Pro Retina 13" Late '13-Mavericks 10.9.1
    Macbook Air 13" Mid '11-Lion
    Macbook Aluminium 13" Late '08-Snow Leopard

    So a PDF file that you can view in Preview on your MBA causes your new MBP to lock up and/or slow down. Is this right? Also you say more or less narrowed down to PDFs with Preview but does the computer exhibit this behavior with other programs and if so under what conditions? And how much free hard drive space do you have?
    Viewing memory use in Mavericks is different than with previous versions of the OS. Today it looks like we need to pay attention to what Apple calls Memory Pressure which is gauged by the bar graph in Activity Monitor and to the Virtual Memory being used. When the memory pressure graph bar gets too high it turns red and that's bad news. Looking at how much memory is being used doesn't help - I have a 16GB computer and with almost nothing running it still shows something like 15.79GB used but the memory pressure graph is just a think green line. So unless you see the memory pressure bar turning red lets not worry about memory usage at the moment.
    If among the things AppleCare had you do was reinstall Mavericks then I recommend a trip to the Apple store - and take a problem PDF file with you to demonstrate.

Maybe you are looking for

  • Install second dvd burner

    My new macpro comes with one dvd drive, I'd like to install a second one on the empty slot below. My question is what kind of drive do I need to purchase? IDE, SATA, etc? I assume I need to remove the front tray cover of the drive? How about compatib

  • How to select data in a LONG datatype

    Hello friends.... We actually store some texts in a long column datatype, but we're facing the need of search this columns some specifics words. I tryed to select but it says me SQL was wiaintg for the NUMBER dt and got LONG. How can I search and sel

  • When Can't I Click on The Box?

    Cursor is working for normal things but not when trying to click on a box. Examples: On eBay I can type in amt of my bid but when a click "BID" it doesn't do anything. When I fill out a registration and click "Submit", nothing happens. Just tried to

  • Problem making disk image of Panther install cds...

    Hi everyone! I want to make a disk image of my Panther retail install cds...just to have a backup in case I lose my cds or something. The problem is on disk 2 I keep getting an input/output error using Disk Utility. I tried to use SuperDuper and I go

  • Standard field for Net explosive mass (NEM) for dg documents

    Hi, I have searched standard fields in the material master and dangerous goods master but i can not find a standard field for Net explosive mass (NEM). This value is needed for dangerous goods documents. Is there anyone that know if there is a standa