2-way file upload/download b/w client/server

I need help for a good design strategy for 2-way file upload/download betweeen client and server.
I have to upload a set of files to the server (which is a servlet)
and again the servlet downloads another set of files to the client (which is an applet)
I could find a solution to this problem only to a certain extent (i.e) I can upload any no.of files to the servlet from applet but the servlet can download only a single file to the applet.
But now the requirement needs the servlet to be able to send more than one file. I am not going anywhere ahead from this point since last 2 days.
I have used ObjectOutputStream-ObjectInputStream objects at both ends for communcation and sending the files as bufferes of 128 size. But this is becoming more complicated to manage the streams!!
if anyone of you have done this before please help with this!
Thaks
sri

Give this a try.
1) construct
2) call ZipDocVO.add(Serializable) for each obj that you wish to send.
3) call ZipDocVO.zip() to zip it up when you are finished adding objects.
4) send the ZipDocVO, using ObjectOuputStream or whatever
5) call ZipDocVO.unzip()
6) call ZipDocVO.getDocuments() to access your objects
import java.io.*;
import java.util.zip.*;
import java.util.*;
public class ZipDocVO implements Serializable {
     private List     vos;
     private byte[]     rawData;
     private boolean     isZipped;
     public ZipDocVO( byte botype, int key )
          vos = new ArrayList();
     public List getDocuments() { return vos; }
     public void add( Serializable doc ) { vos.add( doc ); }
     private boolean isZipped() { return isZipped; }
     public void zip() {
          if( isZipped() ) {
               System.out.println( "Already zipped!" );
          else {
               try {
                    // First zip our documents
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    GZIPOutputStream gzos = new GZIPOutputStream( baos );
                    ObjectOutputStream oos = new ObjectOutputStream( gzos );
                    oos.writeObject( vos );
                    oos.close();
                    // Then get rid of the unzipped versions
                    rawData = baos.toByteArray();
                    vos = null;
                    isZipped = true;
               catch( IOException ioe ) {
                    System.out.println( "Unable to zip : " +ioe.getMessage());
     public void unzip() {
          if( !isZipped() ) {
               System.out.println( "Not zipped!" );
          else {
               try {
                    // First unzip our documents
                    ByteArrayInputStream bais = new ByteArrayInputStream( rawData );
                    GZIPInputStream gzis = new GZIPInputStream( bais );
                    ObjectInputStream ois = new ObjectInputStream( gzis );
                    vos = (ArrayList)ois.readObject();
                    ois.close();
                    // Then get rid of the zipped versions
                    rawData = null;
                    isZipped = false;
               catch( Exception e ) {
                    System.out.println( "Unable to unzip : " +e.getMessage());
}

Similar Messages

  • File Upload/Download

    Hi
    When using the file upload/download functionality, APEX stores the uploaded object in a table by default. See: http://download-uk.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/up_dn_files.htm#CJAHDJDA
    Is there a way to specify that the file should NOT be stored in a table, but rather, be stored on the file system?. Example in a directory object location.
    I intend to use the upload/download functionality to load csv files that will then be parsed as external tables.
    Thanks
    Kezie

    Hi,
    I modified the above procedure to point to my tables and trying to create the procedure in Apex database and am getting the following error:
    Procedure:
    CREATE OR REPLACE PROCEDURE write_blob_to_file
    ( p_docid IN NUMBER,
    p_directory IN VARCHAR2,
    p_filename IN VARCHAR2 DEFAULT NULL )
    IS
    l_file utl_file.file_type;
    l_buffer RAW(32767);
    l_amount BINARY_INTEGER := 32767;
    l_position INTEGER := 1;
    l_blob BLOB;
    l_length INTEGER;
    l_filename VARCHAR2(400);
    BEGIN
    SELECT BLOB_CONTENT, MPP_name
    INTO l_blob, l_filename
    FROM MPP_FILES
    WHERE id = p_docid;
    IF p_filename IS NOT NULL THEN
    l_filename := p_filename;
    END IF;
    l_length := dbms_lob.getlength( l_blob );
    l_file := utl_file.fopen( p_directory, l_filename, 'wb', 32767 );
    WHILE l_position < l_length LOOP
    dbms_lob.read( l_blob, l_amount, l_position, l_buffer );
    utl_file.put_raw( l_file, l_buffer, TRUE );
    l_position := l_position + l_amount;
    END LOOP;
    utl_file.fclose( l_file );
    EXCEPTION
    WHEN others THEN
    IF utl_file.is_open( l_file ) THEN
    utl_file.fclose( l_file );
    END IF;
    raise_application_error( -20001, SQLERRM );
    END write_blob_to_file;
    Error:
    ERROR at line 6: PLS-00201: identifier 'UTL_FILE' must be declared
    4. p_filename IN VARCHAR2 DEFAULT NULL )
    5. IS
    6. l_file utl_file.file_type;
    7. l_buffer RAW(32767);
    8. l_amount BINARY_INTEGER := 32767;
    Please let me know what am i missing. I am pretty new to PL/SQL and Apex.
    Also wondering is there a way to download files from tables using Java Stored Procedure. Please give some pointers.
    Ramesh K

  • Urgent : file upload / download functionality in oracle portal page

    Hi friends
    I am new to portal development and am working on oracle portal 9i rel2 . I need to know how to put the file upload and download functionality in any page. the functionality given in oracle portal user guide is not user friendly (i.e in the content area add item of type file" ) .... i need to now is their any way to achieve the simple , one button click upload download functionality ..like we do in yahoo mails etc.
    any help will be highly appreciated.
    regards
    Dheeraj

    Well, I do not know the exact location of the document, however you can find the document to do this in modplsql User Guide ..(File Upload/Download).
    I am pasting some hint:
    e.g.
    Create an html form..code something like this:
    <html>
    <head>
    <title>test upload</title>
    </head>
    <body>
    <FORM      enctype="multipart/form-data"
    action="pls/mydad/write_info"
    method="POST">
    <p>Author's Name:<INPUT type="text" name="who">
    <p>Description:<INPUT type="text" name="description"><br>
    <p>File to upload:<INPUT type="file" name="file"><br>
    <p><INPUT type="submit">
    </FORM>
    </body>
    </html>
    Create a table
    (who varchar2(..).
    description varchar2(..),
    file varchar2(..));
    Your procedure something like this:
    procedure write_info (
    who in varchar2,
    description in varchar2,
    file in varchar2) as
    begin
    insert into myTable values (who, description, file);
    htp.htmlopen;
    htp.headopen;
    htp.title('File Uploaded');
    htp.headclose;
    htp.bodyopen;
    htp.header(1, 'Upload Status');
    htp.print('Uploaded ' || file || ' successfully');
    htp.bodyclose;
    htp.htmlclose;
    end;
    You should be able to download/access the file using the following URL format:
    http://<host>:<port>/pls/<dad>/docs/<file_name>
    Where file name is = Look for the value in the "myTable" > file.
    Do tell how you get on this.
    Thanx,
    Chetan.

  • File Uploads/Downloads

    I have an HP Pavillion Desktop with Windows 7 operating system. I think one of my children has disabled something because when I click on anything to do a file upload/download, I can't access my Desktop or any files on it. Help!

    Hi,
    The easiest way to solve this may be to run Windows System Restore.  First, copy any files currently on your Desktop, paste them into a new folder, then cut and paste the folder in to your Documents folder.
    Once you've done this, shut down the PC.  Windows System Restore is usually best run in Safe Mode.  Tap away at f8 as you start the PC to enter Windows Recovery Console.  Use the arrow keys to select Safe Mode and hit enter.  When this has loaded, from the Start Menu, click All Programs, click Accessories, click System Tools and launch System Restore.  Pick a restore point before at least 24 hours before this issue and then proceed with the restore process.  When complete, Windows will reboot as normal.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • File upload, download using ADF UIX and not JSP

    I have examples for the file upload, download using JSP
    But I want to use ADF UIX. Look and feel in this is impressing and I want to use this. Any one have example for this.
    Users will select a file from their desktop
    This will be stored into the database (Any document. Word, Excel)
    When they query the records then the UIX column need to give a hyperlink. Clicking on the link should prompt to download the file to the local system

    Sure, I use the Apache Commons File Upload package, so that is what I will discuss here ( [Commons File Upload|http://commons.apache.org/fileupload/] ).
    The Commons File Upload uses instances of ProgressListener to receive upload progress status. So first create a simple class that implements ProgressListener:
    public class ProgressListenerImpl implements ProgressListener {
        private int percent = 0;
        public int getPercentComplete() {
            return percent;
        public void update(long pBytesRead, long pContentLength, int pItems) {
            if (pContentLength > -1) { //content length is known;
                percent = (new Long((pBytesRead / pContentLength) * 100)).intValue();
    }So in your Servlet that handles file upload you will need to create an instance of this ProgressListenerImpl, register it as a listener and store it in the session:
    ServletFileUpload upload = new ServletFileUpload();
    ProgressListenerImpl listener = new ProgressListenerImpl();
    upload.setProgressListener(listener);
    request.getSession().setAttribute("ProgressListener", listener);
    ...Now create another servlet that will retrieve the ProgressListenerImpl, get the percent complete and write it back (how you actually write it back is up to you, could be text, an XML file, a JSON object, up to you):
    ProgressListenerImpl listener = (ProgressListenerImpl) request.getSession().getAttribute("ProgressListener");
    response.getWriter().println("" + listener.getPercentComplete());
    ...Then your XMLHttpRequest object will call this second servlet and read the string returned as the percent complete.
    HTH

  • File Upload/Download storing in ECC

    hi Guys,
    Using webdynpro abap application I am uploading a file.I want to store this file in the backend database(R/3). I am not able to stroe the Xstring value to the table.
    So I have made my table with field with  data type as string.
    Is there an standard function module to convert Xstring to String.
    Because in another webdynpro application I want to download the file which was uploaded so we require a function module to convert string to xstring again.
    Tell me how to store the Xstring data of the file to database tabel and agian download it.
    Regards,
    Shamila.

    Hi,
    Chek this standard document
    http://help.sap.com/saphelp_nw70/helpdata/EN/b3/be7941601b1d09e10000000a155106/frameset.htm
    Also check these forum threads
    Re: download a file
    File Upload/Download
    File download in Local PC
    Re: File Download to Excel
    for file upload control you can look at WDR_TEST_EVENTS component

  • File Upload / Download - Advice Required

    Hi all,
    This is really just a general question, looking for advice.
    I have downloaded and successfully used the File Upload PJC for Forms 6i - thanks Oracle.
    We are looking to use this to download and upload files from or to the client machine, and I am (relatively) confident of reversing the Java components to allow this to happen.
    However, we are actually looking to transfer the files from the client machine, to the 9iAS Tier and then to the UNIX (AIX) tier where the database (8.1.7.4) resides - and vice versa.
    I have considered a couple of different approaches :
    1. Run the Java Server component in the Database JVM to enable the writing/reading of files on the UNIX filesystem.
    2. Use TEXT_IO on the 9iAS tier, and UTL_FILE on the Database Tier, to move files between the two tiers.
    3. Write the files to / from the Database, and then from/to there into the UNIX filesystem.
    Does anyone have any expereince of attempting to implement a similar solution, or information on Oracle documentation explaining any of the above.
    Plus, I'm sure I must be missing a trick !
    Any other ideas ??
    Regards
    Marc Ludwig

    We have build a similar solution,
    for the download:
    we use the pl/sql gateway to send the file to the client with the following function:
    wpg_docload.download_File(lob_loc);
    you could build a pl/sql procedure that accepts an id and selects the blob locater and
    triggers this function. the procedure can be called by setting the configuration in your DAD correctly.
    that way its easier then rebuilding the whole fileupload utility.
    in the webforms you can have a code that opens a new window with an url you give.
    the url will point to the pl/sql function and you can pass the id of the record you want to get the blob from.
    for the upload to your database:
    well, we chose to loose the zip functionality and modify the pl/sql library that comes with it.
    instead of using the uploadserver class, you could build a pl/sql function in the database that
    accepts the varchar32 strings (which are base64encoded chunks of your file) and appends them to a blob.
    the function that could do that would look like:
    PROCEDURE APPEND_DATA(P_ID IN NUMBER, P_DATA IN VARCHAR2) IS
    bin_data blob;
    append_data blob;
    raw_data raw(16384);
    BEGIN
    dbms_lob.CREATETEMPORARY(append_data,true);
    dbms_lob.OPEN(append_data,DBMS_LOB.LOB_READWRITE);
    select binary_data into bin_data from ibs_physical_doc where id=P_ID for update;
    raw_data:= utl_encode.BASE64_DECODE(utl_raw.CAST_TO_RAW(p_data));
    dbms_lob.write(append_data, utl_raw.LENGTH(raw_data),1,raw_data);
    dbms_lob.APPEND(bin_data,append_data);
    dbms_lob.CLOSE(append_data);
    COMMIT;
    END;
    you can increase the chunksize a bit more.
    you still have a problem btw that you probably cant upload more then 4-8 mb before you get an out of memory error on the client.
    you could solve that by rewriting the client java file to send the file piece by piece on request by the server instead of all the pieces after eachother, and first read a piece of the file and then encode that piece and then send it instead of reading the whole file, encoding it and sending the chunks.
    Another option is to use the standard upload possibilties with web pl/sql, and open a new browser window to that window from forms. A drawback of that is that it is not integrated in the web forms program and that you cant see when the upload is finished (no callback). and that you are bound to the default table layout.
    one final thing, if you are going to use this, you might want to take a look at using JInitiator 1.3.1.9 if you arent using it already this automaticly sets the signature in the clients database if he accepts it. there is a bug in it, look for it somewhere in this forum. if you are using the sample that comes with forms 6i you will have to replace the fileuploadprogressbar with the one that comes with the forms 9i sample and recompile everything and i think you will have to use JDK1.3.1_03 for that. that means that you will have to modify the make batch file. the command for compiling is different, the classpath is an option when you call javac, also you will have to sign it with jarsigner.exe (in the jdk) instead of the one in the example.
    Hope this info is helpfull, if you like to have more specific code, mail me at [email protected]

  • Is there a way to upload/download photos anonymously?

    Is there a way to anonymously upload/download photos to the web without any sort of identification?
    For example, if I'm using something like TOR to browse, and I find an icon on a site or Google Images that I want to use as my avatar for a social networking site, can I "Save As" from my TOR browser and download that image anonymously to my computer's desktop? Or does my information leak when I save to my computer?
    ...and then, in turn and perhaps more importantly, how do I upload that photo as my social network photo/avatar without any sort of identifying source tag or whatever from my computer?
    When I attempt to upload a photo to the site, it keeps showing something like /Users/[iMacUserName]/Desktop
    Is there any way to do this anonymously?
    Would having something like a VPN be more useful than TOR in this situation?
    I'm new to all this, so I'd really appreciate any information possible. If it makes more sense to send an IM or private email, please feel free to contact me that way as well.
    Any recommendations for a great VPN to use with mac would be great too.
    Thanks so much in advance for your time.

    The image isn't anything dirty, nor is it necessarily copyrighted... I mean, it's a photo still from a movie I like that I wanted to use as my avatar photo. So I suppose technically it's copyrighted, but I'm not trying to pass it off as really being me, or mine. I see people using that kind of thing for avs all the time.
    I guess what I'm trying to say is that I'm not worried about the image I'm using, I'm worried about other users on the site being able to somehow find out that the image was uploaded from my computer (IP address, location, etc)
    Like, could the admins at a social networking site see that the image was uploaded from my computer?
    When I prompt the "upload" it only gives me the option to directly upload it from my computer, and as I said in my OP, it comes up with my iMac computer ID or whatever as the source of the file. (In the upload bar). Once I upload it, I think this information disappears, as I've tried to inspect other users avatars and it says owner info is private... but can the admins see WHERE the photo was uploaded from?
    Does something like TOR block this? Or do I need something else? I tried to do some research on it and found another user asking a similar question and someone responded saying they needed to tunnel it or something?
    Again, I'm not asking this b/c I'm trying to upload some inapropriate photo, but because this site is very strict about multiple accounts, and I have another account there that I'm not ready to delete yet. I just want to have a second, 100% anonymous account. (and feel I should also put it out there that it's not to do anything illegal or harmful to anyone either) just for me.
    Thanks again for any more answers on this.

  • JSP : latest  JSTL, File Upload from web form Client to Server Question!

    I understand that within a JSP, It is possible to read a file from the Client by opening a Stream somehow.
    How do I code, within jsp/servlet (non tag) java code inside <% %>
    blocks, WITHOUT openening a new connection to the URL, an InputStream from a client web browser form, from a file upload coded using
    <input type="file" name="file1"/> ?
    I have previously achieved this quite simply with a FileInputStream
    with the previous version of JSTL.
    How may I do this with the latest version of JSTL, with this index.jsp?
    -with a simple text file.
    -with a Binary file (with DataInputStream)?
    <%--
    Document : index
    Created on : 27/01/2009, 3:08:32 PM
    Author : Zachary Mitchell
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h1 align="center">Hello World!</h1>
    <form name="form1" method ="POST" >
    <table align="center">
    <tr>
    <td>
    <input name="file1" type="file" align="center"></input>
    </td>
    </tr>
    <tr>
    <td>
    <input type="submit" value="submit" action="index.jsp" ></input>
    </td>
    </tr>
    </table>
    </form>
    <!--*********************************************************************** -->
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <%@page import = "java.io.*" %>
    <c:if test="${pageContext.request.method=='POST'}">
    <%
    File fileName = new File(request.getParameter("file1"));
    out.println(fileName.toString());
    FileInputStream stream = new FileInputStream(fileName);
    out.println(stream.toString());
    %>
    </c:if>
    <!--*********************************************************************** -->
    </body>
    </html>

    If I have:
    <!-- ***********************************************************************************-->
    <form name="form1" method="POST" enctype="multipart/form-data">
    <input name="file1" type="file"/>
    <input name="submit1" type="submit" value="Submit" action="index.jsp"/>
    </form>
    <!-- ***********************************************************************************-->
    and run this in an index.jsp, use browse to select my text file, and click SUBMIT.
    I can use:
    InputStreamReader reader = new InputStreamReader(new DataInputStream(request.getInputStream()))
    BufferedReader bufferedReader = new BufferedReader(reader);
    bufferedReader.readLine();...
    However, these is some HTML/POST related content around what multiple readLine();
    calls return.
    Is there an easy way, like using "${param.file1}",
    aside from [http://commons.apache.org/fileupload/|http://commons.apache.org/fileupload/],
    maybe using servlet style code, to get the File contents from a remote Client,
    to the remote Server servlet engine, AVOIDING ANY SUPERFLUOUS CONTENT,
    using version 1.12 of the JSTL, JSP 2.0,Tomcat 6?
    Just politely, yes, no, and how?
    Edited by: Zac1234 on Jan 29, 2009 3:27 AM
    Edited by: Zac1234 on Feb 1, 2009 8:29 PM

  • File upload & download through web Dynpro

    Hai All,
         Now i am working in webDynpro 2.0.9. For file upload
    and download through webdynpro "resource" is used.But in my webdynpro version 2.0.9. "resource" is not possible.so tell me how to upload & download by using this version & what is the alternative way for this.
    Thanks in advance.
    Kindly Regards,
    s.v.selva bala

    HI,
    Try out this code :
    FileInputStream is = new FileInputStream(file);
          long length = file.length();
          byte[] bytes = new byte[(int)length];
          long bytesRead = is.read(bytes);
          if (bytesRead < length)
           throw new IOException("Could not completely read file "+file.getName());
          is.close();
    element.setDocumentContent(bytes);
    Create a context attribute of binary type and assign the read data to it and bind the dataSource property of your File Upload and Download properties to this context Attribute.
    Regards
    Sid

  • File Upload/Download buttons in Table UI

    Dear Experts,
    I want to give file upload and download buttons in the columns of the Table UI element. I'm not able to achieve upload file with browse functionality on the click and Download file with ws_execute functionality.
    If anybody can throw some light, it would be of great help.
    I'm sort of a intermediate level developer in WD for ABAP.
    Regds,
    Aryan.

    Hi Aryan,
    In order to get the download functionality. Create an button in the Table toolbar and put the below coding into it. You need to basically do the following tasks:
    1) First read the table's data into an internal table.
    2) Convert the internal table data to STRING format.
    3) Now convert it into tab delimited format.
    4) Convert this STRING format to XSTRING format
    5) Make use of the attach_file_to_response method.
    Regards,
    Uday
    You can also go through this [link|http://****************/Tutorials/WebDynproABAP/Export/toexcel.htm] for a similar example.
    METHOD onactionon_submit .
      DATA: lv_node TYPE REF TO if_wd_context_node,
            lt_mara TYPE if_main=>elements_mara,
            wa_mara TYPE if_main=>element_mara,
            lead_selection_index TYPE i,
            mara_string  TYPE string,
            mara_xstring TYPE xstring.
      lv_node = wd_context->get_child_node( name = 'MARA' ).
      CALL METHOD lv_node->get_static_attributes_table
        IMPORTING
          table = lt_mara.
      LOOP AT lt_mara INTO wa_mara.
        CONCATENATE mara_string
                    wa_mara-matnr
                    wa_mara-ersda
                    wa_mara-ernam
                    wa_mara-matkl
                    wa_mara-meins
                    cl_abap_char_utilities=>newline INTO mara_string
                                            SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      ENDLOOP.
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = mara_string
        IMPORTING
          buffer = mara_xstring.
      wdr_task=>client_window->client->attach_file_to_response(  i_filename  = 'TEMP.DOC'
                                                                 i_content   = mara_xstring
                                                                 i_mime_type = 'WORD' ).
    ENDMETHOD.
    The above is the code to export the Internal Table to Word Document. You can proceed as shown below for Excel & NOTEPAD formats.
    To Export the Internal Table to Text File:
    WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
        I_FILENAME    = 'WDP.txt'
        I_CONTENT     =  mara_xstring
        I_MIME_TYPE   = 'NOTEPAD' ).
    To Export the Internal Table to Excel File:
    WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
        I_FILENAME    = 'Excel.xls'
        I_CONTENT     =  mara_xstring
        I_MIME_TYPE   = 'EXCEL' ).

  • Program to upload/download to MSP client?

    Hi,
    Is there any standard program that would upload/download projects from cProjects 4.0  to MS Project client?
    Regards,
    Remya

    Hi Remya,
    There are no programs for serving this purpose. However, you can try the import/export feature provided as a standard functionality in cProjects application.
    For importing/exporting files in bulk, you would need to write an ABAP Program.
    Regards,
    Vivek Pandey.

  • File Upload/Download Problem

    Hi,
    I have a fileupload button. The attributes type is XSTRING, which i bound it with "data" property of download.
    When i download this file with "download" element, it comes in a zip file and as XML files. Only the jpg files are downloaded correctly.
    How can i solve this?
    Thanks.

    Hi,
    I am so sory for my very late answer.
    If you want to upload/download files, you should have a node which includes attributes
    (attribute names are just example ):
    1) filename(type: for example afilename),
    2)mimetype (type : string),
    3) file(type : a data element with type 'RAWSTRING').
    You must match your fileupload element's attributes with them:
    "DATA" attribute --> file ,
    "fileNAME" attribute--> filename,
    "mimeTYPE" attritube -->mimetype.
    When you want to download this file, you should put a filedownload element and match this element's attributes with the node's attributes which i described above.

  • File uploading / downloading

    hello all,
    can any one explain me about file uploading and downloading.
    how the FM's GUI_UPLOAD and DOWNLOAD works,
    also why we do not use the FM's WS_UPLOAD
    if any material regarding this plz mail me at [email protected]
    thanks for help in advance.
    vikas

    Hi vikas,
    there  r 3 function modules for downloading the data from internal(dictionary)
    tables into the files in application server.
    1.DOWNLOAD
    2.WS_DOWNLOAD
    3.GUI_DOWNLOAD
    just hv a look on the following code.
    TABLES: VBAK,VBAP.
    DATA: BEGIN OF I_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          ERDAT LIKE VBAK-ERDAT,
          ERNAM LIKE VBAK-ERNAM,
          AUDAT LIKE VBAK-AUDAT,
          VBTYP LIKE VBAK-VBTYP,
          END OF I_VBAK.
    DATA: BEGIN OF I_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          MATNR LIKE VBAP-MATNR,
          CHARG LIKE VBAP-CHARG,
          MATKL LIKE VBAP-MATKL,
          END OF I_VBAP.
    DATA: BEGIN OF IT_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          ERDAT LIKE VBAK-ERDAT,
          ERNAM LIKE VBAK-ERNAM,
          AUDAT LIKE VBAK-AUDAT,
          VBTYP LIKE VBAK-VBTYP,
          POSNR LIKE VBAP-POSNR,
          MATNR LIKE VBAP-MATNR,
          CHARG LIKE VBAP-CHARG,
          MATKL LIKE VBAP-MATKL,
          END OF IT_VBAK.
    SELECT VBELN ERDAT ERNAM AUDAT VBTYP FROM VBAK INTO TABLE I_VBAK.
    SELECT VBELN POSNR MATNR CHARG MATKL FROM VBAP INTO TABLE I_VBAP.
    SORT: I_VBAK BY VBELN,I_VBAP BY VBELN.
    LOOP AT I_VBAK.
    READ TABLE I_VBAP WITH KEY VBELN = I_VBAK-VBELN BINARY SEARCH.
    IF SY-SUBRC = 0.
      MOVE I_VBAK-VBELN TO IT_VBAK-VBELN.
      MOVE I_VBAK-ERDAT TO IT_VBAK-ERDAT.
      MOVE I_VBAK-ERNAM TO IT_VBAK-ERNAM.
      MOVE I_VBAK-AUDAT TO IT_VBAK-AUDAT.
      MOVE I_VBAK-VBTYP TO IT_VBAK-VBTYP.
      MOVE I_VBAP-POSNR TO IT_VBAK-POSNR.
      MOVE I_VBAP-MATNR TO IT_VBAK-MATNR.
      MOVE I_VBAP-CHARG TO IT_VBAK-CHARG.
      MOVE I_VBAP-MATKL TO IT_VBAK-MATKL.
    APPEND IT_VBAK.
    ENDIF.
    ENDLOOP.
    *& IT ASKS THE CONFIRMATION FOR THE FILE FORMATE,WE CAN CHANGE THE FILENAME DYNAMICALLY(e.g DOC-TXT,XLS)
    *CALL FUNCTION 'DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = 'D:\C1.TXT'
      FILETYPE                      = 'DAT'   "ASC is also another format
      ITEM                          = ' '
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      FILEMASK_MASK                 = '.TXT'
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = 'X'
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = 'X'     "THIS WILL NOT SHOW THE FILE TYPE(DAT) WHILE CONFIRMATION OF FILE NAME
      SILENT                        = 'S'
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
      FILESIZE                      =
      CANCEL                        =
    TABLES
       DATA_TAB                      = IT_VBAK
      FIELDNAMES                    =
    EXCEPTIONS
      INVALID_FILESIZE              = 1
      INVALID_TABLE_WIDTH           = 2
      INVALID_TYPE                  = 3
      NO_BATCH                      = 4
      UNKNOWN_ERROR                 = 5
      GUI_REFUSE_FILETRANSFER       = 6
      OTHERS                        = 7
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    *& this will not ask for the confirmation for the filename
    *CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = 'D:\C2.DOC'
      FILETYPE                      = 'DAT'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
    TABLES
       DATA_TAB                      = IT_VBAK
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'D:\C5.DOC'
       FILETYPE                        = 'ASC'  "Separate Columns by Tabs in Case of ASCII Download
      APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = 'X' "Overwrite The File Only After
                        Confirmation                          
      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
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = IT_VBAK
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if u need any help abt this one,i welcome u to clarify them.
    reward points,if it is useful.

  • File Upload/Download, updating to SAP

    Hi All:
    Has anyone implemented the file upload functionality?
    Could you please share the details.... Iam successfully passing the file name from WD but get short dump with
    "   Termination occurred in the ABAP program "SAPLCNDP" - in
         "DP_CONTROL_ASSIGN_TABLE".
        The main program was "SAPMSSY1 ".
        In the source code you have the termination point in line 1
        of the (Include) program "LCNDPU10"".
    Iam using  "cl_gui_frontend_services=>gui_upload " to upload to SAP.
    Thanks in advance.

    Look at this blog. It may help you:
    <a href="/people/raja.thangamani/blog/2007/11/12/how-to-create-attachments-in-business-transaction-from-webdynprojava attachments in SAP</a>
    <a href="/people/raja.thangamani/blog/2007/11/29/displaydelete-attachment-from-business-transactions-using-webdynpro-java attachment from SAP</a>
    Raja T

Maybe you are looking for

  • How do I sync old devices to a new iMac without our old iTunes library? Our orig iMac died with the library on it.

    Our old iMac died and we got a new one. The problem is that our entire iTunes library was on the old iMac and all of our iPads and iPhones were synced to the old dead iMac. How do we sync the devices to the new iMac now?

  • Glitches Convertng AVCHD using Log and Transfer

    Hi, I'm converting a large batch of AVCHD to ProRes 422 using log and transfer for a project. I've converted almost all the footage, but have had to break down some longer clips because FCP7 won't convert the whole clip, it starts to act wonky. There

  • How/is it possible to export OE from old PC to my new system

    Newbie, need help to solve this problem. I used OE when working on Pc. Virgin Media is the provider, my husband is the Account holder. I depend from this acc. and I did also created an account with a different identity which connected me with a Yahoo

  • Require official Oracle Best Practices about PSU patches

    A customer complained about the following Your company statements are not clear... On your web page - http://www.oracle.com/security/critical-patch-update.html The following is stated! Critical Patch Update Fixes for security vulnerabilities are rele

  • Running totals

    Post Author: neils CA Forum: Formula Hi, I have built a crosstab in Crystal XI with the following columns: PROFILED BUDGET (a)                            EXPENDITURE TO DATE (b)                        VARIANCE (a-b) The profiled budget and expenditur