Problems in deleting relationship in PO13

Hi,
I am facing a problem when performing following steps. Please give you valuable comments regarding any solution.
Step1: sm30 Payroll Period & Year - Verified values
Step2: PO13 Clear position for Transfer , go to maintain position
In this step under Current Plan and a current period, I am selecting the Relationships option. Then I have selected Delete Infotypes. Then, Screen: Delete Relationships Delete
Error : Change for person xxxxxx extends too far into  past.
The Diagnosis is :
You are working with active integration between the PD and the HR Master
    Data Management. You must consider the effects of your transaction on  
    Human Resource master data.                                            
    The entries cannot be updated because, otherwise, it would be necessary
    to make changes for the specified personnel numbers, which date too far
    back into the payroll past.                                            
    The earliest retroactive accounting period for the payroll subunit to  
    which the person belongs is defined in T569V. The earliest personal    
    retroactive accounting date is read from infotype 0003. The more recent
    of these dates is determined.                                          
    Only changes which occurred AFTER this date can be carried out.
Please assist me regarding what steps need to be followed for resolution.
Regards,
Prasun Podder

Hi Akshay,
Thanks a lot. This is a good option. But in this situation, I will not be able to able to use the program RPUTRBK0 as the 'Earliest RA Date' should be prior to the 'Earliest Masterdata Change Date' which is different for different Pnr. No.
So, I am actually thinking of putting the Earliest RA Date as the Date of Joining of the employee and for this have to run the LSMW.
Any suggestion from your side is appreciated.
Thanks & Regards,
Prasun Podder

