Pls Help about counting the lines of the file in java

private int GrepPBArequestLog(String STRexpression) throws IOException
int totalnum = 0;
try {
String[] cmd = {"grep", "-ic", STRexpression, src};
System.out.println("grep, cmd " STRexpression" "+src);
Process grepProc = Runtime.getRuntime().exec(cmd);
String line = "";
BufferedReader br = new BufferedReader(new InputStreamReader(grepProc.getInputStream()));
line = br.readLine();
System.out.println("read: "+line);
while (line != null)
System.out.println("Line: "+line);
line = line.substring(line.indexOf(":") + 1, line.length());
System.out.println("Substring: "+line);
try
int temp = Integer.parseInt(line);
totalnum = totalnum + temp;
catch(NumberFormatException e)
System.out.println("String: "+line);
System.out.println("NumberFormatException Occured"+e.getMessage());
}//end while
the output is:
service No: 209
Wapdate: 07/Jul/2003
Went inside: GrepPBArequestLog
grep cmd .*07/Jul/2003.*GET.*209.* /var/log/httpd/access_log*
Line:
read: null
totalnum: 0
wap 07/Jul/2003:
wap 209:
total hits 209: 0
+++++++++++++++++++++++++++++++++
the read: should not be null because there is a number of lines and
totalnum shouldn't be 0.

