JTable & backend

Dear All,
Right now, i am hardcoding the values for the JTable display. but i want it to be populated from my resultset.....how to do that??? exact "code" for this alone is most appreciated...
right now,
final Object[][] data = {{"Mary", "Campione", "Snowboarding","1","2","3"},{"Alison", "Huml", "Rowing","4","5","6"},{"Kathy", "Walrath","Chasing","7","8","9"}};
but i want it to be done in dynamic filling.........................
My resultset is like this...
     ResultSet resultset = stmt.executeQuery("select count(*) from empdetails;");
I can retrieve the values from the above resultset. but how to display it in the JTable dynamically????
waiting for the reply,
Sakthivel S.

hey,
if you do not want to extend a JTextField, then in your abstracttable model say
public boolean isCellEditable(int row, int col){ // i am not sure if the arguments are correct, check them in the api
if(col == 0) return true;
else return false;
hope this helps you
hussain

Similar Messages

  • Exception -arrayindexoutobound  while inserting checkbox in a jtable

    hello,
    i am using oracle as backend. As you might be knowing that oracle doesn't store boolean datatype.
    so now please tell me how to insert checkbox in a jtable.
    please do help me if you can.

    HELLO camickr
    ONE INTERESTING THING IS HAPPENING->
    i had created 2 table in my form 1) jtable1 2) jtable2
    i had declared the listener on JTABLE1 as->
    jTable1.addMouseListener(new Mousehandler())
    I HAD WRITTEN THE METHOD AS->
    public class Mousehandler extends MouseAdapter
    public void mouseClicked(MouseEvent me)
    //NOTE ->HERE IS THE CODE TO ADD CHECKBOX ON A COLUMN FOR JTABLE1
    TableColumn sport= jTable1.getColumnModel().getColumn(1);
    // str=jTable1.getCellEditor();
    JCheckBox jCheckBox1 = new JCheckBox();
    sport.setCellEditor(new DefaultCellEditor(jCheckBox1));
    //NOTE-> HERE IS THE CODE TO ADD JCHECKBOX ON A JTABLE2
    TableColumn sportcol = jTable2.getColumnModel().getColumn(1);
    JCheckBox jCheckBox2 = new JCheckBox();
    sportcol.setCellEditor(new DefaultCellEditor(jCheckBox2));
    now when i click on JTABLE1 IT IS THROWING EXCEPTION BUT WHEN FUNCTIONING WITH jTable2 WHEN I CLICK ON THE COLUMN IN WHICH I HAD INSERTED CHECKBOX IT IS FUNCTIONING PROPERLY WITHOUT ANY ERROR.
    NOTE-> I HAD TO CLICK ONCE ON JTABLE1 THEN ONLY JTABLE2
    FUNCTION BECAUSE I HAD DECLARED LISTENER FOR JTABLE1 ONLY.(JTABLE1 IS THROWING AN EXCEPTION ARRAYINDEXOUTOFBOUND when i click on the column in which i had inserted jcheckbox im my jtable1)
    PLEASE DO HELP ME IF YOU CAN.
    THANK YOU.

  • JTable custom colouring

    Hi everyone, I've been trying to create a JTable in which the first row and first column have a different background (since they contain "headers" and not actual data). I could not find a way to include headers for both columns and rows, so I defined a class called public MyTableModel, which extends AbstractTableModel and basically fetches data from the backend and puts the labels that I need in the leftmost column and topmost row. Ths class only provides implementation for getColumnClass(), getColumnCount(), getRowCount() and getValueAt(int x, int y). To make the labels stand out I wrote a class that implements TableCellRenderer and overrides its
    getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) method , setting the background to Color.red.
    However,.If I do that:
    MyTableModel model = new MyTableModel();
    JTable table = new JTable(model);nothing happens. If I do that, everything works as expected:
    //taken off the internet
            Object rows[][] = { { "one", "ichi - \u4E00" },
            { "two", "ni - \u4E8C" }, { "three", "san - \u4E09" },
            { "four", "shi - \u56DB" }, { "five", "go - \u4E94" },
            { "six", "roku - \u516D" }, { "seven", "shichi - \u4E03" },
            { "eight", "hachi - \u516B" }, { "nine", "kyu - \u4E5D" },
            { "ten", "ju - \u5341" } };
        Object headers[] = { "English", "Japanese" };
        table = new JTable(rows, headers);I would very much appreciate any help I could get.
    Thank you!

    Here is a short and executable summary of the application. The table model is just a wrapper for the SparseDoubleMatrix2D, which holds the actual data. I do appologize for not using at array in this example, but I suspect the problem may be partly due to Colt.
    package test.tables;
    import cern.colt.matrix.impl.SparseDoubleMatrix2D;
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.DefaultTableCellRenderer;
    public class MyModel  extends AbstractTableModel{
        //cern.colt.SparseDoubleMatrix2D, just a high-performance array of Double
        //to actually compile and run thiyou need to add Colt to the classpath
        //http://acs.lbl.gov/~hoschek/colt-download/releases/colt-1.2.0.zip
         private SparseDoubleMatrix2D matrix;
        public MyModel(){
            //fetch data from the backend, format it, store into 'matrix'
            //in this example just a matrix of 0s
            matrix = new SparseDoubleMatrix2D(10,10);
        public int getRowCount() {
            return matrix.rows();
        public int getColumnCount() {
            return matrix.columns();
        public Object getValueAt(int rowIndex, int columnIndex) {
            return matrix.getQuick(rowIndex, columnIndex);
        public boolean isCellEditable(int row, int col) {
                return true;
        public Class getColumnClass(int col) {
            return Double.class;
        public void setValueAt(Object value,int row, int col) {
                matrix.setQuick(row, col, Double.parseDouble(value.toString()));
        public void add() {
            //adds information to the matrix
        public void remove(int[] indices) {
           //removes information from the matrix
        public static void main(String[] args){
            JTable table = new JTable(new MyModel());
            table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
                public Component getTableCellRendererComponent(JTable table, Object value,
                        boolean isSelected, boolean hasFocus, int row, int column) {
                    Component comp = super.getTableCellRendererComponent(table, value,
                            isSelected, hasFocus, row, column);
                    if (row == 0 || column == 0) {
                        comp.setBackground(Color.red);
                    return comp;
            JFrame f= new JFrame("Test");
            f.add(table);
            f.setSize(500, 500);
            f.setVisible(true);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

  • Detecting JTable column changes

    I'm extending the AbstractTableModel with my own and I'm using getColumnName(...) to draw the value from an array:
      public String getColumnName(int col) {
        return titles[col];
      }My problem is that I want to allow column reordering but I don't know how to keep my titles[] array in sync with the changes (which is important in other areas of the program).
    Can anyone point me in the right direction?

    Jtable always messages the tableModel's setValueAt in the model coordinates - as are all calls from the JTable to the model, JTable converts them internally. There is no need to track the view coordinates (they are handled exclusively at the view level).
    If you have to do some backend update in the tableModel based on the columnNames in some particular column just do so in the the setValueAt(...) of the model, roughly like:
    class MyTableModel extends WhateverTableModel {
    public void setValueAt(...) {
      super.setValueAt(..);
      doBackendUpdate(value, row, getColumnName(column));
    }Greetings
    Jeanette

  • Start or stop edit jtable cell editing

    Hello,
    I got a problem with the jtable DefaultModel isCellEditable.
    If I set the IsCellEditable to false, I would not be able to enable the cell selection as and when I want it.
    What I have in mind is the add a mouselister so that if the user select a row using fast left mouse click like the procedure shown below
    private class MouseClickHandler extends MouseAdapter {
    public void mouseClicked(MouseEvent event) {
    int no_mouseclick = 0;
    no_mouseclick = event.getClickCount();
    if (no_mouseclick >= 2) {
    int cur_row = 0;
    cur_row = table.getSelectedRow();
    // table.setColumnSelectionAllowed(true);
    // table.setRowSelectionAllowed(true);
    for (int i=0;i<table.getColumnCount();i++){
    table.editCellAt(cur_row,i);
    System.out.println("mouse row--->" + cur_row);
    I could overwrite the IsCellEditable to true to enable that particular or cell contains in that row to be able to accept input and overwrite any data which in my case obtained from the Sql database a sort of like input module using tabulation . I am also thinking of using text component or combobox to display the value for user selection , but I do not know how to enable a particular cell for editing if the Jtable created is using a non-editable DefaultModel. If I set the IsCellEditable to true, every single cell would be enable for editing , and this defeat the purpose of enable user input only upon double mouseclicks.
    By the way , I am interested to know how to track the data changes in the cell within the jtable so that only those have been modified are notify from the Table model and updated into the Sql table
    Could anyone of you out there provide some hints please
    Thanks

    Hello,
    Tablemodellistener could detect the changes in the data, how about the backend database updating and transactional activity that must be associated with the data changes?
    What is on my mind is that , the moment there is changes in the data detected by the TableModellistener, whatever records associated with or brougt up by Jtable would be all deleted from the database and then follow by the new set of new records to be inserted into the database. The disadvantage of this method is that everytime the backend database connection and activity need to be executed the moment there is a change in the data in the jtable cell. For example the user may be just amendment to only one cell , but all the records associated need to be deleted and then inserted again.
    Perhaps there are better solution to deal with Jtable and JDBC backend connection where in this case, I am using JDO to undertake the database activity like the observable modelling .
    Could someone provide the hint please
    Thank

  • JTable & the issue

    Hi there,
         I am having a JTable in a JPanel. I am displaying the values in it from the backend. Upto this it is working fine. (I am using DefaultTableModel). My cells are kept editable. I am trying to type something in my cell...it is getting appended.....after that, WITHOUT MOVING THE POINTER TO SOMEOTHER CELL, if i try to collect all the values from the JTable, (using mytablemodel.getDataVector();)....it is giving the old value of that cell....the editted value is not gettting received...but once if i edit and move the cursor to some other cell, i can get the editted value....but how to get the editted(updated) value, without moving the cursor postion???
    hope u should have got my question....
    waiting for ur reply....
    with advance thanx
    bye,
    Sakthivel S.

    So how many times are you going to post the same question?:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=318938
    http://forum.java.sun.com/thread.jsp?forum=57&thread=318932
    http://forum.java.sun.com/thread.jsp?forum=57&thread=318940
    People get annoyed when they spend time answering a question only to find out someone else has anwered it in another thread. DO NOT CROSS POST.
    This thread should answer your question:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=318761

  • JTable & value retrieval

    Hi there,
         I am having a JTable in a JPanel. I am displaying the values in it from the backend. Upto this it is working fine. (I am using DefaultTableModel). My cells are kept editable. I am trying to type something in my cell...it is getting appended.....after that, WITHOUT MOVING THE POINTER TO SOMEOTHER CELL, if i try to collect all the values from the JTable, (using mytablemodel.getDataVector();)....it is giving the old value of that cell....the editted value is not gettting received...but once if i edit and move the cursor to some other cell, i can get the editted value....but how to get the editted(updated) value, without moving the cursor postion???
    hope u should have got my question....
    waiting for ur reply....
    with advance thanx
    bye,
    Sakthivel S.

    Yeah boss,
    I am trying to fetch the data of that said cell, ONLY AFTER the user clicks a button(after editing the cell).............called as "save" button
    here is the gist of the code:
    save.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent aevent)
    String command=aevent.getActionCommand();
    if(command.equals("Save Data"))
         Vector basevector = mytablemodel.getDataVector();
         int capacity = basevector.size();
         try
         stmt.executeUpdate("Delete * from pollingdetails;");
         for(int index=0;index<capacity;index++)
         Vector innervector = (Vector)basevector.elementAt(index);
         stmt.executeUpdate("insert into pollingdetails values(" + "'"+ innervector.elementAt(0) +"'" + ","  + "'"+innervector.elementAt(1)+"'" + "," + "'"+innervector.elementAt(2)+"'" + "," + "'"+innervector.elementAt(3)+"'" + "," + "'"+innervector.elementAt(4)+"'" + "," + "'"+innervector.elementAt(5)+"'" + ");");
         innervector=null;
         catch(Exception exp)
         {exp.printStackTrace();}
         basevector=null;
    waiting for ur reply,
    Sakthivel S.

  • SSO between a Java EE application (Running on CE) and r/3 backend

    Hi All,
    Over the past few days I have been trying to implement a SSO mechanism between NW CE Java Apps and R/3 backend without any success. I have been trying to use SAP logon tickets for implementing SSO.
    Below is what I need:
    I have a Java EE application which draws data from R/3 backend and does some processing before showing data to the users. As of now the only way the Java App on CE authenticates to r/3 backend is by passing the userid and pwds explicitly. See sample authentication code below:
    BindingProvider bp = (BindingProvider) myService;
    Map<String,Object> context = bp.getRequestContext();
    context.put(BindingProvider.USERNAME_PROPERTY, userID);
    context.put(BindingProvider.PASSWORD_PROPERTY, userPwd);
    Now this is not the way we want to implement it. What we need is when the user authenticates to CE ( using CE's UME) CE issues a SAP logon ticket to the user. This ticket should be used to subsequently login to other system without having to pass the credentials. We have configured the CE and Backend to use SAP logon tickets as per SAP help.
    What I am not able to figure out is: How to authenticate to SAP r/3 service from the java APP using SAP logon tickets. I couldnt find any sample Java  code on SAP help to do this. (For example the above sample code authenticates the user by explicitly passing userid and pwd, I need something similar to pass a token to the backend)
    Any help/pointers on this would be great.
    Thanks,
    Dhananjay

    Hi,
    Have you imported the java certificate into R/3 backend system ? if so.
    Then just go to backend system and check on sm50 for each applicaion instance of any error eg.
    SM50-> Display files (ICON) as DB symbol with spect.(cntrlshiftF8)
    You will get logon ticket details.
    with thanks,
        Rajat

  • How do I get at a JTable on a JInternalFrame?

    I've been working on this Multiple Document Interface application, and things have been great up to this point. The user chooses to run a "report" and then selects an entity to get the info for. I then hit the database. Each row returned from the database query goes into it's own data object, which is added to an ArrayList in my custom table model, and that ArrayList is used to generate the JTable, which is then added to a ScrollPane, which is then added to the JInternalFrame, which is then added to the JDesktop pane. Good stuff, right?
    I'm now trying to add Print functionality, and I'm at a loss. What I want to do is have the user do the standard File->Print, which will print out the JTable on the currently selected inner frame. I can get a JTable to print using JTable.print(). What I can't do is find a way to get the JTable from the selected frame.
    I can get the selected frame using desktop.getSelectedFrame(), but I'm at a loss as to what to do next. I've played around with .getComponent, but I'm not having any luck. the components returned don't seem to do me any good...for example, JViewPort?
    Am I going about this the wrong way? Have I poorly designed this? Am I missing the obvious?
    Thanks,
    -Adam

    Well, if you only have a single component on the internal frame then you can use getComponent(0). But then you need to go up the parent chain to get the actual table. You will initially get the JScrollPane, then use that to get the JViewport and then use that to get the viewport component.
    Another option is to extend the JInternalFrame class and insted using the add method to add a component you create get/setTable(...) methods. Then you can save the table as a class variable before adding it the scrollpane and adding the scrollpane to the internal frame.

  • JTable - Can I change the color of the text on a row by row basis?

    Hi All,
    I'm redoing a bit of old uni coursework (to model a stockmarket, stock ticker server & stock ticker application) to brush up my Java skills (esp Swing and Event Handling) and am programming the UI by hand using Swing (its the only way to learn something....(I've certianly nailed Layout Management!!))
    In the stocktickerserver GUI I'm using a JTable to display the details about stocks.
    The user can select a stock and view the details of the stock in another frame. In one panel in the JFrame I've got a JTable listing the history items for the stock (Price, Change, Date).
    Is it possible to color the rows of the JTable according to the value of the change column (or at least the value I insert there)?
    e.g
    if (change > 0){
    Blue;
    else{
    if (change < 0){
    Red;
    else{
    Green;
    I'm completly ignorant on how to achieve this (or even if its possible at all) so all your ideas welcome.
    Any help much appreciated
    Pete
    P.S.
    The Stock History is a class that I store in a [private] Vector in the Stock Class.
    For the selected Stock I loop through this vector getting the items (using various accessor methods)
    I extract the values from the return StockHistory object and build a DefaultTableModel from these
    Then I call JTable.setModel(theModel) to build the table

    implement TableCellRenderer and change foreground of the Renderer in the method getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) . Install this renderer to your table.

  • How to select a specific cell in a JTable?

    Hi there,
    in a JTable, I would like to select a specific cell (to highlight it) from a JButton.
    Here a sample code...
    Who could help me to fill it?
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TableSelection{
        public static void main (String args[]) {
          JFrame frame = new MyFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.show();
    class MyFrame extends JFrame{
      public MyFrame(){
        setTitle("TableSelection");
        setSize(WIDTH,HEIGHT);
        DefaultTableModel myModel = new DefaultTableModel(2,2);
        JTable myTable = new JTable(myModel);
        myTable.setCellSelectionEnabled(true);
        JButton button00 = new JButton("select 0,0");
        button00.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent event){
         System.out.println("selection of cell (0,0)");
         //--- what code is required to select the cell(0,0)?
        JButton button11 = new JButton("select 1,1");
        button11.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent event){
         System.out.println("selection of cell (1,1)");
         //--- what code is required to select the cell(1,1)?
        Box myBox = new Box(BoxLayout.Y_AXIS);
        myBox.add(new JScrollPane(myTable));
        myBox.add(button00);
        myBox.add(button11);
        getContentPane().add(myBox, BorderLayout.CENTER);
      private static final int WIDTH=200;
      private static final int HEIGHT=200;
    }Thanks a lot for your help.
    Denis

    Use the addColumnSelectionInterval(int index1, int index2)method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addColumnSelectionInterval(int,%20int)
    and the addRowSelectionInterval(int index1, int index2) method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addRowSelectionInterval(int,%20int)
    Hope that helped.
    afotoglidis

  • Error while uploading Backend Role

    Hi All,
              I was trying to upload a backend role in Portal, but while uploading, got the following error:
    com.sap.portal.pcd.rolemigration.RoleMigrationException: Nested Exception. Failure to execute native function. Nested Exception. NOT_AUTHORIZED - message at com.sap.portal.pcd.rolemigration.util.Connector.callFunction(SAP_ECC_HumanResources,en_US,qpi019,MENU_AGR_TREE_READ_HIERARCHY,{ACTIVITY_GROUP=Z_QPI_AGU}): Check parameters. Nested Exception. Failure to execute native function. Nested Exception. NOT_AUTHORIZED at com.sap.portal.pcd.rolemigration.RoleMigrationObject.getIconsDescriptions(RoleMigrationObject.java:2154) at com.sap.portal.pcd.rolemigration.RoleMigrationObject.migrate(RoleMigrationObject.java:1843) at com.sap.portal.pcd.rolemigration.RoleMigrationObject.migrate(RoleMigrationObject.java:782) at com.sap.portal.pcd.rolemigration.RoleMigrationThread.run(RoleMigrationThread.java:523) Original exception: com.sapportals.connector.execution.ExecutionException: Nested Exception. Failure to execute native function. Nested Exception. NOT_AUTHORIZED at com.sapportals.connectors.SAPCFConnector.SAPConnectorException.getNewExecutionException(SAPConnectorException.java:116) at com.sapportals.connectors.SAPCFConnector.execution.functions.SAPCFConnectorInteraction.execute(SAPCFConnectorInteraction.java:531) at com.sap.portal.pcd.rolemigration.util.Connector.callFunction(Connector.java:426) at com.sap.portal.pcd.rolemigration.RoleMigrationObject.getIconsDescriptions(RoleMigrationObject.java:1940) at com.sap.portal.pcd.rolemigration.RoleMigrationObject.migrate(RoleMigrationObject.java:1843) at com.sap.portal.pcd.rolemigration.RoleMigrationObject.migrate(RoleMigrationObject.java:782) at com.sap.portal.pcd.rolemigration.RoleMigrationThread.run(RoleMigrationThread.java:523) Caused by: com.sapportals.connector.ConnectorException: Nested Exception. NOT_AUTHORIZED at com.sapportals.connectors.SAPCFConnector.SAPConnectorException.getNewConnectionException(SAPConnectorException.java:37) at com.sapportals.connectors.SAPCFConnector.execution.functions.SAPCFConnectorInteraction.execute(SAPCFConnectorInteraction.java:406) at com.sapportals.connectors.SAPCFConnector.execution.functions.SAPCFConnectorInteraction.execute(SAPCFConnectorInteraction.java:496) at com.sapportals.connectors.SAPCFConnector.execution.functions.SAPCFConnectorInteraction.execute(SAPCFConnectorInteraction.java:520) ... 5 more Caused by: com.sap.mw.jco.JCO$AbapException: (126) NOT_AUTHORIZED: NOT_AUTHORIZED at com.sap.mw.jco.JCO$Client.execute(JCO.java:3429) at com.sapportals.connectors.SAPCFConnector.execution.functions.SAPCFConnectorInteraction.execute(SAPCFConnectorInteraction.java:398) ... 7 more
    Can you please suggest, how to go ahead to overcome the issue.
    Cheers!!!
    Umang Mathur

    Hi,
        The backend user, mapped to Portal, was given SAP_ALL authorization. Once that was done, the role was uploaded easily into Portal. But now, the issue is, which role is specifically required to perform the task. The role, s_rfc was already given to the user, but still I was facing the error. 
    As of now, I am keeping the post open, for discussion and points. Please post your valuable comments.
    Cheers!!!!
    Umang

  • Error while reading the PO in the Backend system. Inform system admin

    Hi All,
    We are having a peculiar issue of 'Error while reading the PO in the Backend system. Inform system admin'.
    The P.O is in ordered status in SRM but the same is not getting transferred to backend ECC system.
    No error messages or logs in RZ20, SLG1 any where.
    All programmes like BBP_GET_STATUS_2 and CLEAN_REQREQ_UP are running fine.
    Tried pushing the P.Os manually using function module (BBP_PD_PO_TRANSFER_EXEC_V2) to backend ECC.
    It was working fine till a week ago and suddenly this problem is coming.
    We had implemented few OSS notes suggested by SAP for the issue of 'shopping carts appearing in sourcing cockpit even after P.O creation' in both development and test system.
    Now this issue is coming up in test system where as development system is working fine.
    Please let us know where to look and how to resolve this issue.
    A quick response would be highly appreciated.
    Regards,
    Teja

    I am facing the same issue with one PO in the Production system.
    SRM 5.0 , R/3 4.6C Extended classic scenario.
    I checked the status of other PO's created today. I see them in R/3. There is one PO which was created a week back which shows up as "ordered" in SRM but the PO is missing in R/3. When clicked on the details on the web, system throws the error
    Error while reading the PO in the Backend system. Inform system admin.
    Message no. BBP_CF010
    I checked RZ20, SLG1 no errors were found. I checked RFC connection, it was working fine too.
    I tried pushing the PO using the FM BBP_PD_PO_TRANSFER_EXEC, it did not solve the problem.
    In SRM WEBGUI Process PO - Item data -->follow on documents --> PO status is shown as Archived.
    Any inputs would be greatly appreciated. Please throw some light on this issue.
    Krishna

  • Creation of multiple contracts in ERP backend from 1 GOA in SRM

    Hello fellow SRM'ers, we are on SRM 5.5 and we have a scenario where we create a GOA in SRM and it get's created as a contract in the ERP backend system.  This is working fine.  Now our client would like to have multiple contracts created in the backend, one for each company when the GOA is saved.  I found OSS note 646903, statement #2 that explains how to code the badi bbp_ctr, but is this all that is required to do this?  It seems to me that the code in BBP_CTR will only create 1 contract/idoc.  Can anyone tell me how we generate an idoc/contract that we want to create in ERP backend?  Or is this how it's done?
    Points will be rewarded for usefull answers.  I have read most of the posts on this forum and have not found any answers yet.
    Thanks,
    Marty

    Hi,
    Please go through the below explanation from SAP documentation which says the no of contracts that would be created in the backend depends on
    --If you activate grouping logic for locations in GOA from SPRO under cross aplication settings, items belonging to the same release-authorized purchasing organization, but different locations, can be grouped together into one backend contract. This requires a 1:1:1 relationship between an item, the release-authorized purchasing organization, and the location. This means that for each item, you can only assign one release-authorized purchasing organization, and one location, in order to release the GOA.
    If you do not select this indicator to activate the grouping logic for location, a separate backend contract is created for each item belonging to the same release-authorized purchasing organization, but with different locations. Only items referring to the same release-authorized purchasing organization and location can be combined into one backend contract.---
    So the bottomline is by default, when we distribute one separate contract is created for each location.
    Hope this clarifies.
    Regards,
    RRK

  • Create a JTable based on an ArrayList containing instances of a class.

    I have a class, IncomeBudgetItem, instances of which are contained in an ArrayList. I would like to create a JTable, based on this ArrayList. One variable is a string, while others are type double. Not all variables are to appear in the JTable.
    The internal logic of my program is already working. And my GUI is largely constructed. I'm just not sure how to make them talk to each other. The actually creation of the JTable is my biggest problem right now.

    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.util.ArrayList;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    public class TableDemo extends JPanel {
         private boolean DEBUG = false;
         public TableDemo() {
              super(new GridLayout(1, 0));
              ArrayList<MyObject> list = new ArrayList<MyObject>();
              list.add(new MyObject("Kathy", "Smith", "Snowboarding", new Integer(5),
                        new Boolean(false)));
              list.add(new MyObject("John", "Doe", "Rowing", new Integer(3),
                        new Boolean(true)));
              list.add(new MyObject("Sue", "Black", "Knitting", new Integer(2),
                        new Boolean(false)));
              list.add(new MyObject("Jane", "White", "Speed reading",
                        new Integer(20), new Boolean(true)));
              JTable table = new JTable(new MyTableModel(list));
              table.setPreferredScrollableViewportSize(new Dimension(500, 70));
              table.setFillsViewportHeight(true);
              // Create the scroll pane and add the table to it.
              JScrollPane scrollPane = new JScrollPane(table);
              // Add the scroll pane to this panel.
              add(scrollPane);
         class MyObject {
              String firstName;
              String lastName;
              String sport;
              int years;
              boolean isVeg;
              MyObject(String firstName, String lastName, String sport, int years,
                        boolean isVeg) {
                   this.firstName = firstName;
                   this.lastName = lastName;
                   this.sport = sport;
                   this.years = years;
                   this.isVeg = isVeg;
         class MyTableModel extends AbstractTableModel {
              private String[] columnNames = { "First Name", "Last Name", "Sport",
                        "# of Years", "Vegetarian" };
              ArrayList<MyObject> list = null;
              MyTableModel(ArrayList<MyObject> list) {
                   this.list = list;
              public int getColumnCount() {
                   return columnNames.length;
              public int getRowCount() {
                   return list.size();
              public String getColumnName(int col) {
                   return columnNames[col];
              public Object getValueAt(int row, int col) {
                   MyObject object = list.get(row);
                   switch (col) {
                   case 0:
                        return object.firstName;
                   case 1:
                        return object.lastName;
                   case 2:
                        return object.sport;
                   case 3:
                        return object.years;
                   case 4:
                        return object.isVeg;
                   default:
                        return "unknown";
              public Class getColumnClass(int c) {
                   return getValueAt(0, c).getClass();
          * Create the GUI and show it. For thread safety, this method should be
          * invoked from the event-dispatching thread.
         private static void createAndShowGUI() {
              // Create and set up the window.
              JFrame frame = new JFrame("TableDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // Create and set up the content pane.
              TableDemo newContentPane = new TableDemo();
              newContentPane.setOpaque(true); // content panes must be opaque
              frame.setContentPane(newContentPane);
              // Display the window.
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              // Schedule a job for the event-dispatching thread:
              // creating and showing this application's GUI.
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        createAndShowGUI();
    }

Maybe you are looking for