Similar Messages

  • Delete Relationships via API

    Can anyone tell me the correct method for deleting relationships within the repository using the API? It seems to me that deleting one end of a relationship would null-out the OTHER_RELATIONSHIP_END_REF value on the other end of the relationship and then the other end would have to be deleted separately but that doesn’t seem to be the case. I have tried to retrieve the other end after deleting the first end and gotten a NO_DATA_FOUND exception. However, if I do not delete the other end then Designer throws an exception regarding a null value in the TO_ENTITY_REFERENCE property of the end I attempted to delete. I have taken steps to ensure the entities on both ends of the relationship are checked-out prior to performing the delete but I do not seem to be able to come up with a combination of deletes that completely removes the relationship.
    Any help would be greatly appreciated.

    I think I've solved my own problem: deleting one end of the relationship causes the other end to be deleted automatically -- nice.

  • Wher is deleted relationship history log in ServiceManager production database?

    Hi,
    I`m trying to use ServiceManger production database directly to track changes of reassigned users.
    I`m able to get all relationship changes from EntityChangeLog, but those changes that represent "removed" user in history log (as seen in console on reassignment you have Remove for old assignee and Add for new one) do not have a matching record when
    searched by RelationshipId in the dbo.Relationships table. Although the last added user from the entire history of SR can be tracked via that table and that relationship (active one) has matching record in dbo.Relationships table
    It means that somewhere in the ServiceManager DB there is separate table for deleted relationships where I can find the ones that are in History referenced with action "Remove"
    Question - which table is it? Or the structure is different and I`m not getting something right?
    Egils Zonde from Technet

    directly accessing the SQL database is
    discouraged, and SDK or console access is always prefered. The structure is not intended to be human readable, and the results of any direct SQL read are sure to be unsupported.  it'll probably work great, but I wouldn't design a process
    around it, since it was never supposed to work in the first place no one will help you if it breaks.
    as Raymond Chen likes to say,
    It looks like you have half of a problem here, (i.e. you've already figured out that you need to cromulate the franbulator, now all you need to do is invent a method to cromlulate arbitrary franbulators). What is the real need? is this an auditing
    need, like need to provide a history of deleted relationships to external audit? Or do you need to react to a relationship being deleted, and building a history seemed like the first step?  

  • Hi, the problem of deleting files / videos seeds desktop to go into Terminal and then sudo rm-rf ~ /. Trash Pohangina the answers I've had e of someone in her forum but when I write procedures line in Terminal as the Krever my password and it can not writ

    Hi, the problem of deleting files / videos seeds desktop to go into Terminal and then sudo rm-rf ~ /. Trash Pohangina the answers I've had e of someone in her forum but when I write procedures line in Terminal as the Krever my password and it can not write anything there, I write but nothing comes and my problem is not löst.När I want to delete the movie / video image Frin desktop still arrive Finder wants to make changes.Type your password to allow this. But even that I type my password file / video is left I need help in an easier way or another set-even those on the terminal that I can not type my password to solve the problem Regards Toni

    If you want to preserve the data on the boot drive, you must try to back up now, before you do anything else.
    There are several ways to back up a Mac that isn't fully working. You need an external hard drive to hold the backup data.
    1. Boot from the Recovery partition or from a local Time Machine backup volume (option key at startup.) Launch Disk Utility and follow the instructions in this support article, under “Instructions for backing up to an external hard disk via Disk Utility.”
    2. If you have access to a working Mac, and both it and the non-working Mac have FireWire or Thunderbolt ports, boot the non-working Mac in target disk mode. Use the working Mac to copy the data to another drive. This technique won't work with USB, Ethernet, Wi-Fi, or Bluetooth.
    3. If the internal drive of the non-working Mac is user-replaceable, remove it and mount it in an external enclosure or drive dock. Use another Mac to copy the data.

  • Problem of Delete and Overwrite XLS file on Application Server

    Hi Experts,
         I want to transfer file on application server using below code and try to delete after successfully transfer on application file to other location.
    I have problem during deleting file and overwrite file.
    DATA: G_S_FILE TYPE EPSFILNAM,
          G_S_DIR  TYPE EPSDIRNAM,
          G_T_FILE TYPE EPSFILNAM,
          G_T_DIR  TYPE EPSDIRNAM.
    DATA : DELFILE(60).
      G_S_FILE = '1400000051.XLS'.
      G_S_DIR  = '\\Dev\PO\'.
      G_T_FILE = '1400000051.XLS'.
      G_T_DIR  = '\\Dev\PO\bkup'.
      DELFILE = '\\Dev\PO\1400000051.XLS'.
      CALL METHOD CL_CTS_LANGUAGE_FILE_IO=>COPY_FILES_LOCAL
        EXPORTING
          IM_SOURCE_FILE           = G_S_FILE
          IM_SOURCE_DIRECTORY      = G_S_DIR
          IM_TARGET_FILE           = G_T_FILE
          IM_TARGET_DIRECTORY      = G_T_DIR
          IM_OVERWRITE_MODE        = 'S'
        EXCEPTIONS
          OPEN_INPUT_FILE_FAILED   = 1
          OPEN_OUTPUT_FILE_FAILED  = 2
          WRITE_BLOCK_FAILED       = 3
          READ_BLOCK_FAILED        = 4
          CLOSE_OUTPUT_FILE_FAILED = 5
          OTHERS                   = 6.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      OPEN DATASET DELFILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF SY-SUBRC = 0.
        DELETE DATASET DELFILE.
      ELSE.
        WRITE / 'File not found'.
      ENDIF.
    Thanks,
    Himanshu Patel.

    Write a Java program using Apache POI that reads in a tab delimited file and outputs an xls file (in what they call Horrible Spread Sheet Format. Create your tab delimited file and then run your Java program using appropriate OS commands.
    Jelena Perfiljeva wrote:
    In all honesty, I find it hard to believe other application can't accept any other format. It's actually seems rather unreasonable to expect an ERP system to create a file in an outdated format of a desktop software. Even Excel itself can open many formats, so this just doesn't make any sense.
    This.
    Unless you can explain exactly why the destination must be xls and no other format is acceptable, I'm going to close the thread. What is this third party tool? Why can it only read the obsolete xls file format.
    I'm going through this thread and rejecting all the responses that attempt a solution that isn't xls.
    I'm surprised that the OP thought that simply saving with an xls file extension would cause some magic to happen and produce an actual Excel file.

  • Missing position and Org Unit relationship in PO13

    Hello SAP Pundits,
    I created a Position 1234 with transaction PPOM with Org Unit A and Job code X with start date 01/01/2009
    Now I hire an employee XYZ with this position X from start date 01/01/2009.
    When I go and see position X in PO13 it shows following relationships
    1)     Position 1234 - Org Unit A from 01/01/2009 to 31/12/9999
    2)     Position 1234 u2013 Job Code X from 01/01/2009 to 31/12/9999
    3)     Position 1234 u2013 Person XYZ from 01/01/2009 to 31/12/9999
    Perfect till now.
    Now if I change the Org Unit of the Position 1234 from A to B from date 01/04/2009 using PO13.
    A new record is created in IT0001 with start date 01/04/2009 and previous record is delimited.
    But now if I check the relationships in PO13 for position 1234 I donu2019t see the new record for Position 1234 and Org Unit B.
    However the previous relationship between position 1234 and Org Unit A is delimited till 31/03/2009.
    Why am I not able to see the assignment of Positon 1234 with new Org Unit B? Any reason why I am getting such an error?
    Thanks in advance.
    Regards,
    Ajay Hosur

    When you have changed the Position 1234 to org Unit  B from 01.04.2009 then the previous relationship will not show in po13, it goes into History which you can see in Complete Position Description..
    goto pp01 and select that position and create relationship with Org Unit B... am not sure why in Infotype 0001, previous record get delimited and new record got created..

  • Problem in delete folder

    Please don't refer me to the innumeras delete folder solutions available in the SDN. None of them has come to my help.
    I need to delete a folder. Well, codes are available everywhere, I run it, it successfully deletes the folder specified.
    But the requirement is, I need to make a zip of the folder, then I'll delete the original folder. I am pasting the code here. The zip part is working, the delete part is not! if you comment the line calling zip, it deletes the folder, but after zipping, it cannot delete.
    Is there some lock present? How to check and remove that? Please help.
    * Created on Jan 16, 2006
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    package com.ibm.eis.printapi;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintStream;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    * @author localusr
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    class PrintUtils {
         static String folderName = "EISMENU_bak";
         static String path = "c:\\samik";
         static String outFilename = "outfile.zip";
         public static void main(String args[]) throws IOException {
              File inFileName = new File(path + "\\" + folderName);
              //make the zip file
              makeZip(inFileName, path, outFilename);
              //Now, delete the directory
              File inFileName2 = new File(path + "\\" + folderName);
              inFileName2.renameTo(new File(path + "\\" + "aaa"));
              deleteDir(inFileName2);
         public static void makeZip(File inFile, String path, String outFile) throws IOException {
              File[] filenames = inFile.listFiles();
              byte b[] = new byte[512];
              ZipOutputStream out = null;
              try {
                   out = new ZipOutputStream(new FileOutputStream(path + "\\" + outFilename));
                   for (int i = 0; i < filenames.length; i++) {
                        if (filenames.isFile()) {
                             InputStream in = new FileInputStream(filenames[i]);
                             ZipEntry e = new ZipEntry(filenames[i].toString().replace(File.separatorChar, '/'));
                             out.putNextEntry(e);
                             int len = 0;
                             while ((len = in.read(b)) != -1) {
                                  out.write(b, 0, len);
                             print(e);
              } catch (IOException ioe) {
                        ioe.printStackTrace();
              } finally {
                   out.close();
                   out = null;
                   filenames = null;
                   b = null;
         public static void print(ZipEntry e) {
              PrintStream sop = System.out;
              sop.print("added " + e.getName());
              if (e.getMethod() == ZipEntry.DEFLATED) {
                   long size = e.getSize();
                   if (size > 0) {
                        long csize = e.getCompressedSize();
                        long ratio = ((size - csize) * 100) / size;
                        sop.println(" (deflated " + ratio + "%)");
                   } else {
                        sop.println(" (deflated 0%)");
              } else {
                   sop.println(" (stored 0%)");
         public static boolean deleteDir(File dir) {
              boolean deleted = false;
              try {
                   if (dir.isDirectory()) {
                        String[] children = dir.list();
                        for (int i = 0; i < children.length; i++) {
                             boolean success = deleteDir(new File(dir, children[i]));
                             if (!success) {
                                  deleted = false;
                             } else {
                                  deleted=true;
                   // The directory is now empty so delete it
                   //System.out.println(dir.canRead())
                   deleted = dir.delete();
              } catch (Exception e) {
                   System.out.println("error: " + e);
              return deleted;

    Thanks it worked.
    The problem was, the folder I was trying to delete had .classpath, .project, .websettings files. It was encountering problem to delete these files because it internally also uses files of same name.
    May be that was the reason.
    I tried with any other folder, it worked.

  • Problem in Delete Time Quota Compensation

    Hi,
    There is a problem in Infotype- 416 (Time Quota Compensation) with subtype - Workmen SL Encashment.
    When I click on delete button, it goes in nexr screen - Delete Time Quota Compensation. From here, in Absence quotas, i want to delete 1 line item.
    There is a one problem in deleting this.. system shows the message Change before earliest retro. date 01.04.2009 acc. to control rec. to py area WK.
    Please let me know, what it is???
    Regards..

    What is the beginning date of the infotype record you are trying to delete?
    Please delete the payroll control record and re-create (by checking my prev message) so that the payroll period and retro period are in line with the start date of the IT.
    e.g. if IT record is 01.01.2009 - 31.12.2009 --> So create the payroll record for 01.2009 period and 01.2009 retro period. Make sure status is Rel for correction.
    As the infotype you're trying to delete belongs to a prior payroll period, control record acts as a shield to changes on this data since it is already used for a prior payroll calculation.
    Dilek

  • Problem in delete adjecent duplicates

    Hi All,
    i have a problem in delete adjacent duplicate in an internal table .
    when  i use it i want that the records which are getting doubled to be removed
    but i also want that if the value in that field is empty for which i am comparing , to be ignored means i dont want the records
    to be deleted in which the field value is empty for which i am comparing.
    snippet of my code
    delete ADJACENT DUPLICATES FROM xkomv COMPARING KSCHL.
    so if theere is no value in KSCHL THAT RECORD NOT TO BE DELETED .
    waiting for your reply..
    Thanks in advance

    Try the following,
    "delete ADJACENT DUPLICATES FROM xkomv COMPARING KSCHL.
    Before using the above statement do the following,
    u201C decalare a temporary table for u2018xkomvu2019 say u2018t_xkomvu2019, and copy the data.
    Refresh t_xkomv[].
    t_xkomv[] = xkomv[].
    Delete t_xkomv where KSCHL <> u2018  u2018.
    Delete xkomv where KSCHL =  u2018  u2018.
    u201C Sort xkomv and then use delete adjacent duplicates.
    And after this append data from t_xkomv to xkomv.
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • Problem in deleting a member

    <p>Hi All<br>I have this problem in deletion of a member.<br>When I try to delete the member, i get an error saying that it isused in the form.<br>I checked the form and see this member is not attached to thatform.<br>please suggest to tackle this problem.<br>thanks in advance.<br></p>

    Hi guys Just a quick question, we use a relational database for metadata of planning. if that is the case than what does essbase has to do with planning? That thing is bothering me alot guys. I have a nice document on planning but I dont know the answer for this. Can somebody plz explain it to me I would really appreciate your effort guys, Thanks a million in advance.

  • Problem in deleting the message after reading

    Hi
    I m having some problem to delete the message after reading.
    i read the FAQ, and there is only one question regarding to delete that i have tried but its not working
    As my application required that message should be deleted after the processing.
    Please help me out asap
    Thank in advance.

    now here is the protocol trace from starting to the end point
    with the settings of
    session.setDebug(true);
    and
    folder.close(true);
    POP3: connecting to host "172.xx.xx.xx", port 110
    S: +OK Microsoft Exchange Server 2003 POP3 server version 6.5.6944.0 (xxxxx.xyz.com) ready.
    C: USER test1
    S: +OK
    C: PASS Password
    S: +OK User successfully logged on.
    C: STAT
    S: +OK 1 548
    Total messages = 1
    New messages = 0
    ================================
    C: TOP 1 0
    S: +OK
    Received: from yyyyyy ([172.xx.xx.xx]) by xxxxx.xyz.com with Microsoft SMTPSVC(6.0.3790.3959);
         Thu, 11 Sep 2008 12:21:14 +0530
    Message-ID: <3373112.1221115884647.JavaMail.284528@yyyyyy>
    From: [email protected]
    To: [email protected]
    Subject: testing
    Mime-Version: 1.0
    Content-Type: text/plain
    Content-Transfer-Encoding: 7bit
    Return-Path: [email protected]
    X-OriginalArrivalTime: 11 Sep 2008 06:51:14.0500 (UTC) FILETIME=[C8892840:01C913DA]
    Date: 11 Sep 2008 12:21:14 +0530
    C: LIST 1
    S: +OK 1 548
    ------------STARTING LINE------------
    MESSAGE #1:
    From: [email protected]
    To: [email protected]
    Subject: testing
    SendDate: Thu Sep 11 12:21:14 IST 2008
    CONTENT-TYPE: text/plain
    This is plain text
    ------------TEXT------------
    C: RETR 1
    S: +OK
    Received: from yyyyyy ([172.xx.xx.xx]) by xxxxx.xyz.com with Microsoft SMTPSVC(6.0.3790.3959);
         Thu, 11 Sep 2008 12:21:14 +0530
    Message-ID: <3373112.1221115884647.JavaMail.284528@yyyyyy>
    From: [email protected]
    To: [email protected]
    Subject: testing
    Mime-Version: 1.0
    Content-Type: text/plain
    Content-Transfer-Encoding: 7bit
    Return-Path: [email protected]
    X-OriginalArrivalTime: 11 Sep 2008 06:51:14.0500 (UTC) FILETIME=[C8892840:01C913DA]
    Date: 11 Sep 2008 12:21:14 +0530
    ------------TEXT------------
    ******************MESSAGE ENDING LINE*****************
    C: QUIT
    S: +OK Microsoft Exchange Server 2003 POP3 server version 6.5.6944.0 signing off.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Problem in deleting the orders under Custom category.

    Hi friends,
            I am facing some problem in deleting the Orders which were created under custom category. In fact we are creating Intransits under Standard category "EI" as well as Custom Category "ZP". I am able to modify the intransits created under "EI" but when I tried to change or delete the orders created under Category "ZP", I am getting a messag triggered by BAPI as " Order can not be changed". atleast I need to delete the order if change is not possible. I am using the BAPI "BAPI_SLSRVAPS_CREATEINTRANS" to create intransits under "EI" and i am using the same BAPI with BADI implementation to "SAPAPO_DM_PO_CHANGE" to create intransits under "ZP". Based on the condition I am changing the am changing the category from EI  to ZP in the BADI.
           I am able to change or delete the orders created under the EI but when I tried to change or delete the orders under ZP its giving me a message as Order can not be changed.
           One more thing is If I go to Tcode /SAPAPO/RLCDEL trying to delete all the orders based on category. I am able to see all the orders under created under EI. If  I tried to delete the orders based on Custom category ZI it is giving me the message  as "No Orders exists in Live cache". But I am able to see the orders in tcode "SAPAPO/RRP3".
           Can any one help me out in making this done. Please help me out in this.
    Thanks & Regards,
    Ramana.

    Hi Visu,
               I really appreciate your gr8 help. Hope you can understand my problem that I am not a SCM person. Still you are responding to my questions with great patience.
               Here what I found is I found the record in OM19 transaction in the object "/SAPAPO/OM_ORDER_EXT_STR". But the interesting is its giving me the GUID as blank . there is empty value in that field. where as the program "/SAPAPO/OM_DELETE_INCON_ORDERS" is asking for the "order GUID".
             can you help me out in finding the order guid and deleting this order.
    Regards,
    Ramana.

  • Problem in deletion of data from DSO

    Hi All,
    We are facing a problem in deleting data from Data Store Object.I am trying to delete data by using right click option on DSO -->Delete Data.It is saying "The system has not finished loading request no : XYZ".
    I have tried to trace that request and found that request is running in background and the related process chain was deleted.Also no jobs of that request are available.
    Now i want to delete one field from that particular DSO and it is not allowing because we are unable to delete data.Actually no data is present in Active table but we have data in Change Log table which we are unable to delete.
    Thanks in Advance.
    Regards,
    Jaya.

    Hi,
    Any way u r deleted that processchain if it is there u can kill that job through process chain by killing that job,if it is not possible
    u should ask ur BASIS people in SM50 or SMICM tcode we can kill our job but ask the basis people.
    once u deleted that then delete the data in hange log then (other once the data is there through that DTP it will not allow u to delete so u delete the data) then go for deleting that DTP also.
    Thanks & regards
    sathsih

  • Problems to delete big *.tif files

    I have problems to delete big *.tif filese.
    At first Windows delete it, but if i pressed F5 then the files are not deleted. I have tryed to delete it with and without Shift + Del its always the same.
    When i delete this file many times then it would be deleted.
    A other Problem with this big files is that windows open a dialogbox and calculate the time that needed to delete the tif file.
    But i can wait 2 hours and more, nothing is done by windows. In the dialogbox dosn`t change anything.
    Have anyone an Idea?
    Thank you in advanced.
    Daniel

    Hi,
    Does it happen to other files, just *.tif files? Generally speaking, When deleting a folder, the calculation time depends on not only the
    file size but the file numbers of the folder. So you can delete sub-folders separately.
    Also, you can try to use a popular methods to fix the issue. Here is the steps:
       1.  Right click on the file. 
       2.  Click Properties
       3.  Click
    Advanced
       4.  Under File Attributes uncheck
    Allow this file to have contents indexed in addition to file.
    Also, you can take the following steps to fix this issue:
    Step 1:
    You may try creating a new user profile to see if the same problem occurs. If not then it could be a corruption/permissions problem
    of the old user profile.
    To create a new user account
    http://windows.microsoft.com/en-us/Windows7/Create-a-user-account
    Step 2:
    If the new user account works fine then the previous account was corrupt, you may follow the link given below to fix the corrupt
    user profile.
    Fix a corrupted user profile
    http://windows.microsoft.com/en-US/Windows7/Fix-a-corrupted-user-profile
    In addition, the issue can be related to third-party components, especially file system filter drivers, such as anti-virus drivers. In this situation,
    I suggest you can delete the files on Safe Mode. If on Safe Mode It works fine, you could perform
    clean boot to check the result.
    Hope it helps.
    Regards,
    Alex Zhao
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Problem of deletion of rows in jtable, table refreshing too

    Hi,
    I have a table with empty rows in the beginning with some custom properties( columns have fixed width...), later user would be adding to the rows to this table and can delete, I've a problem while deleting the rows from table,
    When a selected row is deleted the model is also deleting the data but the table(view) is not refreshed.
    Actually i'm selecting a cell of a row, then hitting the delete button.
    So the model is deleting the information, but i'm not able to c the fresh data in table( especially when the last cell of last row is selectd and hit the delete button, i am getting lots of exception)
    Kindly copy the below code and execute it, and let me know,
    * AuditPanel.java
    * Created on August 30, 2002, 3:05 AM
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.util.Vector;
    * @author yaman
    public class AuditPanel extends javax.swing.JPanel {
    // These are the combobox values
    private String[] acceptenceOptions;
    private Vector colNames;
    private Color rowSelectionBackground = Color.yellow;
    private int rowHeight = 20;
    private int column0Width =70;
    private int column1Width =96;
    private int column2Width =327;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    /** Creates new form AuditPanel */
    public AuditPanel() {
    public void renderPanel(){
    initComponents();
    public String[] getAcceptenceOptions(){
    return acceptenceOptions;
    public void setAcceptenceOptions(String[] acceptenceOptions){
    this.acceptenceOptions = acceptenceOptions;
    public Vector getColumnNames(){
    return colNames;
    public void setColumnNames(Vector colNames){
    this.colNames = colNames;
    public Vector getData(){
    Vector dataVector = new Vector();
    /*dataVector.add(null);
    dataVector.add(null);
    dataVector.add(null);
    return dataVector;
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    jPanel2 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jTable1 = new javax.swing.JTable();
    setLayout(new java.awt.GridBagLayout());
    setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
    jPanel2.setLayout(new java.awt.GridBagLayout());
    jPanel2.setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
    jButton1.setText("Add");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 8;
    gridBagConstraints.insets = new java.awt.Insets(0, 1, 5, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    jPanel2.add(jButton1, gridBagConstraints);
    jButton2.setText("Delete");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    jPanel2.add(jButton2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    add(jPanel2, gridBagConstraints);
    jPanel1.setLayout(new java.awt.GridBagLayout());
    jPanel1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED, Color.black, Color.gray) );
    jTable1.setModel(new javax.swing.table.DefaultTableModel(getData(), getColumnNames()));
    // get all the columns and set the column required properties
    java.util.Enumeration enum = jTable1.getColumnModel().getColumns();
    while (enum.hasMoreElements()) {
    TableColumn column = (TableColumn)enum.nextElement();
    if( column.getModelIndex() == 0 ) {
    column.setPreferredWidth(column0Width);
    column.setCellEditor( new ValidateCellDataEditor(true) );
    if( column.getModelIndex() == 1) {
    column.setPreferredWidth(column1Width);
    column.setCellEditor(new AcceptenceComboBoxEditor(getAcceptenceOptions()));
    // If the cell should appear like a combobox in its
    // non-editing state, also set the combobox renderer
    //column.setCellRenderer(new AcceptenceComboBoxRenderer(getAcceptenceOptions()));
    if( column.getModelIndex() == 2 ) {
    column.setPreferredWidth(column2Width); // width of column
    column.setCellEditor( new ValidateCellDataEditor(false) );
    jScrollPane1 = new javax.swing.JScrollPane(jTable1);
    jScrollPane1.setPreferredSize(new java.awt.Dimension(480, 280));
    jTable1.setMinimumSize(new java.awt.Dimension(60, 70));
    //jTable1.setPreferredSize(new java.awt.Dimension(300, 70));
    //jScrollPane1.setViewportView(jTable1);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    jPanel1.add(jScrollPane1, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    add(jPanel1, gridBagConstraints);
    // set the row height
    jTable1.setRowHeight(rowHeight);
    // set selection color
    jTable1.setSelectionBackground(rowSelectionBackground);
    // set the single selection
    jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // avoid table header to resize/ rearrange
    jTable1.getTableHeader().setReorderingAllowed(false);
    jTable1.getTableHeader().setResizingAllowed(false);
    // Table header font
    jTable1.getTableHeader().setFont( new Font( jTable1.getFont().getName(),Font.BOLD,jTable1.getFont().getSize() ) );
    jButton1.setMnemonic(KeyEvent.VK_A);
    // action of add button
    jButton1.addActionListener( new ActionListener(){
    public void actionPerformed(ActionEvent actionEvent){
    // If a button press is the trigger to leave a JTable cell and save the data in model
    if(jTable1.isEditing() ){
    //System.out.println("table is edition ");
    String text=((javax.swing.text.JTextComponent)jTable1.getEditorComponent()).getText();
    jTable1.setValueAt(text,jTable1.getSelectedRow(),jTable1.getSelectedColumn()) ;
    jTable1.getCellEditor().cancelCellEditing();
    // find out total available rows
    int totalRows = jTable1.getRowCount();
    int cols = jTable1.getModel().getColumnCount();
    if( jTable1.getModel() instanceof DefaultTableModel ) {
    ((DefaultTableModel)jTable1.getModel()).addRow(new Object[cols]);
    int newRowCount = jTable1.getRowCount();
    // select the first row
    jTable1.getSelectionModel().setSelectionInterval(newRowCount-1,newRowCount-1);
    jButton2.setMnemonic(KeyEvent.VK_D);
    // action of Delete button
    jButton2.addActionListener( new ActionListener(){
    public void actionPerformed(ActionEvent actionEvent){
    int totalRows = jTable1.getRowCount();
    // If there are more than one row in table then delete it
    if( totalRows > 0){
    int selectedOption = JOptionPane.showConfirmDialog(null,"Are you sure you want to delete this audit row?","Coeus", JOptionPane.YES_NO_OPTION);
    // if Yes then selectedOption is 0
    // if No then selectedOption is 1
    if(0 == selectedOption ){
    // get the selected row
    int selectedRow = jTable1.getSelectedRow();
    System.out.println("Selected Row "+selectedRow);
    if( selectedRow != -1 ){
    DefaultTableModel dm= (DefaultTableModel)jTable1.getModel();
    java.util.Vector v1=dm.getDataVector();
    System.out.println("BEFOE "+v1);
    v1.remove(selectedRow);
    jTable1.removeRowSelectionInterval(selectedRow,selectedRow);
    System.out.println("After "+v1);
    }else{
    // show the error message
    JOptionPane.showMessageDialog(null, "Please Select an audit Row", "Coeus", JOptionPane.ERROR_MESSAGE);
    } // end of initcomponents
    class AcceptenceComboBoxRenderer extends JComboBox implements TableCellRenderer {
    public AcceptenceComboBoxRenderer(String[] items) {
    super(items);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    if (isSelected) {
    setForeground(table.getSelectionForeground());
    super.setBackground(rowSelectionBackground);
    } else {
    setForeground(table.getForeground());
    setBackground(table.getBackground());
    // Select the current value
    setSelectedItem(value);
    return this;
    class AcceptenceComboBoxEditor extends DefaultCellEditor {
    public AcceptenceComboBoxEditor(String[] items) {
    super(new JComboBox(items));
    } // end editor class
    public class ValidateCellDataEditor extends AbstractCellEditor implements TableCellEditor {
    // This is the component that will handle the editing of the
    // cell value
    JComponent component = new JTextField();
    boolean validate;
    public ValidateCellDataEditor(boolean validate){
    this.validate = validate;
    // This method is called when a cell value is edited by the user.
    public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int rowIndex, int vColIndex) {
    if (isSelected) {
    component.setBackground(rowSelectionBackground);
    // Configure the component with the specified value
    JTextField tfield =(JTextField)component;
    // if any vaidations to be done for this cell
    if(validate){
    //tfield.setDocument(new JTextFieldFilter(JTextFieldFilter.NUMERIC,4));
    tfield.setText( ((String)value));
    // Return the configured component
    return component;
    // This method is called when editing is completed.
    // It must return the new value to be stored in the cell.
    public Object getCellEditorValue() {
    return ((JTextField)component).getText();
    // This method is called just before the cell value
    // is saved. If the value is not valid, false should be returned.
    public boolean stopCellEditing() {
    String s = (String)getCellEditorValue();
    return super.stopCellEditing();
    public void itemStateChanged(ItemEvent e) {
    super.fireEditingStopped();
    }//end of ValidateCellDataEditor class
    public static void main(String args[]){
    JFrame frame = new JFrame();
    AuditPanel auditPanel = new AuditPanel();
    frame.getContentPane().add(auditPanel);
    auditPanel.setAcceptenceOptions(new String[]{"Accepted", "Rejected", "Requested"} );
    java.util.Vector colVector = new java.util.Vector();
    colVector.add("Fiscal Year");
    colVector.add("Audit Accepted");
    colVector.add("Comment" );
    auditPanel.setColumnNames( colVector);
    auditPanel.renderPanel();
    frame.pack();
    frame.show();

    Hi,
    I've got the solution for it. As when the cursor is in cell of
    a row and hit the delete button, the data in that cell is not saved,
    So i'm trying to save the data first into the model then firing the action event by doing this ..
    jButton2.addActionListener( new ActionListener(){       
    public void actionPerformed(ActionEvent actionEvent){           
    // If a button press is the trigger to leave a JTable cell and save the data in model
    if(jTable1.isEditing() ){                   
    String text=((javax.swing.text.JTextComponent)jTable1.getEditorComponent()).getText();
    jTable1.setValueAt(text,jTable1.getSelectedRow(),jTable1.getSelectedColumn()) ;
    jTable1.getCellEditor().cancelCellEditing();
    // HERE DO THE DELETE ROW OPERATION
    <yaman/>

Maybe you are looking for

  • Distiller 8 Error

    I have a .ps file that works perfectly fine in acrobat distiller 7 on Mac and Windows. When i try and take that same .ps file and distill it in Acrobat distiller 8 Mac and Windows it errors out. Any help appreciated. on windows the fix is adding /F t

  • Exception occurred within JTS

    Getting the following error message occanssionally while doing a commit operation in toplink. Exception [TOPLINK-7061] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ValidationException Exception Description: Exception occ

  • Alternative text/images.

    This is the current code I'm using in order to display an image instead of a flash file if it cannot be loaded within the browser. It works fine in IE, but when loaded in Firefox, the flash file is displayed above the standard image...is there a way

  • [solved]USB wont boot on some computers.

    Hi all. I have installed arch on a usb from a running arch system after doing pacman -S arch-install-scripts. It boots on my Acer Aspire One which picks it up as a USB-HDD however when I tried to boot it on a different computer it didn't work and fal

  • Returning library book early crashes ADE 3.0 in Win 8.1

    Every time I try to return a library book early using ADE 3.0, ADE crashes. The book is returned, but this is surely a bug in the product. Any fixes? -jackie jones