Updating a subtype from another subype

Hi all,
I need update the subtype of an infotype while transaction for other subtype is being run. We can't use bdc for this as the pernr would be locked for the previous subtype. Right now i am updating those fields using the update statement.
thanks,
madhu

I reckon you could possibly use a dynamic action.
Guess, it would depend on how complex your selection logic would be... from the description above I'd not even be sure that we're talking about PA30/PA40!
However, I'd say, dynamic actions, however simple/useful quickly become a nightmare to maintain, and given the option of using something else, I'd use something else. That just my opinion, others are more than entitled to their own.
That said, it may be this is a just a case of if user creates subtype 02, change any subtype 03 to a subtype 04, all fields transfered, nothing else changed, no other logic required. In which case, go for a dynamic action.
(Table T588Z for dynamic action btw.)

Similar Messages

  • How to update one table from another

    I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
    I created a table with the following sql of all the affected rows:
    CREATE TABLE LSU_INTER_FIX_DATE AS
    select request_id,received_date,planned_start_date, actual_start_date
    from lsu_inter2_requests_t
    where received_date < to_date('01-JAN-1900')
    OR planned_start_date < to_date('01-JAN-1900')
    OR actual_start_date < to_date('01-JAN-1900')
    I then repaired all of the rows with three data fixes
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
    where planned_start_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
    where actual_start_date < to_date('01-JAN-1900')
    I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
    UPDATE lsu_inter2_requests_t aaa
    SET aaa.received_date = bbb.received_date
    FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
    When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?

    Comet wrote:
    I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
    I created a table with the following sql of all the affected rows:
    CREATE TABLE LSU_INTER_FIX_DATE AS
    select request_id,received_date,planned_start_date, actual_start_date
    from lsu_inter2_requests_t
    where received_date < to_date('01-JAN-1900')
    OR planned_start_date < to_date('01-JAN-1900')
    OR actual_start_date < to_date('01-JAN-1900')
    I then repaired all of the rows with three data fixes
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
    where planned_start_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
    where actual_start_date < to_date('01-JAN-1900')
    I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
    UPDATE lsu_inter2_requests_t aaa
    SET aaa.received_date = bbb.received_date
    FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
    When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?I am not convinced you have what you think you have
    >
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    When you want to produce a DATE datatype when starting with a string,
    you must use TO_DATE() on the SET line!
    (TO_CHAR(received_date,'RRRR') + 2000)since when do you do add characters (from TO_CHAR) with a constant number (2000)?
    You should NEVER EVER rely on implicit datatype conversion
    Edited by: sb92075 on Jul 27, 2011 7:09 PM

  • Trying to update UI with from another thread

    Hi,
    I start a JavaFX application from another class, and then I want to modify UI components from it. I have been trying to use Platform.runLater to do it.
    But the GUI hangs initially (doesnt display anything) for the first 5 seconds (sleep time) and then modifies and shows it.
    I want to display the GUI at first, and then after 5 seconds the GUI should update with the message, but with the below code it just hangs first and displays everything after 5seconds.
    Here sampleGUI is a a javafx app with text fields in it.
    +public class StartGame extends Application {+
    +@Override+
    +public void start(Stage stage) throws Exception {+
    final sampleGUI gui = new sampeGUI();
    gui.start(stage);
    +Platform.runLater(new Runnable() {+
    +@Override+
    +public void run() {+
    +try {+
    System.out.println("Sleeping now...");
    Thread.sleep(5000);
    System.out.println("Sleep over!");
    gui.updateText("New message");
    +} catch (InterruptedException ex) {+
    System.out.println("exception" ex);+
    +}+
    +}+
    +});+
    +}+
    +}+

    Platform.runLater(new Runnable() {
      @Override
      public void run() {
    });causes the Runnable's run method to be executed on the FX Application Thread. Since you put Thread.sleep(5000) inside your Runnable's run method, the sleep happens on the FX Application Thread.
    The call to runLater(...) can be invoked from any thread, including the FX Application Thread.
    So if you are not in the FX Application thread, you want to do:
    // any long-running task, for example
    System.out.println("Sleeping now");
    Thread.sleep(5000);
    System.out.println("Sleep over");
    Platform.runLater(new Runnable() {
      @Override
      public void run() {
        // update UI:
        gui.updateText("New Message");
    });If you are on the FX Application thread, which is the case in your Application.start(...) method, you need to create a new thread to execute your long-running code. You can do this "by hand", creating a Thread and a Runnable for it to execute, but it's probably better to use the JavaFX concurrency API, which has lots of useful hooks for updating the UI on the FX Application Thread.
    In this case, the code would look like this:
    public class StartGame extends Application {
      @Override
      public void start(Stage stage) throws Exception {
        final SampleGUI gui = new SampleGUI();
        gui.start();
        final Task<String> waitingTask = new Task<String>() {
          @Override
          public String call() throws Exception {
            System.out.println("Sleeping");
            Thread.sleep(5000);
            System.out.println("Sleep over!");
            return "New Message" ;
        waitingTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
          @Override
          public void handle(WorkerStateEvent event) {
            gui.updateMessage(waitingTask.getValue());
        ExecutorService executor = Executors.newSingleThreadExecutor();
        executor.submit(waitingTask);
    }There are (probably dozens of) other ways to use a Task to do this. See the [url http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html]API docs for Task for more.

  • SQL update one column from another column

    I'm looking for a way to update a SQL column with a portion
    of info from another column in the same table.
    example of a sql command
    UPDATE table1
    SET table1.columnname1 = table1.columnname2
    FROM table
    WHERE blah blah blah
    Here's the thing... I only need a portion of the data found
    in the source column. I'm not sure how I would do this then.
    for example, the database has countries and states combined
    into one column like this 'US-DC', 'US-CA', US-FL', etc. I want to
    separate these into two columns, a country column and a state
    column.... and I dont want to go though all the results and do this
    line by line. How would I write the SQL command so that it puts
    just the country in the country column, and puts just the state in
    the state column, and it omits the dash all together.
    any ideas?

    It depends. Are you using PHP and mySQL or ASP and SQL?
    If you are using mysql and PHP you could use the following
    code to loop through all records in your datatbase.
    $sql="SELECT * FROM tablename"; //SET tablename to the name
    of your database table.
    $result=mysql_query($sql)or die(mysql_error(). " - $sql");
    for($x = 0; $row=mysql_fetch_assoc($result); $x++){
    //set up the variables from the table
    $ID=$row['ID']; //this is the primary key
    $var1=$row['contrystatecolumn']; //this is the name of the
    column which holds the country-state
    $var2=explode("-", $var1); //now we explode the string to get
    the country and the state seperated and place the results into an
    array
    $country=$var2[0]; //this is the first piece of the exploded
    string in the array
    $state=$var2[1]; //this is the second piece of the exploded
    string in the array
    //now we update the database record with the new information
    //remember to replace the tablename with your actual table
    name and the columns country and state with the acutal names of
    your columns in your table
    $sql2="UPDATE tablename SET country='$country'.
    state='$state' WHERE ID='$ID'";
    $result2=mysql_query($sql2)or die(mysql_error() . " -
    $sql2");
    This code will loop through every record in your table and do
    what you want very quickly.
    Hope this helps
    Stan Forrest
    Senior Web Developer
    ATG Internet

  • Updating a table from another table

    I have a target table a.
    SQL> select * from a;
    FUND TERM
    1
    2
    3
    4
    5
    6
    7
    8
    8 rows selected.
    And, I have another table 'b' where I have the values for 'term' backed up for 4 funds.
    SQL> select * from b;
    FUND TERM
    1 07-JUL-08
    2 08-JUL-08
    3 09-JUL-08
    4 10-JUL-08
    4 rows selected.
    I could use the below merge sql statement to update the target table 'a' with term dates from table b.
    SQL> merge into a
    using b
    on (a.fund = b.fund)
    when matched then
    update set a.term = b.term;
    Merge successfully completed.
    SQL> select * from a;
    FUND TERM
    1 07-JUL-08
    2 08-JUL-08
    3 09-JUL-08
    4 10-JUL-08
    5
    6
    7
    8
    8 rows selected.
    But, my question is, how could this update be done without using 'merge' in sql (not pl/sql). I think I've done it in the past, but just cannot recall how I did it.
    Thanks in advance for any tips you may provide.

    A few ways:
    update a
    set    a.term = (select b.term
                     from   b
                     where  b.fund = a.fund)
    where  exists   (select b.term
                     from   b
                     where  b.fund = a.fund)
    or
    update
       select a.term a_term
             ,b.term b_term
       from   a,b
       where  a.fund = b.fund
    set a_term = b_term;The second one only works if you have a "key preserved table".

  • Update table column from another

    Hi,
    I´m having trouble updating data from one table to another. I wish to syncronize the geometry field of the table FAROLFAROLIM from FAROLFAROLIM_OUT. By standard SQL I've tried this:
    update FAROLFAROLIM f, FAROLFAROLIM_OUT ff set f.GEOM = ff.GEOMETRY
    where f.IDFAROLFAROLIM = ff.IDFAROLFAROLIM
    Can you help me figuring out what is wrong???
    Thanks in advance
    Operator

    dude you are doing wrong thing...
    please use following command.
    UPDATE FAROLFAROLIM f
    SET (f.GEOM) =
    ( SELECT ff.GEOMETRY
    FROM FAROLFAROLIM_OUT ff
    WHERE f.IDFAROLFAROLIM = ff.IDFAROLFAROLIM );
    cheers,
    Sandy

  • Can I update an iMac from another iMac using Carbon Copy Cloner?

    I change office locations every 6 months and move to a similar iMac setup. At each move, using external hard drives, I update the "older" iMac HD with the current Mail, Addressbook, work files, etc. Currently, I am using Snow Leopard; the machine I am transitioning to is behind, using Leopard.
    This time something new is before me, I purchased (honestly) the Snow Leopard upgrade for the iMac that I am transitioning to. So I have an OS upgrade plus a file plus a lot of application additions/upgrades.
    The question is, can I use *Carbon Copy Cloner* to make an image of my current iMac and upgrade the 2nd iMac with all my recent applications in one fell swoop? I would

    Arthur Levy wrote:
    I change office locations every 6 months and move to a similar iMac setup. At each move, using external hard drives, I update the "older" iMac HD with the current Mail, Addressbook, work files, etc. Currently, I am using Snow Leopard; the machine I am transitioning to is behind, using Leopard.
    This time something new is before me, I purchased (honestly) the Snow Leopard upgrade for the iMac that I am transitioning to. So I have an OS upgrade plus a file plus a lot of application additions/upgrades.
    The question is, can I use Carbon Copy Cloner to make an image of my current iMac and upgrade the 2nd iMac with all my recent applications in one fell swoop?
    Yes. Noondaywitch is correct. As long as the version of OSX is no older than the one the newest Mac came with, and the older Mac is compatible (enough RAM, etc), and the drives are formatted properly, you should be able to clone from one Mac to an external HD, then clone that back to the other one.
    When you make the clone, boot up from it and run several apps, make sure your internet connection and browser work, etc.
    Before cloning back to the other Mac, boot it up from the clone and do the same.
    You may have to change a few settings for your internet connection, of course.

  • How to update one table from another table?

    Hi,
    Please go through the case I am mentioning below and if possible try to provide with a solution.
    I am working on a report to generate cash flow forecast, where in one of the fields is "Payroll", in which its being mentioned as:
    In the selection screen: I am entering Project ID, profit Center and Period(in MM/YYYY format).
    Selection of all entries in table COSP for selected cost elements above, value type 1, version , all periods and for all selected WBS elements and all objects underneath.
    From this, update table COFP with information from COSP with value type 62 and same period.
    For updation of various fields the following information is being given.
    How should we update COFP?
    New entries per OBJNR/PERIO and HKONT are required via using the information from COSP:
    COFP-MANDT              =          SY-MANDT
    COFP-KOKRS              =          if COSP-OBJNR begins with ‘PR’
                                                   Check table PRPS with COSP-OBJNR = PRPS-OBJNR and enter PRPS-PKOKR
                                                    If COSP-OBJNR begins with ‘NV’
                                                   Check table AFVC with COSP-OBJNR = AFVC-OBJNR,
    go to Table AFKO with AFVC-AUFPL,
    go to table AUFK with AFKO-AUFNR and enter AUFK-KOKRS
    If COSP-OBJNR begins with ‘OR’
    Check table AUFK with COSP-OBJNR = AUFK-OBJNR
    and enter AUFK-KOKRS
    COFP-BELNR               =          Check table NRIV, CLIENT = SY-MANDT, OBJECT = RK_BELEG,
    SUBOBJECT = COFP-KOKRS, NRRANGENR = ‘05’,
    Add 1 to NRLEVEL and begin with 500000000
    Use same BELNR for one update-run
    COFP-BUZEI                =          ‘1’ + and 1 in next entry but same update-run
    COFP-TWAER              =          COSP-TWAER
    COFP-ZHLDT                =          always last day of month in field COFP-PERIO
    COFP-GJAHR               =          COSP-GJAHR
    COFP-PERIO               =          if entry in field WKG001 à PERIO = 001
                                                   If entry in field WKG006 à PERIO = 006……
    COFP-WRTTP              =          ‘62’
    COFP-VRGNG              =          ‘FIPL’
    COFP-POSIT                =          Check table SKB1 where SAKNR = COSP-KSTAR and use SKB1-FIPOS
                                                   for going to table FMCI-FIPOS and enter FMCI-POSIT
    COFP-OBJNR               =          COSP-OBJNR
    COFP-HKONT              =          COSP-KSTAR
    COFP-WKGBTR           =          WKGXXX
    COFP-WKGBTRO         =          -
    COFP-WTGBTR            =          WTGXXX
    COFP-WTGBTRO         =          -
    COFP-WOGBTR           =          WTGXXX
    COFP-WOGBTRO        =          -
    COFP-BUKRS1            =          -
    COFP-GJAHR1             =          -
    COFP-BELNR1             =          -
    COFP-BUZEI1              =          -
    COFP-BUKRS2            =          -
    COFP-GJAHR2             =          -
    COFP-BELNR2             =          -
    COFP-BUZEI2              =          -
    COFP-EBELN               =          -
    COFP-EBELP               =          -
    COFP-ZEKKN               =          -
    COFP-ETENRM            =          -
    COFP-STUNR               =          -
    COFP-LIFNR                =          -
    COFP-KUNNR              =          -
    COFP-GSBER              =          -
    COFP-BUKRS              =          (nearly same as COFP-KOKRS!)
                                                   if COSP-OBJNR begins with ‘PR’
                                                   Check table PRPS with COSP-OBJNR = PRPS-OBJNR and enter PRPS-PBUKR
                                                    If COSP-OBJNR begins with ‘NV’
                                                   Check table AFVC with COSP-OBJNR = AFVC-OBJNR,
    go to Table AFKO with AFVC-AUFPL,
    go to table AUFK with AFKO-AUFNR and enter AUFK-BUKRS
    If COSP-OBJNR begins with ‘OR’
    Check table AUFK with COSP-OBJNR = AUFK-OBJNR
    and enter AUFK-BUKRS
    COFP-EINDT                =          -
    COFP-SGTXT               =          -
    COFP-GEBER              =          -
    COFP-KURSF              =          -
    COFP-KUFIX                =          -
    COFP-GBETR              =          -
    COFP-KURSR              =          -
    COFP-KURSFIKRS       =          -
    COFP-KZKRS               =          -
    COFP-UMBKZ              =          -
    COFP-KBLNR               =          -
    COFP-KBLPOS            =          -
    COFP-HI FIVOR            =          -
    COFP-LO FIVOR          =          -
    COFP-HI ACCOUNT      =          -
    COFP-LO ACCOUNT     =          -
    COFP-HI LIFNR            =          -
    COFP-LO LIFNR           =          -
    COFP-HI KUNNR          =          -
    COFP-LO KUNNR         =          -
    COFP-XDELETE           =          -
    COFP-HI XOPVW         =          -
    COFP-LO XOPVW        =          -
    COFP-ZAEHK               =          -
    COFP-CHAINBELNR     =          -
    COFP-MWSKZ             =          -
    COFP-LEDNR               =          -
    COFP-BELTP               =          ‘1’
    COFP-VERSN              =          ‘0’
    COFP-OWAER             =          COSP-TWAER
    COFP-CPUDT               =          SY-DATUM
    COFP-CPUTM              =          SY-TIME
    after doing updation, its again saying Selection of all entries in table COFP with value type 51 to 62, selected year, selected cost elements above and for all selected WBS elements and all objects underneath. Summarisation by period.
    Now, can someone help me as how to proceed with the entire thing? An elaborate and illustrative answer would be highly appreciable.
    If you require any other information....then get back to me ..asap.
    Its bit urgent.
    Thanks & Regards,
    Ravi

    Hi
    update <table> from <i_tab>
    for different conditions.
    loop at i_cosp.
    if cosp-mandt eq sy-mandt and  cosp-objnr eq 'PR'.
    Read table i_PRPS with key  i_PRPS-OBJNR = i_COSP-OBJNR.
    if sy-subrc eq 0.
    update PRPS set PKOKR = ? where objnr = i_prpr-objnr.
    endif.
    endif.
    similarly for all the conditions
    Regards
    Message was edited by: Harikishore Sreenivasulu

  • How can I update a JTextArea from another class

    I am new to Java so forgive me if this is confusing, or if I seem to be taking an overly complex route to acheiving my goal.
    I've got a JTextArea component added to a JPanel object, which is then inserted into the JFrame. I have a JMenuBar with a JMenu "file" and a JMenuItem "connect" on this same JFrame. When clicked, the actionEvent of JMenuItem "connect" calls a class "ConnectToDb" to establish a connection with the Database. On a successful connection, I want to append the String "Connection Successful" to the JTextArea component, but since the component is a part of the JPanel object, I cannot seem to get access to the JTextArea component to update it. I tried instantiating the JPanel object from within the "ConnectToDb" class and then called a method I created to set the JTextArea. No luck. Can someone give me an idea of what I need to do that would allow me to update the text of the JTextArea component from anywhere in my program? Once it has been contained in the JPanel or JFrame, can it be updated?
    This is the class that establishes the simple Db Connection
    package cjt;
    import java.io.*;
    import java.sql.*;
    * Get a database connection
    * Creation date: (04/01/2002 4:08:39 PM)
    * @author: Yaffin
    public class ConnectToDB {
    public Connection dbConnection;
    // ConnectToDB constructor
    public ConnectToDB() {
    public Connection DbConnect() {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String sourceURL = new String("jdbc:odbc:CJTSQL");
    Connection dbConnection = DriverManager.getConnection(sourceURL, "Encryptedtest", "pass");
    System.out.println("Connection Successful\n");
    //this is where I originally tried to append "Connection Successful
    //to the JTextArea Object in WelcomePane()          
    } catch (ClassNotFoundException cnfe) {
    //user code
    System.out.println("This ain't working because of a class not found exeption/n");
    } catch (SQLException sqle) {
    //user code
    System.out.println("SQL Exception caused your DB Connection to SUCK!/n");
    return dbConnection;
    This is the JPanel that contains the JTextArea "ivjStatusArea" I am trying to update from other classes. Specifically the "ConnectToDb" class above.
    package cjt;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    * Build Welcome Pane
    * Creation date: (04/01/2002 3:42:50 PM)
    * @author: yaffin
    public class WelcomePane extends JPanel {
         private JTextArea ivjtxtConnect = null;
         private JLabel ivjwelcomeLbl = null;
         private JTextArea ivjStatusArea = null;
    * WelcomePane constructor comment.
    public WelcomePane() {
         super();
         initialize();
    * Return the StatusArea property value.
    * @return javax.swing.JTextArea
    private javax.swing.JTextArea getStatusArea() {
         if (ivjStatusArea == null) {
              try {
                   ivjStatusArea = new javax.swing.JTextArea();
                   ivjStatusArea.setName("StatusArea");
                   ivjStatusArea.setLineWrap(true);
                   ivjStatusArea.setWrapStyleWord(true);
                   ivjStatusArea.setBounds(15, 153, 482, 120);
                   ivjStatusArea.setEditable(false);
                   // user code begin {1}
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjStatusArea;
    * Initialize the class.
    private void initialize() {
         try {
              // user code begin {1}
              // user code end
              setName("WelcomePane");
              setLayout(null);
              setSize(514, 323);
              add(getStatusArea(), getStatusArea().getName());
         } catch (java.lang.Throwable ivjExc) {
              handleException(ivjExc);
         // user code begin {2}
         // user code end
    This is the main class where evrything is brought together. Notice the BuildMenu() method where the JMenuItem "connect" is located. Also notice the PopulateTabbedPane() method where WelcomePane() is first instantiated.
    * The main application window
    * Creation date: (04/01/2002 1:31:20 PM)
    * @author: Yaffin
    public class CjtApp extends JFrame {
    private JTabbedPane tabbedPane;
    private ConnectToDB cdb;
    private Connection dbconn;
    public CjtApp() {
    super("CJT Allocation Application");
    // Closes from title bar
    //and from menu
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    tabbedPane = new JTabbedPane(SwingConstants.TOP);
    tabbedPane.setForeground(Color.white);
    //add menubar to frame
    buildMenu();
    //populate and add the tabbed pane
    populateTabbedPane(dbconn);
    //tabbedPane.setEnabledAt(1, false);
    //tabbedPane.setEnabledAt(2, false);
    getContentPane().add(tabbedPane);
    pack();
    * Build menu bar and menus
    * Creation date: (04/01/2002 2:42:54 PM)
    private void buildMenu() {
    // Instantiates JMenuBar, JMenu,
    // and JMenuItem.
    JMenuBar menubar = new JMenuBar();
    JMenu menu = new JMenu("File");
    JMenuItem item1 = new JMenuItem("Connect");
    JMenuItem item2 = new JMenuItem("Exit");
    //Opens database connection screen
    item1.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    //call the ConnectToDb class for a database connection
    ConnectToDB cdb = new ConnectToDB();
    dbconn = cdb.DbConnect();
    }); // Ends buildMenu method
    //Closes the application from the Exit
    //menu item.
    item2.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.exit(0);
    }); // Ends buildMenu method
    //Adds the item to the menu object
    menu.add(item1);
    menu.add(item2);
    //Adds the menu object with item
    //onto the menu bar     
    menubar.add(menu);
    //Sets the menu bar in the frame
    setJMenuBar(menubar);
    } //closes buildMenu
    public static void main(String[] args) {
    CjtApp mainWindow = new CjtApp();
    mainWindow.setSize(640, 480);
    mainWindow.setBackground(Color.white);
    mainWindow.setVisible(true);
    mainWindow.setLocation(25, 25);
    * Add tabs to the tabbedPane.
    * Creation date: (04/01/2002 2:52:19 PM)
    private void populateTabbedPane(Connection dbconn) {
         Connection dbc = dbconn;
         tabbedPane.addTab(
         "Welcome",
    null,
    new WelcomePane(),
    "Welcome to CJT Allocation Application");
         tabbedPane.addTab(
         "Processing",
    null,
    new ProcessPane(dbc),
    "Click here to process an allocation");
         tabbedPane.addTab(
         "Reporting",
    null,
    new ReportPane(),
    "Click here for reports");
    //End
    Thanks for any assistance you can provide.
    Yaffin

    Thanks gmaurice1. I appreciate the response. I believe I understand your explanation. I am clear that the calling code needs access to the WelcomPane() object. I am assuming that the constructor for the calling class must have the JPanel WelcomePane() instance passed to it as an argument. This way I can refer directly to this specific instance of the object. Is this correct?
    Also, where would you create the set method? I tried to create a set method as part of the WelcomePane() class, and then call it from the calling class, but it didn't seem to work. Lastly, a globally accessible object? Can you explain this concept briefly? Thanks again for your help.
    yaffin

  • Update one column from another

    Hi guys,
    I have two columns in a table, FIRSTNAME and LASTNAME. Currently, both firstname and lastname are appearing in 'Firstname' column. I would like to split the last name from this column and insert into the 'LASTNAME' column.
    For example, here's what I have currently:
    Line: -----
    Firstname     Lastname
    Peter Andre     
    James Dean     
    Watch Man     
    Jenna Klare     
    James Smith     
    Tina Adams     
    Blair Witch     
    Currently, my 'Lastname' column is empty. I would like to update the table to insert lastname from the 'FIRSTNAME' field into 'LASTNAME' column, so the output will look like:
    Firstname     Lastname
    Peter     Andre
    James     Dean
    Watch     Man
    Jenna     Klare
    James     Smith
    Tina     Adams
    Blair      Witch
    Please help.
    Thanks in advance.

    Hi,
    maybe this,
    SQL> with t As(Select 'Peter Andre' Name From Dual union all
      2            Select 'James Dean' Name From Dual union all
      3            Select 'Watch Man' Name From Dual union all
      4            Select 'Jenna Klare' Name From Dual union all
      5            Select 'James Smith' Name From Dual union all
      6            Select 'Tina Adams' Name From Dual union all
      7            Select 'Blair Witch' Name From Dual)
      8  SELECT regexp_substr(Name,'[^ ,]+' ) First
      9       , regexp_substr(Name,'[^ ,]+$') LastName
    10    FROM t;
    FIRST                                        LASTNAME
    Peter                                        Andre
    James                                        Dean
    Watch                                        Man
    Jenna                                        Klare
    James                                        Smith
    Tina                                         Adams
    Blair                                        Witch
    7 rows selectedor
    SQL> with t As(Select 'Peter Andre' Name From Dual union all
      2            Select 'James Dean' Name From Dual union all
      3            Select 'Watch Man' Name From Dual union all
      4            Select 'Jenna Klare' Name From Dual union all
      5            Select 'James Smith' Name From Dual union all
      6            Select 'Tina Adams' Name From Dual union all
      7            Select 'Blair Witch' Name From Dual)
      8  SELECT Substr(Name,1,Instr(Name,' ',1)-1) First
      9       , Substr(Name,  Instr(Name,' ',1)+1) LastName
    10    FROM t;
    FIRST                                        LASTNAME
    Peter                                        Andre
    James                                        Dean
    Watch                                        Man
    Jenna                                        Klare
    James                                        Smith
    Tina                                         Adams
    Blair                                        Witch
    7 rows selectedRegards,
    Christian Balz
    Edited by: Christian Balz on 17/06/2009 15:33

  • How to refresh a JTable of a class from another thread class?

    there is an application, in server side ,there are four classes, one is a class called face class that create an JInternalFrame and on it screen a JTable, another is a class the a thread ,which accept socket from client, when it accept the client socket, it deal the data and insert into db,then notify the face class to refresh the JTable,but in the thread class I used JTable's revalidate() and updateUI() method, the JTable does not refresh ,how should i do, pls give me help ,thank you very much
    1,first file is a class that create a JInternalFrame,and on it there is a table
    public class OutFace{
    public JInternalFrame createOutFace(){
    JInternalFrame jf = new JInternalFram();
    TableModel tm = new MyTableModel();
    JTable jt = new JTable(tm);
    JScrollPane jsp = new JScrollPane();
    jsp.add(jt);
    jf.getContentPane().add(jsp);
    return jf;
    2,the second file is the main face ,there is a button,when press the button,screen the JInternalFrame. there is also a thread is beggining started .
    public class MainFace extends JFrame implements ActionListener,Runnable{
    JButton jb = new JButton("create JInternalFrame");
    jb.addActionListener(this);
    JFrame fram = new JFrame();
    public void performance(ActionEvent e){
    JInternalFrame jif = new OutFace().createOutFace(); frame.getContentPane().add(JInternalFrame,BorderLayout.CENTER);
    public static void main(String[] args){
    frame.getContentPane().add(jb,BorderLayout.NORTH);
    frame.pack();
    frame.setVisible(true);
    ServerSokct ss = new ServerSocket(10000);
    Socket skt = ss.accept()'
    new ServerThread(skt).start();
    3.the third file is a thread class, there is a serversoket ,and accept the client side data,and want to refresh the JTable of the JInternalFrame
    public class ServerThread extends Thread{
    private skt;
    public ServerThread(Sokcet skt){
    this.skt = skt;
    public void run(){
    OutputObjectStream oos = null;
    InputObjectStream ios = null;
    try{
    Boolean flag = flag;
    //here i want to refresh the JTable,how to write??
    catch(){}
    4.second is the TableModel
    public class MyTableModel{
    public TableModel createTableModel(){
    String[][] data = getData();
    TableModel tm = AbstractTableModel(
    return tm;
    public String[][] getData(){
    }

    Use the "code" formatting tags when posting code.
    Read this article on [url http://www.physci.org/codes/sscce.jsp]Creating a Simple Demo Program before posting any more code.
    Here is an example that updates a table from another thread:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=435487

  • Update column in one table from another

    I've got two tables:
    t1:
    con_num
    con_code
    ex
    elin
    addressee
    a few other columns
    t2:
    con_num
    con_code
    elin
    addressee
    contact
    a few other columns
    I just got about 300 rows into t2 using sqlloader, and now I need to use t2 to update t1. t1 will have 3 rows per ex||elin, but t2 can have more or less rows per elin (which is the same as ex||elin in t1). If t2 has 4 rows per one elin, then that is 4 distinct pieces of data, and I need to make sure that t1 reflects 4 rows in its ex||elin, each containing the addressee||contact from t2. So I'll need to add a row to t1, as well as update 3 rows. Is this possible with just SQL, or do I need to write PL/SQL?
    The following is the code I've been trying:
    update t1
    set t1.addressee =
    (select addressee from t2
    where t2.con_num = 'number'
    and t1.con_code = t2.con_code
    and t1.ex ||t1.elin_num = t2.elin_num)
    This code is not correct, it returns more than one row from t2. Also, I'd need to concatenate contact onto addressee with a space in the middle, not just addressee, into t1.addressee.
    Any ideas, pointers?
    Thanks!

    Forgot some info: Ora8.1.5 on win2kpro. Also, I was wanting to combine addressee||contact in the insert/update statement to differentiate one addressee from another in t1 after the data is inserted. We can have several addressees that are the same, but each one goes to a different contact for each record.
    Thanks!

  • How to update date in a table from another database

    Hello,
    I am trying to code a way to Update my Testing database from another database. In the coding below the database that has the updated data ends in Restore.
    Use ClientDB_MASTER_Restore
    Truncate Table ClientDB_MASTER_Testing.dbo.Activity_Tracking_AZ
    GO
    SELECT * INTO ClientDB_Master_Testing.dbo.Activity_Tracking_AZ
    FROM Activity_Tracking_AZ
    Go
    I know with this Technique the table must be truncated if not deleted first.  There is probably a better way to do this which I'm very open to.  I'm also looking for coding that will roll back any changes made should an error occur.
      As always, any help is greatly appreciated.
    David92595

    USE ClientDB_MASTER_Testing
    go
    SET XACT_ABORT ON
    BEGIN TRANSACTION
    Truncate Table dbo.Activity_Tracking_AZ
    -- SET IDENTITY_INSERT dbo.Activity_Tracking_AZ ON
    INSERT dbo.Activity_Tracking_AZ (col1, col2, ...)
    SELECT col1, col2,
    FROM ClientDB_MASTER_Restore.dbo.Activity_Tracking_AZ
    -- SET IDENTITY_INSERT dbo.Activity_Tracking_AZ OFF
    COMMIT TRANSACTION
    If you find it boring to type the column lists, just find the table in Object Explorer, and drag the columns node to where you want the column list.
    You need the SET IDENTITY_INSERT command if the table has an IDENTITY column.
    By wrapping the code in a transaction, you are not left with an empty table if the INSERT fails. The command SET XACT_ABORT ON makes sure that the batch is aborted and rolled back in case of an error.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to update a table (CUSTOMER) on a Report Server with the data from the same table (CUSTOMER) from another server Transaction server?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) From another server ex: Transaction server?
    Set up steps so inset, update or delete operation takes place across the servers.
    It would be great if someone please enlighten me in details about this process in MS SQL Server 2008 R2.
    Also please describe would it be different for SQL Server 2012?
    If so, then what are the steps?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) from another server ex: Transaction server?
    Set up steps so that inset, update or delete operation gets done correctly across servers.
    I was not sure about the answer, it would be great if someone please put some light on this and explain in details about this process in MS SQL Server 2008 R2.
    Also it would be very helpful if you please describe would it be different for SQL Server 2012? If so, then what are the steps?

  • Since I updated my iPhone 4s to iOS 6 all messages that are sent to my phone from another iPhone user get sent to my daughters iPhone as well. And I can text her but she cannot text me.

    What is going on??? Since I updated my iPhone 4s to iOS 6 all messages that are sent to my phone from another iPhone user also get sent to my daughters iPhone 4. And she can receive my text but cannot reply to me.

    chrisfromgastonia wrote:
    You are on the same apple id. You will need to each have your own apple id. Sign out of imessages and create your own or her own apple id and sign in again using your own apple id's
    100% NOT TRUE....    You can change the settings to fit your requirements...

Maybe you are looking for