You don't want to simply:
import java.io.*;
public class CountEm {
  private static BufferedReader br;
  private static int count;
  private static String fileName, record;
  public static void main(String[] argv) {
    switch(argv.length) {
      case 1:  { fileName = argv[0]; break; }
      default: { System.out.println("Usage: java CountEm [filename]"); System.exit(-1); }
    try { countEm(); }
    catch(IOException ioe) { System.out.println("ERROR doing countEm()\n"+ioe); }
    finally { System.out.println("Count: "+count); }
  public static void countEm()  throws IOException {
    br = new BufferedReader(new FileReader(fileName));
    while ( ( record = br.readLine() ) != null ) { count++; }
}~Bill

Similar Messages

  • My iMac 27 heats up to 57' c,  pls help to fix the issue

    My iMac 27 heats up to 57' c,  pls help to fix the issue

    Safari freezing means that you may be searching sites with old codings.Try those site on opera or firefox.
    UPdate your computer if necessary.
    Heavy image site too freeze safari.
    "Empty cache" from safari menu regularly and "reset safari" twice a week.
    See if this solve your problem.

  • F4 help to select the file

    Could any one tell the FM for F4 help to select the file from application server.

    Hi,
    Try this one..
    REPORT  ZTESTAPPL.
    data: t_filetab type table of SALFLDIR with header line,
    t_spopli type table of spopli with header line.
    parameters p_dir like SALFILE-LONGNAME default 'D:\SAPWORKING'.
    call function 'RZL_READ_DIR_LOCAL'
    exporting
    name = p_dir
    tables
    file_tbl = t_filetab
    EXCEPTIONS
    ARGUMENT_ERROR = 1
    NOT_FOUND = 2
    OTHERS = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    loop at t_filetab.
    if t_filetab-size ne space.
    t_spopli-varoption = t_filetab-name.
    append t_spopli.
    clear t_spopli.
    endif.
    endloop.
    call function 'POPUP_TO_DECIDE_LIST'
    exporting
    CURSORLINE = 1
    MARK_FLAG = 'X'
    MARK_MAX = 25
    START_COL = 0
    START_ROW = 0
    textline1 = 'Choose Files'
    TEXTLINE2 = ' '
    TEXTLINE3 = ' '
    titel = 'File Selection'
    DISPLAY_ONLY = ' '
    IMPORTING
    ANSWER =
    tables
    t_spopli = t_spopli
    EXCEPTIONS
    NOT_ENOUGH_ANSWERS = 1
    TOO_MUCH_ANSWERS = 2
    TOO_MUCH_MARKS = 3
    OTHERS = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    loop at t_spopli.
    if t_spopli-selflag ne ' '.
    write :/ 'Selected File: ' , t_spopli-varoption.
    endif.
    reward points if helpful

  • Code for reading the and placing the file using java webservice

    Hi All,
    Can anybody can guide me on how to read a file and place the file using java.
    Let  me know if any code is available which has been completed using java.
    Regards,
    Rahul

    Hi,
    The "square" symbol that you are referring to is probably a CRLF (Carriage Return - Life Feed) Control Character.
    This is more commonly known as a "Enter" at the end of a line / sentence.
    To clean this character from strings in Java, please use:
    String patternStr = "(?m)$^|[\\r\\n]+\\z";
    String replaceStr = " ";
    Pattern pattern = Pattern.compile(patternStr);
    Matcher matcher = pattern.matcher(inputStr);
    return matcher.replaceAll(replaceStr);
    Hope that helps.
    Thanks.
    p256960.

  • How to create a table in the file using java code.?

    HI,
    I should export the data from the view objects to a word document. I have done that but I should
    display the data in the form of a table.
    Kindly come up with the necessary information on how to create a table in the file using java.
    Thanks,
    Phani

    Hi, Thank you for responding to my query.
    The below are the details of my code.
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding StudentDetailsContent =
    (DCIteratorBinding)dcBindings.get("StudentView1Iterator");
    OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
    Row currentRow =
    StudentDetailsContent.getRowSetIterator().first();
    Object a[]= currentRow.getAttributeValues();
    int i;
    for(i=0 ;i<=a.length;i++){
    w.write(a.toString());
    w.write(" ");
    w.flush();
    I am usning this coding to achieve the task of exporting data to file.
    I need to display this information in the table that is where I need help from you people.
    Thanks,

  • Read lines from text file to java prog

    how can I read lines from input file to java prog ?
    I need to read from input text file, line after line
    10x !

    If you search in THIS forum with e.g. read lines from file, you will find answers like this one:
    Hi ! This is the answer for your query. This program prints as the output itself reading line by line.......
    import java.io.*;
    public class readfromfile
    public static void main(String a[])
    if you search in THIS forum, with e.g. read lines from text file
    try{
    BufferedReader br = new BufferedReader(new FileReader(new File("readfromfile.java")));
    while(br.readLine() != null)
    System.out.println(" line read :"+br.readLine());
    }catch(Exception e)
    e.printStackTrace();
    }

  • Pls, help. How the bidder licenses are considered?

    Hi,
    I'd like to know if someone have experience or documentation about how the bidder licenses are counted in SRM.
    I mean in one customer are worried about they want to invite a lot of vendors to participate in several bid invitations, they argue that they are going to work with the winners, offering other services but they would prefer don't consume a license in bidder they aren't going to work with. So they would prefer lock them.
    Would this bidders be counted in the number of licenses?
    Someone know where I can get information about this matter. I know that finally they have to speak with the account manager but I suppose that what kind of licenses and how we can distinguish them should be accesible for us.
    Thx

    Hi
    <b>Please go through this -></b>
    Bidding Engine comprises normal bidding and live auction. They are a part of SRM and you don't require separate license for that. In term of licences, Bidding Engine is priced separately as an engine.
    But in term of solution, it is already there & available in the system:
    - one transaction for the purchaser
    - one transaction for the supplie
    - Live Auction Java part
    There is nothing special related to licence to be activated in SRM to use Bidding Engine.
    <u>Related link -></u>
    Re: CCM 2.0 Vs SRM-MDM Catalog?
    Re: How to find Bidding engine installed.....???
    Re: Bidding Engine Licence
    <u>Hope this will help. Do let me know.</u>
    Regards
    - Atul

  • Pls help putting together the BEST SOLUTION for PP and AE CS4

    Hi guys
    I was tasked to put together the best machine (machines) for video editing / rendering .. money is not an issue.
    My client is a TV broadcasting network and they do lots of videos everyday .. They want to render their work as FAST as possible because sometimes they have tight deadlines and rendering and re rendering (if there are mistakes) has cost them .. so now they're serious about getting the best technology to achieve best rendering time possible, but in a bit of practical sense of course.. i mean there's no sense spending 1000USD or more for a piece of technology that offers under 10 second faster rendering only ..
    What they do and want
    - edit/put together/ sequence lots of videos constantly, under premiere cs3 (will upgrade to cs4 on the new machine)
    - use affter effects for some effects and 3D stuffs.. but not that much.. but increasingly as time goes by and their video editors get more affter effects training..
    - needs really really fast rendering!! Right now it takes them typically 1-2 hours to render stuffs, and what to cut this time by half or more..
    Existing Setups on work stations:
    Intel QuadCore (Q6600, i7, Q9550, Xeon x3220, and the likes)
    4GB RAM DDR2 1066mhz
    Highend motherboards
    GeForce 9500GT , 9800GT, and GTX 260 216sp
    GSKILL Falcon 64GB SSD Drive as primary
    1TB Western Digital BLACK edition drives for storage
    Software:
    Windows XP 32 bit
    Adobe Premiere Pro CS3 (80% of all their work done here)
    AE CS3
    etc..
    Running NOD32 Antivirus
    I am an somewhat of an expert in Hardware and stuff, i build custom PC's machines most of my life but i have limiited knowledge on optimizing hardware for VIDEO EDITING stuffs.. so i turn to you all.
    I do understand that w/ video editing CPU is the most important, followed by RAM, and ofcourse by HDD for disc caches and stuff.. and where videocard may come to an advantage as well. and normally i'd suggest the fastest components available . i7 , extreme processors, skulltrail dual quad setups perhaps? RAID 0 SSD Drive? etc.. but I do not know w/c gives the most advantage, and w/c is a waste of money..
    I also read about quadro cards offering really big performance improvements using CUDA tech etc..
    again im not the expert at this type of requirment.. so i need your advises..
    with unlimitted PRACTICAL budget given to me to come up w/ a solution I initially thought a rendering farm would be the solution, but upon reading around it seems there's no rendering farm solution for PP CS4.. just the adobe after effects part.. so i had to go back to the drawing board and suggest really powerful work stations instead..and perhaps have them migrate to 64bit OS for that "extra" performance.. i myself am on win7 64bit and it's looking mighty good.
    1) is this the right move?
    2) is it still worth it to put together rendering farm for AE renders only? or might as well concentrate funds on the machines/workstations?
    Also along the PRACTICALITY LINE, would it be practical to maintain all the existing machines, and instead build a manned RENDERING MACHINE w/ PP and AE (basically desktop or Server if they are faster at rendering w/ the best specs for the purpose etc) where they can just throw the workload to some guy there for rendering? Atleast the editors can continue using the workstations while the rendering machine guy is at work? and even perhaps setup a gigabit lan network where the RENDERING MACHINES can dynamically pull the work load via the network , not needing to transfer the files to the rendering machine first ? etc
    as you can see im not only looking for the best machine, but the best STRATEGY for my client.
    Good suggestions would be much appreciated.
    regards to all

