How to download a text file using classes

Hi Guys
I want to download a text file using classes.
Any idea how to do it ?
Thanks
Sameer

HI sameer,
   It is no different from using a Function module.
example:
  CALL METHOD cl_gui_frontend_services=>gui_download
    EXPORTING
      filename                  = w_fpath
    append                    = SPACE
      write_field_separator     = 'X'
    CHANGING
      data_tab                  = it_download
    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
      not_supported_by_gui      = 22
      error_no_gui              = 23
      OTHERS                    = 24
Regards,
ravi

Similar Messages

  • How to download a text file using jsp i

    I want to provide download facility in jsp page.
    if i have exe download is working . If I have a text / html file it is just displaying I want to make it download How to do it?
    regards
    subrahmanayma

    If you want to get an "Save as" dialogue, then you need to set the content-disposition in the header to "attachment". The default value is "inline".
    Best solution is to create kind of a FileServlet and let it stream the right file as a download to the client. You may find the downloadFile() snippets at the bottom of this article useful: http://balusc.xs4all.nl/srv/dev-jep-pdf.html Put it in a FileServlet and call it using for example .

  • How to read a text file using Java

    Guys,
    Good day!
    Please help me how to read a text file using Java and create/convert that text file into XML.
    Thanks and God Bless.
    Regards,
    I-Talk

         public void fileRead(){
                 File aFile =new File("myFile.txt");
             BufferedReader input = null;
             try {
               input = new BufferedReader( new FileReader(aFile) );
               String line = null;
               while (( line = input.readLine()) != null){
             catch (FileNotFoundException ex) {
               ex.printStackTrace();
             catch (IOException ex){
               ex.printStackTrace();
         }This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
    cheers
    Mohammed Jubaer Arif.

  • How to print a text file using Java

    How can I print a text file using Java without converting the output to an image format. Is there anyway I can send the characters in the text file as it is for a print job? I did get a listing doing this ... but that converted the text to an image format before printing....
    THanks,.

    Hi I had to write a print api from scratch, and I did not convert the output to image. Go and read up on the following code. I know there is a Tutorial on Sun about the differant sections of the snippet.
    private void printReport()
         Frame tempFrame = new Frame(getName());
         PrintJob printerJob = Toolkit.getDefaultToolkit().getPrintJob(tempFrame, "Liesltext", null);
         Graphics g = printerJob.getGraphics();
                    //I wrote the method below for calculations
         printBasics(g);
         g.dispose();
         printerJob.end();
    }This alone wont print it you have to do all the calculations in the printBasics method. And as I said I wrote this from scratch and all I did was research first the tutorial and the white papers
    Ciao

  • How to read a text file using adobe javascript

    Hi,
    I have a api application which adds toolbar to a adobe acrobat. i need to disable the toolbar according to expiry date, So i need to fetch the expiry datge from a text file from the specified location.
    I am using importTextData() function to get the textdata from text file using adobe javascript. When i call this function i am getting error "ReferenceError: importTextData() is not defined".
    I am using Adobe Acrobat 7.0 version.
    Can any one tell how to use the importTextData() function.
    Regards
    Shiva

    calling from javascript file which is placed in the below location.C:\\Program Files (x86)\\Adobe\\Acrobat 7.0\\Acrobat\\Javascripts
    Regards
    Shiva

  • How to Run a text files using UNIX

    Hi,
    I have 10 text files in my project my task is to load all the text files data into Relational Database so i can use sql*loader to load all the text files data into a Database.
    but the thing is another project i have 200 text files so i need to run these text files using UNIX script could anyone tell me how to load all the text files using UNIX
    Thank's
    Edited by: Lavanya on Sep 5, 2012 3:09 PM

    Lavanya,
    This question relates to shell scripting and in IMO it is not an oracle question.
    I have made some initial assumptions before my proposed solution.
    PLEASE note that this is untested, but can just guide you as a template for solving your problem.
    Assuming that you have properly set up the control file and mapped each and every table in it as per the file information which you have..
    Assuming the text file to be in the format of : ------ (as suggested by other posters earlier, this file holds instructions about the file and table mapping which shall be used by your sqlldr process.)
    tmp.txt:
    text_file_1-------------should goes to----customer_info_table
    text_file_2------------should goes to------customer_address_table
    text_file_3-----------should goes to-------customer_order_table
    while read line
    do
    SQLLDR CONTROL=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.ctl,
    LOG=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.log,
    BAD=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.bad,
    DATA=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.txt
    USERID=scott/tiger
    done <tmp.txtAll I am trying to run from the above shell script is : -- PLEASE TEST it if it matches your requirement.
    SQLLDR CONTROL=text_file_1.ctl, LOG=text_file_1.log, BAD=text_file_1.bad, DATA=text_file_1.txt USERID=scott/tiger
    SQLLDR CONTROL=text_file_2.ctl, LOG=text_file_2.log, BAD=text_file_2.bad, DATA=text_file_2.txt USERID=scott/tiger
    SQLLDR CONTROL=text_file_3.ctl, LOG=text_file_3.log, BAD=text_file_3.bad, DATA=text_file_3.txt USERID=scott/tigerRepeating my assumptions, I assume you have all those files required for SQLLDR process to run (ctl file, data file...)
    Cheers,
    Manik

  • How to read two text files using the Read from spreadsheet.vi and then plot it

    I need to read two text files using the read from spreadsheet function and then plot these files over time.
    The file with the .res extention is the RMS values (dt and df) and the second file contains the amplitude of a frequency spectrum.
    I really appreciate any help..thanks
    Attachments:
    RMS.txt ‏1 KB
    FREQUENCY.txt ‏1 KB

    From NI Example Finder:
    Write to Text File.vi
    Read from Text File.vi
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp

  • How to download a text file from the server

    hi everyone,
    can anyone tell me how to download and read a text file from the server and saved in into resource folder.
    with regards
    pallavi

    its really easy
    To read from server, use something like:
    HttpConnection connector = null;
    InputStream inp_stream = null;
    OutputStream out_stream = null;
    void CloseConnection()
         if(inp_stream!=null)inp_stream.close();
         inp_stream=null;
         if(out_stream!=null)out_stream.close();
         out_stream=null;
         connector.close();
         connector = null;
    public void getResponse(String URL,String params)
      try
         if(connector==null)connector = (HttpConnection)Connector.open(URL);//URL of your text file / php script
         connector.setRequestMethod(HttpConnection.POST);
         connector.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.1");
         connector.setRequestProperty("content-type", "application/x-www-form-urlencoded");
         //connector.setRequestProperty("charset","windows-1251");
         //*** If you need to send ("arg1=value&arg2=value") arguments to script use this:
         out_stream = connector.openOutputStream();
         byte postmsg[] = params.getBytes();
         out_stream.write(postmsg);
         int rc = connector.getResponseCode();//in any case here connection will be opened & closed
         if (rc != HttpConnection.HTTP_OK)
              CloseConnection();
              throw new IOException("HTTP response code: " + rc);
         inp_stream = connector.openInputStream();
         int pack_len = inp_stream.available();
         byte answ[]=new byte[pack_len];
         inp_stream.read(answ);
         CloseConnection();
         ProcAnswer(answ);//process received data
      catch(Exception ex)
         System.err.println("ERROR IN getResponse(): "+ex);
    } And you can read from resource file like
    public void loadFile(String filename)
        DataInputStream dis = new DataInputStream(getClass().getResourceAsStream("/"+filename));
        String str="";
        try
             while (true)
                ch = dis.read();//read character
                if(ch=='\r')continue;//if file made in windows
                if(ch=='\n' || ch==-1)//end of line or end of file
                    if(str.length()==0)continue;//if empty line
                    //do some thing with "str"
                    if(ch==-1)break;//it was last line
                    str="";//next line
                    continue;
                 str+=(char)ch;
           dis.close();
       catch (Exception e)
           System.err.println("ERROR in loadFile() " + e);
    }Welcome! =)
    Edited by: MorskoyZmey on Aug 14, 2008 3:40 AM

  • How to read any text files using file adapter as it is

    Hi,
    I need to build bpel process to read any text files as it is.I am file adapter and using opaque schema.But input file is coming as base64encoding format.But i need the input as it is.How can i do that.
    Is there any sample schema to read input text files as it is?

    in java embedding activity i need to remove all newlines from my input text file.During this process i am getting arryindexoutofbounds exception.Below is my code
    String input = (String)getVariableData("inputFileStr");
    Base64Decoder Decoder = new Base64Decoder();
    try
    String decoded = Base64Decoder.decode(input); --exception is coming at this line
    setVariableData("inputFileStr", decoded);
    decoded = decoded.replaceAll("\\n|\\r", "");
    byte[] outputBytes = decoded.getBytes();
    String reencoded = Base64Encoder.encode(outputBytes);
    setVariableData("outputFileStr", reencoded);
    catch(Exception uee)
    uee.printStackTrace();
    below is stack trace:
    09/02/26 08:10:33 java.lang.ArrayIndexOutOfBoundsException: -1
    09/02/26 08:10:33 at com.collaxa.common.util.Base64DecoderStream.decode(Base64DecoderStream.java:162)
    09/02/26 08:10:33 at com.collaxa.common.util.Base64DecoderStream.decode(Base64DecoderStream.java:143)
    09/02/26 08:10:33 at com.collaxa.common.util.Base64Decoder.decode(Base64Decoder.java:36)

  • How to open a text file using button click event

    hi, How can i open a text file in a textpad or notepad on the click event of a button.?
    Thanks
    Jay

    Pnt,
    this will not work LV 8.0.1 and LV 8.6 will give back error 193.
    Attached is a VI to use the ShellExecute WinAPI. The VI is LV 7.1.1.
    Message Edited by waldemar.hersacher on 10-09-2008 10:48 PM
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    ShellExecute.zip ‏27 KB

  • How to download lion installation files using windows

    Hi,
    I installing a SSD into my new Macbook Pro and need to download Lion so I can do a clean install.
    My problem is that I only have 1GB download limit at home so I would like to download at work. But work only has Windows based machines. Is there anyway to download it on a windows?
    The nearest Apple store is 2 hours drive away, and I cannot connect my Mac into the work network.
    Any suggestions?
    Thanks

    You didn't mention a redemption code.
    You can download it, on a Mac. Do you know someone with a wireless network and a large download limit?
    I would seriously be looking at updating your Internet Plan. A standard update of any OS (Not just the inital Lion download) will wipe out your allowance in one hit. If you want to keep your system up to date, you will find it almost impossible on 1GB of monthly download data. Even if you bought Snow Leopard and installed it, the updates would well outweigh your allowance.
    Cheers

  • How to download ANSI coding text file using function GUI_DOWNLOAD?

    Hi All,
      Is the coding page of the file created by funtion GUI_DOWNLOAD or WS_DOWNLOAD is ANSI or UTF-8? How to download a text file which's coding page is ANSI please?
    Is this correct?
    CALL function 'GUI_DOWNLOAD'
      exporting
      codepage = '4110'
    importing

    This Function Lodule will give the CODE PAGE VALUE
    SCP_CODEPAGE_BY_EXTERNAL_NAME ... You have to give type of tht ENcoding like ANSI ..etc
        call function 'GUI_DOWNLOAD'
          exporting
           filename                        = 'd:\customer_details.txt'
           filetype                        = 'ASC'
       CODEPAGE                        = code
          tables
            data_tab                        = t_customer_details
      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.
          write : / 'Upload Failed' , sy-subrc.
        else.
          write : / 'Upload Completed'.
        endif.
      endif.
    Reward if helpful...

  • How to call text file using Script in Data Integrator

    Dear All,
    Can any one assit me in how to call a text file using script with the help of Data Integrator.
    and one question ?
    M having 32 csv files i want to club thos 32 csv files into one table with the help of Data Integrator, can
    any one assist me.

    mary,
    since you knew the file name ,when clicked in name send to server,read the file and write to servlet outputstream.
    I think this would help you.
    If anything wrong in mycode ..forums will help you further
    BufferedInputStream bis=null;
    BufferedOutputStream bos=null;
    int bytesRead=0;
    byte buff[]=new byte[1024];
    File f=new File(test.txt);
    try{
         bis= new BufferedInputStream(new FileInputStream(f));
         bytesRead=bis.read(buff,0,buff.length);
         if(bytesRead!=-1){
              // create a BufferedOutputStream from ServletOutputStream
              bos=new BufferedInputStream(response.getOutputStream());
              do{
                   bos.write(buff,0,bytesRead);
              }while((bytesRead=bis.read(buff,0,buff.length))!=-1)
    }catch(Exception e){
         ////error handling
         }

  • Hi Freinds......How to Encrypt/Decrypt Text file in j2me

    Hello friendz.,,
    I m having problem with textfile exncryption decryption in j2me..
    Can abybode tell me how to encrypt/decrypt Text file using J2ME API's.......
    PLZ help me .......
    Thanx in advance
    regards,
    Parag

    http://www.mobilefish.com/developer/bouncycastle/bouncycastle.html
    http://www-128.ibm.com/developerworks/library/j-midpds.html

  • How to read some lines from a text file using java.

    hi,
    i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
    we only want to read the file upto the first Occurrence of "TEXT" string.
    How to do it ,,,
    Kinldy give the code
    Regards,
    Sagar
    this is the text file
    dfgjdjj
    sfjhjkd
    ghjkdg
    hjkdgh TEXT
    ikeyt
    ujt
    jk
    tyk TEXT
    rukl
    r

    Hendawy wrote:
    Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
    Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
    The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
    Edited by: sabre150 on Apr 29, 2009 2:13 PM

Maybe you are looking for

  • Short Dump while execuition of DTP.

    Hi, I got short dump while  execuiting the DTP. Error messages shows as below: 1.The database returned a value containing an error 2.An exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled locally, nor declared in a RAISING cla

  • Use of array in multiple formulas

    I need to set up a array that I will use in multiple formulas. Can I create it as a global or shared value in one formula, set the values of the array and then use that array in another formula.  I don't want to have to reset all the values in the ar

  • Printer issue - could not print multiple copies

    Hello Gurus, Good day! We not able to print multiple copies (2 or more) in SAP level but we were able to print multiples copies using non SAP applications (i.e word, excel). I already checked in UNIX level and I dont see any stuck spools. Can you ple

  • I can't open Face Recognition on Satellite L755-m1ku

    I just bought Satellite L755-m1ku i can't open Face Recognition ,i even tried to run it as administrator but it keep giving error " You don't have permission to perform this task. Please contact your administrator for help . waiting for your help !

  • Unable to install Quicktime and itunes

    Hi, I am getting beyond despair and desperate for help on this please (I have spent hours and hours and still no further forward). I am running XP with service pack 3 installed. Windows updates are up to date. When iTunes 9 first came out it wanted t