Seeks algorithms for downloading file from WWW

I have a big question for how many different ways for me to download file from WWW.
Can someone list those methods and the "Java offical" classes/libraries that needed?
Also which is the BEST and most EFFICIENCY?
Here are some methods:
1a. Download from html [bytes by bytes]
- Create a connection to the url (use Url)
- While not EOF
- Read the file (use BufferedReader)
- Write to another file (use BufferedWriter)
- Close all connection
1b. Download from html [line by line]
- Create a connection to the url (use Url)
- While not EOF
- Read the file line by line (use BufferedReader)
- Write to another file (use FileWriter)
- Close all connection
Can someone tell me which class I can use to monitor the connection? (i.e. the file size, connection speed, time required, size downloaded, etc)
Can someone tell me how I can compress the data before downloading it from the web just like those download managers?
Can someone tell me how I can divide the file as those download managers do?
Thx

I have a big question for how many different ways for
me to download file from WWW.
Can someone list those methods and the "Java offical"
classes/libraries that needed? Most of your questions are answered in the Custom Networking tutorial, in particular this page here:
http://java.sun.com/docs/books/tutorial/networking/urls/readingURL.html
Also which is the BEST and most EFFICIENCY?It depends on a lot of things, particularly on the speed of your network connection.
Can someone tell me which class I can use to monitor
the connection? (i.e. the file size, connection speed,
time required, size downloaded, etc)There's a tutorial about input and output there too.
Can someone tell me how I can compress the data before
downloading it from the web just like those download
managers?You can't do anything to the file before it gets to your side of the connection. You must be mistaken about the capabilities of those download managers.
Can someone tell me how I can divide the file as those
download managers do?Not me.