    in a nut shell no. if you do not have to "Share" then Avid is pointless Adobe is a far better answer.
    Avid solutions still need a computer. The Mojo.Nitris are a joke and Avid no longer provides computers even the Symphany comes with your choice of Apple Mac Pro or HP 800. (Dual Xeon)
    there are better "hardware" answers that what Avid sells for Adobe. Decklink, Aja to name a few.
    if you have to share then you have no choice. this is the one area Abode does not lead.
    renders have to do primarily with 2 things CPU power (Xeon will render faster than single i7)
    and Drives. the faster your drive set up the faster the render. Memory does play a part and so does the video card depending on what codec and to what
    it also depends on WHAT you are rendering and from what for the HDDs.
    without knowing your work flow format and codec its impossible to suggest something.
    in terms of rendering
    Core i7
    Dual Xeon (faster unless still doing DV/HDV thru firewire)
    Sonnet raid array
    Scott
    ADK

  • Pls help me with the issue(pls )

    Hi Experts!
    Please help me with the issue.
    I need to transfer data from .net system to sap system for
    a customised tcode.
    The whole process Should be automated .
    I researched on this topic, and it seems ALE IDOC ,BAPI OR RFC can be used.
    But i really dnt know how to move forward with this issue.
    Regards
    Jaya

    Hi,
    Thanks for the reply.
    The problem is That i m going to do ale idoc for the first time and moreover I need to upload the excel file using customised tcode zcs15.
    The screen of zcs15 consists of 2 fields.
    One is for the name and other one is for uploading excel file.
    Can u pls guide me.
    Will reward u for sure.
    Regards
    Jaya

