Questions about Using Vector To File And JTable

hi all
I want to write all data from Vector To File and read from file To Vector
And I want To show all data from vector to JTable
Note: I'm using the JBuilder Compiler
This is Class A that my datamember  And Methods in it
import java.io.*;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
public  class A implements Serializable {
  int no;
  String name;
  int age;
  public void setA (int n,String na,int a)
    no=n;
    name=na;
    age=a;
  public void set_no(int n)
    no = n;
  public void set_age(int a)
    age = a;
    public int getage ()
    return age;
  public void setName(String a)
    name  = a;
  public String getname ()
    return name;
  public int getno ()
    return no;
This is The Frame That the JTextFeild And JButtons & JTable in it
import java.awt.*;
import java.io.*;
import java.util.*;
import com.borland.jbcl.layout.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.table.*;
import javax.swing.border.*;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
public class Frame1 extends JFrame {
/* Vector v = new Vector ();
  public int i=0;*/
  A a = new A();
  XYLayout xYLayout1 = new XYLayout();
  JTextField txtno = new JTextField();
  JTextField txtname = new JTextField();
  JTextField txtage = new JTextField();
  JButton add = new JButton();
  JButton search = new JButton();
  /*JTable jTable1 = new JTable();
  TableModel tableModel1 = new MyTableModel(*/
            TableModel dataModel = new AbstractTableModel() {
          public int getColumnCount() { return 2; }
          public int getRowCount() { return 2;}
          public Object getValueAt(int row, int col) { return new A(); }
      JTable table = new JTable(dataModel);
      JScrollPane scrollpane = new JScrollPane(table);
  TitledBorder titledBorder1;
  TitledBorder titledBorder2;
  ObjectInputStream in;
  ObjectOutputStream out;
  JButton read = new JButton();
  public Frame1() {
    try {
      jbInit();
    catch(Exception e) {
      e.printStackTrace();
  private void jbInit() throws Exception {
    titledBorder1 = new TitledBorder(BorderFactory.createEmptyBorder(),"");
    titledBorder2 = new TitledBorder("");
    this.getContentPane().setLayout(xYLayout1);
    add.setBorder(BorderFactory.createRaisedBevelBorder());
    add.setNextFocusableComponent(txtno);
    add.setMnemonic('0');
    add.setText("Add");
    add.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        add_actionPerformed(e);
    add.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        add_actionPerformed(e);
    search.setFocusPainted(false);
    search.setText("Search");
    search.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        search_actionPerformed(e);
    xYLayout1.setWidth(411);
    xYLayout1.setHeight(350);
    read.setText("Read");
    read.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        read_actionPerformed(e);
    this.getContentPane().add(txtno, new XYConstraints(43, 35, 115, 23));
    this.getContentPane().add(txtname,  new XYConstraints(44, 67, 114, 22));
    this.getContentPane().add(txtage,      new XYConstraints(44, 97, 115, 23));
    this.getContentPane().add(add,      new XYConstraints(60, 184, 97, 26));
    this.getContentPane().add(search,  new XYConstraints(167, 185, 88, 24));
    this.getContentPane().add(table,   new XYConstraints(187, 24, 205, 119));
    this.getContentPane().add(read,   new XYConstraints(265, 185, 75, 24));
    this.setSize(450,250);
    table.setGridColor(new Color(0,0,255));
  void add_actionPerformed(ActionEvent e)
    a.set_no(Integer.parseInt(txtno.getText()));
    a.setName(txtname.getText());
    a.set_age(Integer.parseInt(txtage.getText()));
    fileOutput();
    txtno.setText(null);
    txtname.setText(null);
    txtage.setText(null);
    try
      out.writeObject(a);
      out.close();
    }catch (Exception excep){};
/*  try
       add.setDefaultCapable(true);
      v.addElement(new A());
     ((A)v.elementAt(i)).setA(Integer.parseInt(txtno.getText()),txtname.getText(),Integer.parseInt(txtage.getText()));
    JOptionPane.showMessageDialog(null,"The Record is Added");
    txtno.setText(null);
    txtname.setText(null);
    txtage.setText(null);
    i++;
  }catch (Exception excep){};*/
  void search_actionPerformed(ActionEvent e) {
    int n = Integer.parseInt(JOptionPane.showInputDialog("Enter No:"));
    for (int i=0;i<v.size();i++)
      if (((A)v.elementAt(i)).getno()==n)
        txtno.setText(Integer.toString(((A)v.elementAt(i)).getno()));
        txtname.setText(((A)v.elementAt(i)).getname() );
        txtage.setText(Integer.toString(((A)v.elementAt(i)).getage()));
  public void fileOutput()
    try
      out = new ObjectOutputStream(new FileOutputStream("c:\\UserData.txt",true));
    }catch(Exception excep){};
  public void fileInput()
    try
      in = new ObjectInputStream(new FileInputStream("c:\\UserData.txt"));
    }catch(Exception excep){};
  void read_actionPerformed(ActionEvent e) {
  fileInput();
    try
      a = (A)in.readObject();
      txtno.setText(Integer.toString(a.getno()));
      txtname.setText(a.getname());
      txtage.setText(Integer.toString(a.getage()));
    }catch (Exception excep){};
}

//program which copies string data between vector and file
import java.util.*;
import java.io.*;
class Util
private Vector v;
private FileReader filereader;
private FileWriter filewriter;
Util(String data[])throws Exception
  v=new Vector();
  for(String o:data)
    v.add(o);
public void listData()throws Exception
  int size=v.size();
  for(int i=0;i<size;i++)
   System.out.println(v.get(i));
public void copyToFile(String data,String fname)throws Exception
  filewriter =new FileWriter(fname);
  filewriter.write(data);
  filewriter.flush();
  System.out.println("Vector content copied into file..."+fname);
public void copyFromFile(String fname)throws Exception
  filereader=new FileReader(fname);
  char fcont[]=new char[(int)new File(fname).length()];
  filereader.read(fcont,0,fcont.length);
  String temp=new String(fcont); 
  String fdata[]=temp.substring(1,temp.length()-1).split(",");
  for(String s:fdata)
    v.add(s.trim()); 
  System.out.println("File content copied into Vector...");
public String getData()throws Exception
   return(v.toString());
class TestUtil
public static void main(String a[])throws Exception
  String arr[]={"siva","rama","krishna"};
  Util util=new Util(arr);
  System.out.println("before copy from file...");
  util.listData();
  String fname=System.getProperty("user.home")+"\\"+"vecdata";
  util.copyToFile(util.getData(),fname);
  util.copyFromFile(fname);
  System.out.println("after copy from file...");
  util.listData();
}

Similar Messages

  • I have a question about using adobe CS files in CS6 edition

    I am a graphic artist . I have a question about using adobe CS files in CS6 edition. when I am gonna open thse adobe CS created files in CS6 Edition i get a color variation than i made with the CS version.Please give me an idea about this issue as soon as possible.If you need i can upload my problem as a screenshot to clearity

    donrulz,
    Are your Edit>Color Settings the same?
    Are you using spot colours, such as Pantone (there have been some changes in CMYK values with new colour books)?

  • Question about reading a sequential file and using in an array

    I seem to be having some trouble reading data from a simple text file, and then calling that information to populate a text field. I think I have the reader class set up properly, but when a menu selection is made that calls for the data, I am not sure how to receive the data. Below is the reader class, and then the code from my last program that I need to modify to call on the reader class.
    public void getRates(){
              try{
                 ArrayList<String> InterestRates = new ArrayList<String>();
                 BufferedReader inputfile = new BufferedReader(new FileReader("rates.txt"));
                 String data;
                 while ((data = inputfile.readLine()) != null){
                 //System.out.println(data);
                 InterestRates.add(data);
                 rates = new double[InterestRates.size()];
                 for (int x = 0; x < rates.length; ++x){
                     rates[x] = Double.parseDouble(InterestRates.get(x));
           inputfile.close();
           catch(Exception ec)
    //here is the old code that I need to change
    //I need to modify the rateLbl.setText("" + rates[1]); to call from the reader class
    private void mnu15yrsActionPerformed(java.awt.event.ActionEvent evt) {
            termLbl.setText("" + iTerms[1]);
              rateLbl.setText("" + rates[1]);

    from the getRates function your InterestRates ArrayList is declared within that function, so it will not be accesible from outside of it, if you declare it outside then you can modify in the function and have it accessible from another function.
    private ArrayList<String> InterestRates = new ArrayList<String>();
    public void getRates(){
              try{
                 BufferedReader inputfile = new BufferedReader(new FileReader("rates.txt"));
                 String data;
                 while ((data = inputfile.readLine()) != null){
                 //System.out.println(data);
                 InterestRates.add(data);
                 rates = new double[InterestRates.size()];
                 for (int x = 0; x < rates.length; ++x){
                     rates[x] = Double.parseDouble(InterestRates.get(x));
           inputfile.close();
           catch(Exception ec)
         }

  • Question about using a shared file

    Please feel free to jerk my chain to the right fire hydrant, if I'm in the wrong spot for this question?
    Supposing I want to "share" an excel file located on my server with a work group, and I want to "Admin" cells (add a number, in order to perform a calculation within the spreadsheet) from a remote location via a hand held device with an internet connection, such as a routine inventory of stock. Is this feasable? Could I do this with an iPhone, or some other hand held device?

    Possible? maybe, but it's a lot of work.
    For one, the iPhone can open Excel documents, but it can't edit them. Some Windows Mobile-based devices may be able to but IMHO this is the wrong approach.
    Excel is great for single-user applications. It falls down when you want multiple people to maintain the data. For example - what happens when someone in the office is using the file and your mobile device (whatever that may be) opens the file to make changes? If it even lets you you're almost certainly going to corrupt the file since the office user won't notice the changes you make remotely.
    So for any kind of dynamic data a database-based approach would be better. Some databases include web-based front-ends (so anyone with a web browser can view/edit the data), others have support from multiple script languages such as Perl, PHP, Java, etc. that let you develop your own web front-end.
    For the users that are familiar with Excel, even Excel can pull data from a database to populate the worksheet.

  • Newbie question about using vectors and arrays

    I'm fairly new to JME development and java in general. I need some help in regards to Vectors and 1 dimensional arrays. I'm developing a blackberry midlet and am saving the queried info i pull back from my server side application with each record saved into the array and subsequently each array saved as an element in the vector, thereby creating a 2D "array".
    However I'm having a problem accessing the elements in the array. Here is a sample of what I mean and where I get stuck:
    Vector _dataTable = new Vector(1, 1);
    String[] r1 = {"a", "b", "c", "d"};
    String[] r2 = {"1", "2", "3", "4"};
    _dataTable.addElement(r1);
    _dataTable.addElement(r2);
    Object temp = _dataTable.elementAt(0); //Save the element as an new object for useNow how do I access the particular indexes of the element of the temp object? Do i need to caste it to an array? Is there another more efficient/easier way I should be storing my data? Any help would be great!
    Edited by: Sotnem2k1 on Apr 1, 2008 7:50 AM
    Edited by: Sotnem2k1 on Apr 1, 2008 7:51 AM

    Thanks for the feedback newark. I have this scenario below:
    // Class for my 1D array
    public class OneRecord {
        private String[] elementData = new String[4];
        public OneRecord() {   
            elementData[0] = null;
            elementData[1] = null;
            elementData[2] = null;
            elementData[3] = null;
        public OneRecord(String v1, String v2, String v3, String v4) {   
            elementData[0] = v1;
            elementData[1] = v2;
            elementData[2] = v3;
            elementData[3] = v4;
        public void setElement(int index, String Data) {
            elementData[index] = Data;
        public String getElement(int index) {
            return elementData[index];
    } Then in my main app I have:
    Vector _dataTable = new Vector(1, 1);
    OneRecord currRecord = new OneRecord("a", "b", "c", "d");
    _dataTable.addElement(currRecord);
    OneRecord temp = (OneRecord)_dataTable.elementAt(1);
    System.out.println(temp.getElement(0)); Are there more efficient data structures out there to save queried data from a server side app? Like I said, i'm still trying to learn the most efficient techniques of coding...esp for the Blackberry. Any suggestions would be great!

  • Questions about using skins in online and local help

    Caveat: I'm a very new RoboHelp users, somewhat self-taught, so my questions may be very rudamentary, but I can't quite find them in the (very meager) Adobe help.
    In a previous version of the Help (created by my predecessor), the local Help (.chm) looked like this, i.e., no skins:
    The online Help looked like this--i.e., it had the skin:
    First question: why doesn't the local help have the skin? Is this a setting?
    Second question: In a newer version of the help that I created, both versions of help look like the local Help above--no skins.  How do I make the skins display?
    Third question: We localized to French. When I open FR online Help and right-click a help topic (to open in a new tab) the page displays as below, with the "Montrer" standing in for what is "< Show Contents" in English (see below). This content is incorrect in French, and should be "Afficher le sommaire" ("Show Summary"). 
    Where do I find the source for this piece of content, so that I can correct it?  I've looked in the skins file, but didn't see anything that would qualify.

    Okay, so I read through the second bit you sent, Rick (after a few deep breathing exercises!) and understand that somehow, we need to change how the developer calls the URL ... yes?
    Oh, and the default file I select is the one that is automatically opened, yes?  So at least that's going right. 
    Inside your help, you have a few folders with topics inside each folder. So if you just issue the basic http://www.somesite.com URL, all you get is the default topic. But you want Topic13.htm which happens to be inside folder C. Now you could link directly as inhttp://www.somesite.com/Help/FolderC/Topic13.htm and that would present Topic13.htm but it would not have the frameset (skin) surrounding it. Instead, it would likely have a "Show" link. And when the user clicked the Show link, the full frameset would appear and Topic13.htm would then be loaded in the topic pane.
    To make this happen with a basic link, the URL would look like this:
    http://www.somesite.com/Help/Index.htm#Folder C/Topic13.htm
    And this refers to the remote help, not the local CHM, yes?
    Historically, I just give them the location of the files, i.e, they're at: http/onlinehelp.companysite.com/help/productname/version/language/mjwin_help.htm (which is the name we've been using, though I will someday want to change that as it references an older version of the brand ... but first things first). 
    I ran a test in which I  I generated and posted the files to the correct location on the server (and identified the default topic I wanted in the SSL).  I sent this exact URL to the developer to include in this morning's build.  According to what you have indicated, since I'm not asking the Help to do anything but open up to the default topic, I should get a) the default topic and b) the skins.
    I did not get this result. 
    Could there be something going on on the developer end?  I ask this because I had problems with Map IDs, which turned out to be that they weren't telling me that some UI elements called context-sensitive help and therefore those pages needed to be linked to the correct map ID. (Like me, some of the members of that department are new to their positions ...)
    Kasey (still tearing hair out ...)

  • Some questions about using non-english characters and keyboard layouts

    I've found a lot of guides about how to enable characters in Linux, and that is easy enough, but I want to understand it better.
    The way that I understand it, if you don't enable a given set of characters in locale.gen, then in theory you should not be able to either use or display a that set of characters in any programs (however, certain programs, like web-browsers seem to have work arounds).
    Furthermore, in order to be able to type characters in X programs, you need to enable those keyboard setups in your xorg.conf (in addition to enabling those locales in locale.gen).  I don't think that this effects the displaying of characters
    Then, Last, you need a way to switch back and forth between different keyboard layouts within your X environment in order to type those characters. There are programs to assist in switching keyboard layouts provided by some DE's.  By using these keyboard layout tools, I alter the behaviour of all programs started in X.  (for example, swithing keyboard layouts in gnome's settings will alter the behaviour of kde programs, firefox and openoffice.)
    How close am I?
    A few more questions:
    If I'm a Spanish student which locales do I need to enable.  There is a long list of locales that start with ES, and I don't know if there are any drawbacks to enabling unnecessary locales. I think that the ones that I need are es_ES* (Spanish spanish?) and es_MX* (Mexican spanish?).
    What is do the *@EURO locales do?
    what does the locale setting in rc.conf do?

    I've found a lot of guides about how to enable characters in Linux, and that is easy enough, but I want to understand it better.
    The way that I understand it, if you don't enable a given set of characters in locale.gen, then in theory you should not be able to either use or display a that set of characters in any programs (however, certain programs, like web-browsers seem to have work arounds).
    Furthermore, in order to be able to type characters in X programs, you need to enable those keyboard setups in your xorg.conf (in addition to enabling those locales in locale.gen).  I don't think that this effects the displaying of characters
    Then, Last, you need a way to switch back and forth between different keyboard layouts within your X environment in order to type those characters. There are programs to assist in switching keyboard layouts provided by some DE's.  By using these keyboard layout tools, I alter the behaviour of all programs started in X.  (for example, swithing keyboard layouts in gnome's settings will alter the behaviour of kde programs, firefox and openoffice.)
    How close am I?
    A few more questions:
    If I'm a Spanish student which locales do I need to enable.  There is a long list of locales that start with ES, and I don't know if there are any drawbacks to enabling unnecessary locales. I think that the ones that I need are es_ES* (Spanish spanish?) and es_MX* (Mexican spanish?).
    What is do the *@EURO locales do?
    what does the locale setting in rc.conf do?

  • A few questions about using an XML file to add text into a TextArea component set as html

    I'm using AS2 in Flash CS3.
    I have a TextArea component in the stage that's loading its text from an XML and I've been able to use the ul and li tags to create lists. However, when I try to include a nested list it just inserts a line break between the nested list and the main list rather than indent it further. Is there a solution for this issue?
    Failing that, how would I be able to add non-breaking spaces into the XML so they will render inside the TextArea component? I've tried   and &#160; without success. I scoured the net for some help with this and found some information about modifying the font embedding xml file with a new entry for the non-breaking space and that didn't work either, so that leaves me somewhat stumped.

    flash doesn't handle nested lists (as you now know).  you can work-around that limitation using css and creating your own indent styles.  css have a marginLeft property you can use.

  • I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher

    I have a question about using multiple ipads in our school.  Each of our teachers have a iPad and AppleTV in their classroom.  The issue is, with our classrooms so close in proximity to one another, is there a way to pair teacher #1 iPad to its AppleTV without effecting/projecting onto the adjacent teachers #2 classroom AppleTV?

    Not as such.
    Give the AppleTV units unique names and also enable Airplay password in settings with unique passwords for each teacher.
    AC

  • Question about using 10g/11g and APEX ...

    Hi,
    I just recently learned of Oracle's APEX and have a few questions about using it.
    Can I use APEX with express, standard, and enterprise editions of 10g and 11g?
    Are all of these free to use?

    You might want to read about APEX rather than jumping into questions that are reasonably well documented. Info at http://www.oracle.com/technology/products/database/application_express/index.html
    Your specific questions:
    1) Apex is a package that can be installed into any properly licensed database.
    2) The price for the production license of the database varies by edition.
    The price for Express Edition is $0 for use in production. Part of the cost for that edition is 'no Oracle Support based support, no patches, data volume limitation, etc.'

  • Here's a very basic question about 2 TB external drives and Time Machine.

    Here's a very basic question about 2 TB external drives and Time Machine.
    Ihave a Mac Pro with a .75 TB and 1 TB drive.  It also has a 1 TB 2ndinternal drive.  My current external drive is too small so I'll begetting a 1.5 TB or 2 TB drive.
    Obviouslythe new larger 2 TB drive will backup everything on the Mac Prointernal drive with Time Machine.  But there will be 1 TB of space leftover going to waste.
    ShouldI partition the external drive so that the TM portion will be 1 TB andthe use the remaining extra partition for additional file backups withCarbon Copy?
    Thanks for any insights.
    I tried searching around on the new Apple discussion forum, but I find it much harder to use than the old forum I used to use.

    The problem with terabyte drives is that that a 3 TB is about as big as you can get without going into RAID territory. Ideally, a Time Machine drive should be 3 times as large as all the drives you are backing up. So, if you have 2.75 TB of internal storage, you should have 8 TB of Time Machine space.
    Of course, that is "should". If your TB drives are mostly empty, then you can get away with something 3 times the size of your used disk space. Just remember that you are pushing it. Linc is right about Time Machine needing space to work.
    It is unlikely that you have regular churn on 2.75 TB of disk. I suggest identifying which drives and folders have the most activity and excluding those drives and directories that don't change much. It would be better to archive the data that doesn't change often and keep it out of Time Machine. Then you may be able to get away with a 2 TB Time Machine drive.

  • Question about 2 TB external drives and Time Machine.

    Here's a very basic question about 2 TB external drives and Time Machine.
    I have a Mac Pro with a .75 TB and 1 TB drive.  It also has a 1 TB 2nd internal drive.  My current external drive is too small so I'll be getting a 1.5 TB or 2 TB drive.
    Obviously the new larger 2 TB drive will backup everything on the Mac Pro internal drive with Time Machine.  But there will be 1 TB of space left over going to waste.
    Should I partition the external drive so that the TM portion will be 1 TB and the use the remaining extra partition for additional file backups with Carbon Copy?
    Thanks for any insights.
    I tried searching around on the new Apple discussion forum, but I find it much harder to use than the old forum I used to use.

    John,
    I'm not sure why you posted in the iMac forum so I'm going to attempt to get you to the correct spot. I would recommend reposting in the Time Machine Forum, this is part of the OS X forums (Leopard or Snow Leopard) because you are using Snow Leopard (your profile indicates you are) please click Apple Support Communities and type Snow Leopard. Then you can narrow the search down by clicking Refine this List.
    Roger

  • Hi, I have quick question about use of USEBEAN tag in SP2. When I specify a scope of SESSION for the java bean, it does not keep the values that I set for variable in the bean persistent.Thanks,Sonny

     

    Make sure that your bean is implementing the serializable interface and that
    you are accessing the bean from the session with the same name.
    Bryan
    "Sandeep Suri" <[email protected]> wrote in message
    news:[email protected]..
    Hi, I have quick question about use of USEBEAN tag in SP2. When I
    specify a scope of SESSION for the java bean, it does not keep the
    values that I set for variable in the bean persistent.Thanks,Sonny
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Question about using new battery in old Powerbook

    I have a pre-intel Powerbook G4, and the battery is pretty much toast (lasts about 15 minutes now). I have ordered a new battery for it, and I have this question about using it:
    Am I smarter to keep the new strong battery out of the PB most days (as I usually work with it plugged in at home) and just pop it in when I know I will be out surfing on batteries? Or is it just as good living in my laptop 24/7 and only occasionally being called upon to do its job?
    Current bad Battery Information below:
    Battery Installed: Yes
    First low level warning: No
    Full Charge Capacity (mAh): 1144
    Remaining Capacity (mAh): 1115
    Amperage (mA): 0
    Voltage (mV): 12387
    Cycle Count: 281
    thanks folks, Shereen

    Hi, Shereen. Every Powerbook battery wants to be used — drained and then recharged — at least every couple of weeks. If you've always used your Powerbook on AC power nearly all the time, and not followed that pattern of discharging and recharging the battery every week or two, it's possible that your use habits have shortened the lifespan and prematurely diminished the capacity of your old battery. Of course it's also possible that your battery is merely old, as a battery's capacity also diminishes with age regardless of how it's used. You didn't say how old the battery is in years, so this may or may not be an issue. I mention it only because it can be an issue.
    For general information on handling a battery for the longest possible lifespan, see this article. My advice on the basis of that article and long experience reading these forums is that it would be OK to do as you propose, but I doubt that you'd derive any significant benefit from it. You would still want to be sure of putting the new battery through a charge/discharge cycle every week or two, even if you didn't have a reason to use the Powerbook away from home or your desk, because sitting unused outside the computer is just as bad for a battery as sitting unused inside it. And you should never remove the battery from your computer when it's completely or almost completely discharged and let it sit that way any longer than a day or two.
    Message was edited by: eww

  • Question about using TVARV in an ABAP program

    Hello gurus, Im sorry about the silly question.
    I have a question about using TVARV in an ABAP program.
    A program is presenting a problem and I think that in this code:
    SELECT SIGN OPTI LOW HIGH
      FROM TVARV
      INTO TABLE R_1_163431035_VELOCIDADE
      WHERE  NAME = '1_163431035_VELOCIDADE'
      AND    TYPE = 'S'.
      IF ZMM001-VELOCIDADE_B   IN R_1_163431035_VELOCIDADE AND
          ZOPERADORAS-OPERADORA = 'ABCD' AND
          ZMM001-MATERIAL       IN R_1_163431035_PRODUTO.
      ELSE.
      ENDIF.
    What happens is that the value "ZMM001-SPEED" B not exist in "R1_163431035_VELOCIDADE" but the program executes commands under the IF and not under the ELSE, as I imagine it would work. Is this correct ?
    I am new to ABAP programming, but I have a lot of XP in other programming languages ​​and this makes no sense to me.
    Anyone know where I can find some documentation of the use of "TVARV" in ABAP programs?
    I search the Internet if other programmers use TVARV this way, but found nothing, which leads me to think that was a quick and dirty solution that used here.
    If this is a bad way to program, what would be the best way?
    Regards
    Ronaldo.

    Hi Ronaldo,
    But in this case, the range is not empty, there are 17 records, in this way.:
    For the column "SING" all values ​​are "E"
    It means that the result is false if ZMM001-VELOCIDADE_B has the same value as one of the 17 records (E = exclude).
    For instance, if it has value 'C' and one of 17 records matches C, then the result is false.
    The "IF" with "IN" using "TVARV" as used in the program of the post above has the same behavior of a selection screen?
    Yes, the same behavior as the selection criterion to be exact. You can press the help key in the complex selection dialog for more info.
    I know it's a silly and very basic question, but other language that I used, only the SQL has the "IN" operator, but I think they work in different ways, so I would like to understand how it works in ABAP.
    Not silly ;-). Yes they work differently.
    More info here:
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba74635c111d1829f0000e829fbfe/frameset.htm
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htm
    BR
    Sandra

Maybe you are looking for