Similar Messages

  • Tcode for downloading file from BW server

    hi
    can nay tell me what is the T-CODE  to download file from BW server to my PC.
    REMOVED
    regards
    sampath

    There isn't a transaction.
    You can see the example report to execute ftp on BW server.
    server to server
    or
    client to server.
    the reports are named like:
    rsftp001
    rsftp002
    rsftp011
    Regards,
    Sergio

  • Script for downloading files from pdf placed on web, script for printing for exchange-

    Looking for java script command to set on button in pdf. We have mp3 and pdfs on our web site, example of URL: http://www.uzlicek.cz/download/Pohadky/O_holcicce_ktera_si_prala_byt_dospela.mp3
    By clicking on button/link in reader I would like to appear a dialog box with offer to Safe file as…
    Any suggestion? In case of using “link tool” the file starts downloading to cache and this is not the objective. In case of using “sound tool”, the file does not appear for saving.
    For exchange the script for Print the current page:
       var n = this.pageNum;
        var pp = this.getPrintParams();
        //pp.pageSubset = pp.subsets.all;
        //pp.printContent = pp.constants.printContent.doc;
        pp.firstPage = n;
        pp.lastPage = n;
        this.print(pp);
    Cheers Martin

    It can't be done using only a PDF file - any link to a URL will simply open your web browser, and whatever handler that browser uses when presented with MP3 files will be triggered (download, play, etc.) - nothing in the PDF can override that handler and force a "save" operation.
    Instead you'll need to configure your website to force downloads (using HTTP headers) and link to those URLs instead; which is a subject outside this forum.

  • Download files from web to client

    Hi,
    I am trying to download txt file from the web and save it on the client using webutil_file_transfer.url_to_client. I am experiencing some problem which is connected to web util and says: The WEBUTIL object group is not available in this Form. WEBUTIL can not work.WebUtil error: oracle.forms.webutil.filetransfer.filetransfer.
    Can somebodey suggest what is the problem or any other solution for downloading files from url and saving them on the client?

    OK guys, i have done everything and web util finally (probably) works fine because i don't receive any error messages. Despite this i still cant download the file on the client machine.
    ps. I don't receive any error message
    here is the sample code , so you can try it if you want and suggest something
    DECLARE
    flag BOOLEAN;
    BEGIN
    flag :=
    webutil_file_transfer.url_to_client
    ('http://igor.pandurski.googlepages.com/CIIT-Molika-2007-WebServicesforInsur.pdf',
    'C:\1\'
    IF flag
    THEN
    MESSAGE ('DONE');
    MESSAGE ('DONE');
    ELSE
    MESSAGE ('NOT DONE');
    MESSAGE ('NOT DONE');
    END IF;
    END;

  • I am having issues today with my Adobe Lightroom 5.6 today that was working fine yesterday except for te files from one of my cameras showed up on import but wouldn't download, today I'm getting the message "Lightroom cannot start because it cannot create

    I am having issues today with my Adobe Lightroom 5.6 today that was working fine yesterday except for te files from one of my cameras showed up on import but wouldn't download, today I'm getting the message "Lightroom cannot start because it cannot create files in the temporary file location  /var/folders/jv/2bct456j0yg4ys681fxk9zq00000gn/T " don't know what has happended in 24 hrs except I did check my permissions on my main directory to ensure that I had extended permissions to all the folders contained within my main drive on my IMac running OSX 10.10

    Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
    This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps.

  • Can't download file from any browser and download manager

    i confused wit my MBP, becaus MBP can't download file from internet ( via USB modem & Wi-fi)..
    can you help me to fix it ??
    i use iGetter, and it not responding to download, safari too..

    I was able to download the trial from rarlab.com. What happens when you click on a download? You need to make sure you select to download the Mac version. The .exe files do not run on a Mac.
    BTW, you might want to check out GUI Tar  https://www.macupdate.com/app/mac/14503/gui-tar
    The other two sites also work for me. What exactly happens when you click on a link to download? Do you know how to find your downloads?
    How to download YouTube videos using Safari or Firefox
    6 Different Ways to Download Videos from YouTube to your Mac

  • Downloading files from DVD or hard drive cameras

    Is it possible to download files from hard drive or dvd cameras to be used in Premiere without using the capture function which needs to be done in real time?

    Importing files from a DVD camcorder or other MPEG device, or Ripping DVD files rarely results in success in Premiere... do not be fooled by movie industry advertising into thinking that "DVD Quality Video" is suitable for EDITING... it is not... a DVD is designed to be for PLAYBACK only... and that includes trying to edit a Standard Def MPEG file!
    Go to my notes page http://www.pacifier.com/~jtsmith/ADOBE.HTM
    Click the internal link for editing compressed files... read
    There are other products better suited to your task... but if you only have DVD type files, you should convert to DV AVI
    The only SD files that Premiere likes are DV AVI type 2

  • Cannot download files from certain websites: log-in prompt

    Hi, I am for some reason getting a log-in prompt when clicking on downloadable files from certain websites (pdf files, etc.). It is especially strange because it is happening on multiple sites, which gave me no problem downloading in the past. This is particular to my computer, and it is happening in different locations, so it can't be a problem with my isp or something.
    I am getting this prompt:
    "To view this page, you need to log in to area "PAGE TITLE" on "www.address.com:80"
    Your password will be sent in the clear."
    (Where PAGE TITLE and address.com are specific to the page I'm trying to access)
    I've tried giving a username and password, but it didn't work. I tried emptying my cache and deleting cookies, renewing my ip address, to no avail. I do not use any proxies, so I am really confused now.
    I've found no documentation of anyone else having this issue.
    Any help would be appreciated!

    i figured it out... it was just a strange coincidence, nothing wrong after all.

  • How to download files from the internet via SAP PI

    Hi,
    is it possible to download files from a certain URL from the internet via SAP PI? Which adapter has to be used?
    Thanks in advance
    Dominic

    Hi nosebear,
    this is a piece of JAVA-code to read a URL. This works also for XML-files.
    You can use this in adater-module, JAVA-Mapping or UDF
    Regards Mario
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    public class testhttp {
    * @param args
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try {
    System.setProperty("https.proxyHost", "10.xxx.1.80");
    System.setProperty("https.proxyPort", "8000");
    System.setProperty("http.proxyHost", "proxy");
    System.setProperty("http.proxyPort", "8000");
    URL url = new URL("http://www.openbc.com/ <http://www.openbc.com/> ");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.connect();
    System.out.println(conn.getResponseCode());
    InputStream stream = conn.getInputStream();
    int b;
    while ((b = stream.read()) != -1) {
    System.out.print((char) b);
    } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }//catch
    Edited by: Mario Müller on Jul 31, 2008 4:58 AM

  • Download file from the web

    Hey,
    I'm struggling to download files from the web.
    The first approach I though of was simply opening the url in Safari, but it would just open the file, not download it.
    Then there is an application called "URL Access Scripting", but I can't figure out how it works.
    That might sound stupid, since it has only a download and an upload command, but they do not work.
    The download function asks for a file specification, what the #$^& is that?
    I tried supplying a file, but to no avail.
    For obvious reasons I can't make an alias of a not yet existing file, so what do I put in there?
    It seems file specification is a deprecated format.
    My last resort was running curl in a shell script, which works, but that feels hackish.
    Is there any good way to do this?

    Hi pepsel,
    Let's take an example. Suppose that you want to download “UltiCalc Mac 2.5” (freeware) from [this Web page|http://www.apple.com/downloads/macosx/games/utilities/ulticalcmac.html]. You can proceed as follows:
    --BEGINNING OF SCRIPT
    set theURL to "http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=23023&cat=25&platf orm=osx&method=sa/ulticalc_mac.zip"
    set theFile to "/Users/pierre/Desktop/My_download.zip" -- same extension as the file to download
    tell application "URL Access Scripting" to download theURL to theFile
    --END OF SCRIPT
    Of course, you should replace “pierre” with the name of your own home folder.
    Hope it can help.
    Message was edited by: Pierre L.

  • T-code for delete file from application server

    Hi all!
    Please, has any t-code for delete file from application server? For upload exist CG3Z, for download has CG3Y. And for delete? Has anyone?
    I need to delete file from application server in QA system and i don't want to create a program for this because i will need to transport a request from DEV to QA.

    I don't have contact with basis team.
    The FM EPS_DELETE_FILE support directory name with max 60 char. My dir. has more than that. I need a transaction for this.
    Anybody know if this transaction exist?

  • [HELP] Download file from FTP server

    hi,
    I want to write a java program that can download and upload files from ftp server. Currently I only manage to upload a file to ftp server but i cant download file from ftp server. Here is the source code that only allow user to upload file. Anyone can give me some guidelines so that my program can download and also upload file? thx.
    import java.io.*;
    import java.net.*;
    public class FTPUpload {
    private static final int CTRLPORT = 21;
    private static Socket ctrlSocket;
    private static PrintWriter ctrlOutput;
    private static BufferedReader ctrlInput;
    private static byte[] localHostAddress;
    public final static String DIR = "C:\\zip\\";
    public static void main(String[] args) {
    try {
    String host = "192.168.1.1";
    String loginName = "testuser";
    String password = "password";
    String dirName = "/home/testuser";
    String fileName = "hello.zip";
    ctrlSocket = new Socket(host, CTRLPORT);
    localHostAddress = ctrlSocket.getLocalAddress().getAddress();
    ctrlOutput = new PrintWriter(ctrlSocket.getOutputStream());
    ctrlInput = new BufferedReader(new InputStreamReader(ctrlSocket.getInputStream()));
    ctrlOutput.println("USER " + loginName);
    ctrlOutput.flush();
    ctrlOutput.println("PASS " + password);
    ctrlOutput.flush();
    ctrlOutput.println("CWD " + dirName);
    ctrlOutput.flush();
    ctrlOutput.println("TYPE I");
    ctrlOutput.flush();
    FileInputStream fis = new FileInputStream(DIR + fileName);
    Socket dataSocket = dataConnection("STOR " + fileName);
    OutputStream outstr = dataSocket.getOutputStream();
    int n;
    byte[] buff = new byte[1024];
    while ((n = fis.read(buff)) > 0) {
    outstr.write(buff,0,n);
    dataSocket.close();
    fis.close();
    ctrlOutput.close();
    ctrlInput.close();
    ctrlSocket.close();
    }catch (Exception e) {
    e.printStackTrace();
    private static Socket dataConnection(String ctrlcmd)
    throws IOException,UnknownHostException {
    String cmd = "PORT ";
    ServerSocket serverDataSocket = new ServerSocket(0,1);
    for (int i=0;i<4;i++) {
    cmd = cmd + (localHostAddress[i] & 0xff) + ",";
    cmd = cmd + (((serverDataSocket.getLocalPort())/256) & 0xff)
    + ","
    + (serverDataSocket.getLocalPort() & 0xff);
    ctrlOutput.println(cmd);
    ctrlOutput.flush();
    ctrlOutput.println(ctrlcmd);
    ctrlOutput.flush();
    Socket dataSocket = serverDataSocket.accept();
    serverDataSocket.close();
    return dataSocket;
    }

    Or just use a java.net.URL("ftp://...) ..., get its input stream, and away you go ...

  • Uploading and downloading files from a web app (Urgent!!)

    Hi everyone:
    I'm developing an application in PL/SQL to upload and download files from an HTML webpage. I congured the document table and the parameters necessary in the DAD of my application.
    when I upload the file using my webpage that file info is automatically uploaded to the doc table. This is as far as I have gotten.
    I need to do the following:
    - Place the uploaded file into a column in another table in my database as part of a text message (think of it as an email message), and delete the file from the doc table (as this is thought to be a temp table that holds the file when uploaded from my webpage)
    - Retreive the file so that it can be downloaded from another web page.
    The file can be a PDF, WORD DOC, etc...
    I now that I can do this with InterMedia but I haven't figured out how :(
    Can anyone please point me to an example or some documentation that can guide me through the process.
    DB VERSION: 8.1.7
    IAS VERSION: 1.0.2.2
    Thanks,
    Carlos Abarca

    The idea was for you to look at the code and get an idea of how to access the BLOB in the document table. IF you look at the procedure
    insert_new_photo( new_description IN VARCHAR2,
    new_location IN VARCHAR,
    new_photo IN VARCHAR2 )
    It shows how to access the blob that is stored in the document table. You can then copy this blob to your own table using the DBMS_LOB package.
    Hope this helps,
    Larry

  • How to download files from Application Server of Unix o.s to local director

    Hi All,
    I am trying to download files from Apllication server of Unix operating Systems to local file in excel sheet format using a z-program.but whenever I am trying to use OPEN dataset ........
    it is showing sy-subrc = 8.
    Can I have any clew please.
    Thanks in advance,
    Regards,
    AMEER.

    Hi Sreekanth,
    Thanks a lot for quick reply.I have to download that files from z-program only. I am giving you my code below.
    *& Report  ZTRAK_DOWNLOAD                                         *
    REPORT  ZTRAK_DOWNLOAD  MESSAGE-ID ZCT                   .
    SELECTION-SCREEN BEGIN OF BLOCK DOWNLOAD WITH FRAME TITLE TEXT1.
      PARAMETERS :
           SERDIR LIKE RLGRAP-FILENAME DEFAULT '/usr/trak',
           LOCDIR LIKE RLGRAP-FILENAME DEFAULT 'C:\Trak'.
    SELECTION-SCREEN END OF BLOCK DOWNLOAD .
    SELECTION-SCREEN BEGIN OF BLOCK INFO2 WITH FRAME.
           SELECTION-SCREEN COMMENT 1(79) TEXT2.
           SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT3.
    SELECTION-SCREEN END OF BLOCK INFO2 .
    SELECTION-SCREEN BEGIN OF BLOCK INFO3 WITH FRAME.
           SELECTION-SCREEN COMMENT 1(79) TEXT4.
           SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT5.
            SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT6.
           SELECTION-SCREEN SKIP 1.
           SELECTION-SCREEN COMMENT 1(79) TEXT7.
           SELECTION-SCREEN SKIP 2.
           SELECTION-SCREEN COMMENT 1(79) TEXT8.
    SELECTION-SCREEN SKIP 1.
           SELECTION-SCREEN COMMENT 1(79) TEXT9.
    SELECTION-SCREEN END OF BLOCK INFO3.
    *- Internal Table to output data in Excel
    DATA: BEGIN OF tab_excel OCCURS 0,
            col1(50),
            col2(132),
            col3(255),
            col4(100),
            col5(100),
            col6(50),
            COL7(60),
            col8(30),
            col9(30),
            col10(30),
            col11(20),
            col12(15),
            col13(15),
          END OF tab_excel.
    DATA: FILE LIKE RLGRAP-FILENAME .
    DATA: W_DATASET(80).
    INITIALIZATION.
      TEXT1  = 'Download Reports'.
      TEXT2 = 'The Program downloads the reports generated by Trak'.
      TEXT3 = 'Utility from Server to Local PC.'.
      TEXT4 = 'Check the following before executing the Program.'.
      TEXT5 = '     1. A valid Server path is provided.'.
      TEXT6 = '     2. A valid Local PC path is provided.'.
      TEXT7 = '     3. Local PC has 10 MB free space.'.
      TEXT8 = 'The report can be executed in the forground.'.
    TEXT9 =
    'The report should be executed after execution of Transaction TRAK'.
    AT SELECTION-SCREEN.
    IF SERDIR EQ ''.
    MESSAGE E001(ZCT).
    ENDIF.
    IF LOCDIR EQ ''.
    MESSAGE E002(ZCT).
    ENDIF.
    START-OF-SELECTION.
    Download ABAP Development Summary Report
    FILE =  '\ABAP_Report_Developments.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/ABAP_Report_Developments.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download BDC Development Report
    FILE =  '\BDC_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/BDC_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Development Summary Report
    FILE = '\Developments_Summary_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Developments_Summary_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Enhancement Development Report
    FILE =  '\Enhancement_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Enhancement_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download field exit Development Report
    FILE =  '\Field_Exit_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Field_Exit_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Frequency & Purpose Report
    FILE =  '\Frequency_And_Purpose_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Frequency_And_Purpose_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Function Group Developments Report
    FILE =  '\FunctionGroup_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionGroup_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Function Module Developments Report
    FILE = '\FunctionModule_Developments_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionModule_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Include Developments Report
    FILE =  '\Include_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Include_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download UserGroup Developments Report
    FILE =  '\UserGroup_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/UserGroup_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Modified_Standard_SAP_Objects_Report
    FILE = '\Modified_Standard_SAP_Objects_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Modified_Standard_SAP_Objects_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Include Developments Report
    *FILE =  '\Include_Developments_Report.XLS'.
    *CONCATENATE LOCDIR FILE INTO FILE.
    *W_DATASET = '/Include_Developments_Report.dat'.
    *CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    *PERFORM INIT.
    Download SAP Script Developments Report
    FILE =  '\SAP_Scipt_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/SAP_Scipt_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Transaction Developments Report
    FILE =  '\Transaction_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Transaction_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download User Exits Developments Report
    FILE =  '\UserExits_Reports.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/UserExits_Reports.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download ABAP Query Developments Report
    FILE =  '\ABAPQuery_Developments_Reports.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/ABAPQuery_Developments_Reports.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Functional Area Developments Report
    FILE =  '\FunctionalArea_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionalArea_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    MESSAGE S003(ZCT) WITH LOCDIR.
    END-OF-SELECTION.
    This routine checks whether file exists if yes downloads it to
    the Local PC
    FORM INIT.
    OPEN DATASET W_DATASET FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    DO.
       IF SY-SUBRC <> 0.
          EXIT.
       ENDIF.
       READ DATASET W_DATASET INTO  tab_excel.
       APPEND tab_excel.
       CLEAR tab_excel.
    ENDDO.
         PERFORM DOWNLOAD_FILE.
    ENDFORM.
    This routine downloads the data in an XL format on local PC
    FORM Download_File .
      CALL FUNCTION 'WS_DOWNLOAD'
                EXPORTING
                     FILENAME                = FILE
                     FILETYPE                = 'DAT'
                TABLES
                     DATA_TAB                = tab_excel
                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
                     OTHERS                  = 10.
        IF sy-subrc <> 0.
         message ''.       " Error in file transfer
        ELSE.
          CLEAR TAB_EXCEL.
          REFRESH TAB_EXCEL.
          FILE = ''.
          W_DATASET = ''.
        ENDIF.
    ENDFORM.
    I have created those files in Application Server running in another z-program in background mode.Then I am trying to download those files using above the program.I am creating those trak/Trak files manually and I can able to see those files in A.S level.But when downloading the same files I am facing the problem.
    regards,
    Ameer

  • How to download file from application server

    Hi Experts,
                  I developed report and execute in background mode. for this i used Open dataset transfer and close dataset . i got the requried output . But in this case user want downloaded file on presentation server so can anyone tell me How to download file from application server?
    i know it is possible through Tcode CG3Y. but i want code in program.

    This code will download a file to your Client package by package, so it will also work for huge files.
    *& Report  ZBI_DOWNLOAD_APPSERVER_FILE
    REPORT  zbi_download_appserver_file.
    PARAMETERS: lv_as_fn TYPE sapb-sappfad
    DEFAULT '/usr/sap/WBP/DVEBMGS00/work/ZBSPL_R01.CSV'.
    PARAMETERS: lv_cl_fn TYPE string
    DEFAULT 'C:\Users\atsvioli\Desktop\Budget Backups\ZBSPL_R01.CSV'.
    START-OF-SELECTION.
      CONSTANTS blocksize TYPE i VALUE 524287.
      CONSTANTS packagesize TYPE i VALUE 8.
      TYPES ty_datablock(blocksize) TYPE x.
      DATA lv_fil TYPE epsf-epsfilnam.
      DATA lv_dir TYPE epsf-epsdirnam.
      DATA ls_data TYPE ty_datablock.
      DATA lt_data TYPE STANDARD TABLE OF ty_datablock.
      DATA lv_block_len TYPE i.
      DATA lv_package_len TYPE i.
      DATA lv_subrc TYPE sy-subrc.
      DATA lv_msgv1 LIKE sy-msgv1.
      DATA lv_processed_so_far TYPE p.
      DATA lv_append TYPE c.
      DATA lv_status TYPE string.
      DATA lv_filesize TYPE p.
      DATA lv_percent TYPE i.
      "Determine size
      SPLIT lv_as_fn AT '/' INTO lv_dir lv_fil.
      CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
        EXPORTING
          file_name      = lv_fil
          dir_name       = lv_dir
        IMPORTING
          file_size_long = lv_filesize.
      "Open the file on application server
      OPEN DATASET lv_as_fn FOR INPUT IN BINARY MODE MESSAGE lv_msgv1.
      IF sy-subrc <> 0.
        MESSAGE e048(cms) WITH lv_as_fn lv_msgv1 RAISING file_read_error.
        EXIT.
      ENDIF.
      lv_processed_so_far = 0.
      DO.
        REFRESH lt_data.
        lv_package_len = 0.
        DO packagesize TIMES.
          CLEAR ls_data.
          CLEAR lv_block_len.
          READ DATASET lv_as_fn INTO ls_data MAXIMUM LENGTH blocksize LENGTH lv_block_len.
          lv_subrc = sy-subrc.
          IF lv_block_len > 0.
            lv_package_len = lv_package_len + lv_block_len.
            APPEND ls_data TO lt_data.
          ENDIF.
          "End of file
          IF lv_subrc <> 0.
            EXIT.
          ENDIF.
        ENDDO.
        IF lv_package_len > 0.
          "Put file to client
          IF lv_processed_so_far = 0.
            lv_append = ' '.
          ELSE.
            lv_append = 'X'.
          ENDIF.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize         = lv_package_len
              filename             = lv_cl_fn
              filetype             = 'BIN'
              append               = lv_append
              show_transfer_status = abap_false
            TABLES
              data_tab             = lt_data.
          lv_processed_so_far = lv_processed_so_far + lv_package_len.
          "Status display
          lv_percent = lv_processed_so_far * 100 / lv_filesize.
          lv_status = |{ lv_percent }% - { lv_processed_so_far } bytes downloaded of { lv_filesize }|.
          CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
            EXPORTING          "percentage = lv_percent - will make it fash
              text = lv_status.
        ENDIF.
        "End of file
        IF lv_subrc <> 0.
          EXIT.
        ENDIF.
      ENDDO.
      "Close the file on application server
      CLOSE DATASET lv_as_fn.

Maybe you are looking for

  • Setting input fields to an empty string BIG PROBLEM

    Hi Rob, thanks for your rerply, It makes sense alright, but I am using 2 seperate input fields. I have discovered what is causing the problem . After the user types into the inputfield and moves on to a different frame, I have set the input field to

  • Connecting Zen touch to Stereo sys

    I was wondering if there is a cord or some way to connect my touch to a stereo and play the music through the stereo? thanks, much appreciated.

  • Options 0 to 7(olap variable) in infopackage Scheduler screen

    Hi Pioneers, I've seen 0 to 7 options in the selection Tabpage of Infopackage scheduler screen(option TYPE beside a date selection). 0(Yesterday),1(last week),2(last month)....6(Abap code),7(Olap variable).Could any one please let me know what do the

  • Setting column values based on LOV selection

    Hi All, I am using JDeveloper 11.1.2.2.0. I have a table eg: Department table, in Dept Id, I have defined LOV for that field. My requirement is, based on the LOV selection, I want to set the other column values. I am using InputTextwithLOV in list ty

  • USING THE CHARACTER SET SCANNER

    How can I find and download the Character Set Scanner utility mentioned in MetaLink document # 66320.1. Thanks Pratap