  • HT4060 my i pad show the charging green light .it works properly .however it was 37% battery charged and i tried to charge it .but it refused to charge .pls help .i had the same problem a while ago and then suddenly it charged on its on .pls help

    my i pad is not charging ,however it shows the green light and charging signs
    .before i had this problem, then it started charging on its own . now i was abroad it was 37% charged .was going to charge it for the journey and it stopped charging again .but it works excellent except for the charging .it still works but i am not using it now .just left it on the charger .the green light and the battery sign shows its charging ,but the i pad now is 35% the battery power .pls help .i cant aford another pad .i am broke and i am so much used to it

    It may just be giving you false battery info. Unless it actually dies prematurely, Its just a software error. I would recommend restoring. http://support.apple.com/kb/ht1414

  • Please help me with the error of Java related to UNIX

    Can you help me with my code?
    I wrote a Java program and ran it in gdb, the debugger said that :
    (gdb) run handhelditems 1 1000
    Starting program: /home/wqq/crawl/handhelditems/crawl_what_i_want handhelditems 1 1000
    [Thread debugging using libthread_db enabled]
    [New Thread -1208232256 (LWP 3796)]
    [New Thread -1210332272 (LWP 3799)]
    [New Thread -1220822128 (LWP 3800)]
    [New Thread -1231311984 (LWP 3801)]
    [New Thread -1243206768 (LWP 3802)]
    [New Thread -1253696624 (LWP 3803)]
    [New Thread -1264186480 (LWP 3804)]
    [New Thread -1274676336 (LWP 3805)]
    [New Thread -1285166192 (LWP 3806)]
    [New Thread -1295656048 (LWP 3807)]
    [New Thread -1306145904 (LWP 3808)]
    [New Thread -1316635760 (LWP 3809)]
    Program received signal SIGPWR, Power fail/restart.
    [Switching to Thread -1316635760 (LWP 3809)]
    0x00196402 in __kernel_vsyscall ()
    (gdb)
    the crawl_what_i_want.java is :
    public class crawl_what_i_want {
         public static void main(String[] args){
              if(args.length!=3){
                   System.out.println("Usage: java crawl_html [site name] [start at] [end at]");
              else
                   String v1 = args[0];
                   int v2 = Integer.parseInt(args[1]);
                   int v3 = Integer.parseInt(args[2]);
                   thread thread0 = new thread(v1,v2,v3,0);
                   thread thread1 = new thread(v1,v2,v3,1);
                   thread thread2 = new thread(v1,v2,v3,2);
                   thread thread3 = new thread(v1,v2,v3,3);
                   thread thread4 = new thread(v1,v2,v3,4);
                   thread thread5 = new thread(v1,v2,v3,5);
                   thread thread6 = new thread(v1,v2,v3,6);
                   thread thread7 = new thread(v1,v2,v3,7);
                   thread thread8 = new thread(v1,v2,v3,8);
                   thread thread9 = new thread(v1,v2,v3,9);
                   thread0.start();
                   thread1.start();
                   thread2.start();
                   thread3.start();
                   thread4.start();
                   thread5.start();
                   thread6.start();
                   thread7.start();
                   thread8.start();
                   thread9.start();
    the thread.java is :
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.net.*;
    public class thread extends Thread
         String site_n;
         int s_at;
         int e_at;
         int for_id;
         thread(String site_n,int s_at,int e_at,int for_id){
              this.site_n = site_n;
              this.s_at = s_at;
              this.e_at = e_at;
              this.for_id = for_id;
         public synchronized void run() {
              String site = site_n;
              int fornum = for_id;
              int start = s_at;
              int end = e_at;
              //String site_name = "http://www."+site+".com";
              ArrayList url_list = new ArrayList();
              ArrayList url_id_list = new ArrayList();
              try{
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
                   String getconn = "jdbc:mysql://localhost/url_set_"+site+"?user=xxxx&password=xxxx";
                   Connection conn = DriverManager.getConnection(getconn);
                   PreparedStatement stmt = conn.prepareStatement("");
                   ResultSet rs = null;
                   stmt = conn.prepareStatement("select url,url_id from urls where url_id>=? and url_id<=?");
                   stmt.setInt(1,start);
                   stmt.setInt(2,end);
                   rs = stmt.executeQuery();
                   while(rs.next())
                        url_id_list.add(rs.getString(2));
                        url_list.add(rs.getString(1));
                   if(rs!=null)
                        rs.close();
                   stmt.close();
                   conn.close();
              catch(Exception e){
                   e.printStackTrace();
              try{
                   InputStream in = null;
                   InputStreamReader rd = null;
                   BufferedReader br = null;
                   for(int i=fornum; i<url_list.size(); i=i+10){
                        String save_dir = "./" + String.valueOf(Integer.parseInt(url_id_list.get(i).toString())/10000) + "/" ;
                        try{
                             if(!(new File(save_dir).isDirectory()))
                                  new File(save_dir).mkdir();
                        catch(Exception exp){
                             exp.printStackTrace();
                        String html = "";
                        URL this_url = new URL(url_list.get(i).toString());
                    in = this_url.openConnection().getInputStream();
                    rd = new InputStreamReader(in);
                    br=new BufferedReader(rd);
                    String line = br.readLine();
                    int imgmark = 0 ;
                    while(line != null){
                        html += line + (char)13;
                        //  get image  //
                        if(line.indexOf("product image(s) bof")>0)
                             imgmark = 1;
                        if(line.indexOf("product image(s) eof")>0)
                             imgmark = 0;
                        if(imgmark == 1 && line.indexOf("img src")>=0)
                             int bofimg = line.indexOf("http://www.unix.com/images/");
                             int eofimg = line.indexOf("jpg\"")+3;
                             if(eofimg>bofimg){
                                   String imgURL = "http://www."+site+".com/" + line.substring(bofimg,eofimg);
                                   String imgdir = save_dir + url_id_list.get(i).toString() + ".jpg";
                                   getpic gp = new getpic();
                                   gp.crawlpic(imgURL,imgdir);
                        line = br.readLine();
                     br.close();
                     rd.close();
                     in.close();
                        if(html==null)
                             html = "";
                        if(html.length()>0){
                             String saveTo = save_dir+ url_id_list.get(i).toString() +".html";
                             try {
                                  new outPut(html, saveTo);
                             } catch (IOException e) {
                                  e.printStackTrace();
                             System.out.println((i+start) + ". Saved " + url_list.get(i) + " as " + (i+start) + ".html");
                        else
                             System.out.println((i+start) + ". failed at " + url_list.get(i));
                   if(br!=null)
                        br.close();
              }catch (Exception e){
                   e.printStackTrace();
    the outPut.java is :
    import java.io.*;
    public class outPut {
            public outPut(String content, String outPutFile)throws IOException{
                    FileWriter fl = null;
                    BufferedWriter bw = null;
                    try{
                            File f = new File(outPutFile);
                            if(!f.exists())
                                    f.createNewFile();
                            fl = new FileWriter(outPutFile);
                            bw = new BufferedWriter(fl);
                            bw.write(content);
                    finally{
                            if(bw!=null)
                                    bw.flush();
                            if(fl!=null)
                                    fl.flush();
                            if(bw!=null)
                                    bw.close();
                            if(fl!=null)
                                    fl.close();
    the getpic.java is
    import java.io.*;
    import java.net.*;
    public class getpic {
            public synchronized void crawlpic(String url, String savedir)throws Exception {
                InputStream in = null;
                InputStream inBuffer = null;
                OutputStream out = null;           
                try{
                    URL this_url = new URL(url);
                    in = this_url.openConnection().getInputStream();
                        inBuffer = new BufferedInputStream(in);
                        out = new FileOutputStream(savedir);
                        while(true){
                        int bytedata = inBuffer.read();
                        if(bytedata == -1)
                        break;
                        out.write(bytedata);
                finally{
                    if(out != null)
                            out.close();
                    if(inBuffer != null)
                            inBuffer.close();
                    if(in != null)
                            in.close();
    }above are all my code .
    On the other hand, the codes can be run at JDB, but it will lose some thread after run for some minute or seconds.

    Hi aarthi,
    SELECT can be used to fetch data only from database tables/views. in your case you used SELECT from an INTERNAL table,which is not allowed.
    SELECT  *
           FROM <DBTABLE NAME>
           INTO TABLE EXPORT_REC
           WHERE KEY = IMPORT_ PARAMETER AND   
           IMPORT_PARAM_DATE BETWEEN FROM_DATE AND TO_DATE.
    HERE Instead of <DBTABLE NAME>,you have to give your Database table,which stores these values.
    then your data will comes into EXPORT_REC.
    and remember to give EXPORT_REC in TABLES parameters of that FUNCTION MODULE and give associated Type for that.
    Regards
    Srikanth

  • About Setup the iText and java

    Hi !!
    I need to set up the iText BUT I try and try I still can not get it done.
    I post This topic hope that some one will help me .
    where should i put me jar file to ??
    where to set the classpath and what to set ??(Please give me example)
    Where should I put my java file if I using the Textpad to compile the java file ??
    where can i find more information about the iText ??(url)
    Please help me .

    The web site did not give much information about setup the iText.
    What i need is the step to setup the iText.
    Thanks....
    is there any forum about iText ??

  • About downloading the file

    hi
    i have this coding
    DATA : BEGIN OF ITAB OCCURS 0,
           MATNR LIKE MARA-MATNR,
           ERNAM LIKE MARA-ERNAM,
           END OF ITAB.
      DATA: v_file TYPE string.
    PARAMETER : P_FILE TYPE RLGRAP-FILENAME.
    SELECT MATNR ERNAM FROM MARA INTO TABLE ITAB.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    PERFORM UPLOAD.
    START-OF-SELECTION.
    V_FILE = P_FILE.
    PERFORM UPLOAD1.
    FORM UPLOAD.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
       FIELD_NAME          = 'P_FILE'
    IMPORTING
       FILE_NAME           = P_FILE
    ENDFORM.
    FORM UPLOAD1.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME           = 'V_FILE'
       DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
      FILENAME               =
      RC                     =
    EXCEPTIONS
      INV_WINSYS             = 1
      NO_BATCH               = 2
      SELECTION_CANCEL       = 3
      SELECTION_ERROR        = 4
      OTHERS                 = 5
    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 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = 'V_FILE'
       FILETYPE                      = 'DAT'
       MODE                          = 'A'
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB
      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.
    ENDFORM.
    in this coding i can download the itab , after the selecting the file from selectionscreen , it storing the itab in another file ,  WHY IT IS LIKE THAT
    PLS HELP ON THIS MATTER

    Hii..
    Jamshad...
    You have to Pass the FileName as Variable (So V_File should not be in Single Quotes)
    Check it Below : Changes are in BOLD....
    And one more thing Use GUI_DOWNLOAD instead of  WS_DOWNLOAD(which is obselete)
    FORM UPLOAD1.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    <b>DEF_FILENAME = V_FILE</b>
    DEF_PATH = ' '
    MASK = ' '
    MODE = ' '
    TITLE = ' '
    IMPORTING
    FILENAME =
    RC =
    EXCEPTIONS
    INV_WINSYS = 1
    NO_BATCH = 2
    SELECTION_CANCEL = 3
    SELECTION_ERROR = 4
    OTHERS = 5
    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 'WS_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = ' '
    CODEPAGE = ' '
    <b>FILENAME = V_FILE</b>
    FILETYPE = 'DAT'
    MODE = 'A'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    COL_SELECT = ' '
    COL_SELECTMASK = ' '
    NO_AUTH_CHECK = ' '
    IMPORTING
    FILELENGTH =
    TABLES
    DATA_TAB = ITAB
    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.
    ENDFORM.
    <b>Reward if Helpful</b>

  • Need help to zip the files? ? ? ?

    hello friends
    i am unable to zip the files in my directory by using this program
    import java.io.*;
    import java.util.zip.*;
    public class Zip {
    static final int BUFFER = 2048;
    public static void main (String argv[]) {
    try {
    BufferedInputStream origin = null;
    FileOutputStream dest = new
    FileOutputStream("c:\\zip\\myfigs.zip");
    ZipOutputStream out = new ZipOutputStream(new
    BufferedOutputStream(dest));
    //out.setMethod(ZipOutputStream.DEFLATED);
    byte data[] = new byte[BUFFER];
    // get a list of files from current directory
    File f = new File(".");
    String files[] = f.list();
    for (int i=0; i<files.length; i++) {
    System.out.println("Adding: "+files);
    FileInputStream fi = new
    FileInputStream(files[i]);
    origin = new
    BufferedInputStream(fi, BUFFER);
    ZipEntry entry = new ZipEntry(files[i]);
    out.putNextEntry(entry);
    int count;
    while((count = origin.read(data, 0,
    BUFFER)) != -1) {
    out.write(data, 0, count);
    origin.close();
    out.close();
    } catch(Exception e) {
    e.printStackTrace();
    but it is working fine for compress the files in the current directory
    but
    File f = new File("C:\\ramu");
    it shows the error like this
    C:\j2sdk1.4.2_09\bin>javac Zip.java
    C:\j2sdk1.4.2_09\bin>java Zip
    Adding: okh.txt
    java.io.FileNotFoundException: C:\ramu (Access is denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at Zip.main(Zip.java:21)
    can any body help to rectify this problem

    Don't cross-post!
    http://forum.java.sun.com/thread.jspa?threadID=5184841&tstart=0
    And use code tags already.
    The referenced thread already has advice for you (and no, we will not do it for you, you've already been given an example of how to do it, it is up to you to at least attempt it).

  • I am trying to send a photo in an email and the file is huge. I remember something about sending the file with less detail and therefore reducing the size.  How?

    I am trying to send a photo in an email and the file is huge.  I remember something about reducing the size of the file but of course can't remember how.

    Use a utility such as Graphic Converter to  change the image to a jpeg using options to reduce the size of the converted image.

Maybe you are looking for

  • MSS IAC reporting error?

    Hi, We created custom MSS role which has limited services from standard MSS role.  So we didn't want to make any change to the standard MSS role.  One of the service under custom MSS role is reporting we made it to point to reporting page(PCD as belo

  • Casio Brigade problems!!  Won't send/recieve text or voicemail; freezing up, can't delete inbox?

    I have had this Casio Brigade only about 2 months now; up until recently I was in love with it.   I'm hoping somebody has a suggestion here- I was on the phone with Verizon for an hour this afternoon to no avail, they're supposed to get back to me in

  • Converting forms central form to PDF

    How do I convert my forms central registration form I created in the software itself to a PDF format.  I have called tech support for forms central and they are never able to assist me or even understand me.  Today I was told they are not trained in

  • Event Receiver ItemAdded MS CRM 2011

    Hi, I'm playing with SharePoint 2010 and MS CRM 2011. I developed simple event receiver on the document library which fire on ItemAdded and ItemAdding. Event receiver fire when I create folder inside SharePoint UI document library and everything work

  • How to create table columns dynamically ?

    Hi All, I am working on an SSRS report that will show sales in the past 5 years. If the user selected to view sales of past 3 years he will only see 3 columns. so How can I create table columns dynamically at run time and how can I make sure that the