Updating a JTable using CachedRowSet data

Hello, I would like to know how I can update my already created JTable receiving data from a CachedRowSet without creating a new table model (this is the method I have been using). I have read about using the fireTableDataChanged() method but I cant figure out how to use this works. Maybe an explanation on how the information in the CachedRowSet is updated in the JTable when notifiers are used will help.
Any help will be appreciated

camickr wrote:
table.setAutoCreateColumnsFromModel( false );
Perfect. This works well for my issue. I can now use the setModel() method without having the columns reordered.Damn camickr, that is a bloody good thing to know (it's often so much easier to recreate the table model, here's a very neat solution to one of the pitfalls)! Thanks :)
Since this is solved, I still want to know how I can use the fireTableDataChanged() method and AbstractTableModel interface with CachedRowSet (just out of curiosity). I have been looking through jduprez's suggestion to figure this out too. I am currently faced with the issue,
I have two classes, one for the CachedRowSet and the other with the table implementationsAs you describe it, I don't think that's a good approach: what I meant wad an implementation of TableModel , not a subclass of JTable : the stock JTable already knows how to work with any model implementation, as long as it implements TableModel .
Where do I need to use the AbstractTableModel interface?It is a class, not an interface: it implements TableModel and provides useful defaults for some methods (at least, the management of the list of TableModelListener )
My suggestion was that you define a custom class that extends AbstractTableModel , and uses its fireXxx judiciously.
here is an example:
public class RowSetAwareTableModel extends AbstractTableModel {
    public void setUpdateddata(RowSet newData) {
        this rowSet = newdata;
        super.fireTabledataChanged();
    /** Implementation of TableModel */
    public int getRowCount() {
        return rowset.getMaxRows();
    // etc...
}

Similar Messages

  • Updating a JTable using a JTable

    I am looking to update an empty JTable using the data from a JTable containing a set of data.
    I am aware that addRow can be used with the DefaultTableModel from previous discussions on this forum, but I have found this call isn't available when using AbstractTableModel.
    The reason I have been having some problems with this as it is necessary for the AbstractTableModel to be used in the context of the GUI, and I am asking if there is a way to solve this using the AbstractTableModel?
    I am using an AbstractTableModel for both the data table and the table showing all currently and previously selected rows.

    I am using an AbstractTableModel for both the data table and the table showing all currently and previously selected rows.No you aren't. You can't create an Abstract class because not all the methods are implements. You are using a class that extends AbstractTableModel.
    So why not use the DefaultTableModel and make your life simple?

  • How do i update a JTable with new data?

    Hey
    I have a JTable where the data of some football players are shown. Name, club, matches and goals. What i want is to change the data in
    the JTable when i click a button. For example each team in a league has its own button, so when i click the teams button, JTable has
    data of that teams players.
    Here is the code i have atm, there isnt anything on how to change the data, because i dont know where to start, plz point me in somekind of direction:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package test;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JMenuBar;
    import javax.swing.ImageIcon;
    import javax.swing.JTable;
    import javax.swing.JButton;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    * @author Jesper
    public class Main extends JFrame implements ActionListener {
        private Players players;
        private JTextArea output;
        private JScrollPane scrollPane2;
        private JButton button1, button2;
        private String newline = "\n";
        private int club = 1;
        public Main(){
            players = new Players();
        public JMenuBar createMenuBar(){
            JMenuBar menuBar = new JMenuBar();
            JMenu menu = new JMenu("File");
            menu.setMnemonic(KeyEvent.VK_A);
            menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
            menuBar.add(menu);
            // add menuitems/buttons
            JMenuItem menuItemNew   = new JMenuItem("new");
            menuItemNew.setActionCommand("1");
            menuItemNew.addActionListener(this);       
            JMenuItem menuItemOpen   = new JMenuItem("Open");
            JMenuItem menuItemQuit   = new JMenuItem("Quit");
            menuItemQuit.setActionCommand("2");
            menuItemQuit.addActionListener(this);
            // add to menu
            menu.add(menuItemNew);
            menu.add(menuItemOpen);
            menu.add(menuItemQuit);
            return menuBar;
        public void actionPerformed(ActionEvent e){
            String s;
            if ("Silkeborg IF".equals(e.getActionCommand())){
                club = 1;
                s = e.getActionCommand();
                output.append(s + newline);
                button1.setEnabled(false);
                button2.setEnabled(true);
            } else{
                club = 2;
                s = e.getActionCommand();
                output.append(s + newline);
                button1.setEnabled(true);
                button2.setEnabled(false);
        //Quit the application.
        protected void quit() {
            System.exit(0);
        public Container createContent(){
            JPanel contentPane = new JPanel(new GridLayout(3,1));
            ImageIcon icon = createImageIcon("middle.gif", "a pretty but meaningless splat");
            JTable table = new JTable(players.showPlayers(club));
            //Create the first label.
            button1 = new JButton("Silkeborg IF");
            button1.setToolTipText("Klik her for at se Silkeborg IF");
            button1.addActionListener(this);
            button1.setActionCommand("Silkeborg IF");
            //Create the second label.
            button2 = new JButton("FC Midtjylland");
            button2.setToolTipText("Klik her for at se FC Midtjylland");
            button2.addActionListener(this);
            button2.setActionCommand("FC Midtjylland");
            //Create a scrolled text area.
            output = new JTextArea(5, 30);
            output.setEditable(false);
            scrollPane2 = new JScrollPane(output);
            //Add stuff to contentPane.
            contentPane.add(button1);
            contentPane.add(button2);
            contentPane.add(table);
            contentPane.add(scrollPane2, BorderLayout.CENTER);
            return contentPane;
        protected static ImageIcon createImageIcon(String path,
                                                   String description) {
            java.net.URL imgURL = Main.class.getResource(path);
            if (imgURL != null) {
                return new ImageIcon(imgURL, description);
            } else {
                System.err.println("Couldn't find file: " + path);
                return null;
        public static void createGUI(){
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Main main = new Main();
            frame.setJMenuBar(main.createMenuBar());
            frame.setContentPane(main.createContent());
            frame.setSize(500, 500);
            frame.setVisible(true);
         * @param args the command line arguments
        public static void main(String[] args) {
            createGUI();
    }

    ooohh sorry... i posted the wrong code :S
    Here is the correct code:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package test;
    import java.util.HashMap;
    import java.util.Set;
    import javax.swing.table.*;
    * @author Jesper
    public class Players {
        HashMap<Player, Stats> players;
        public Players(){
            players = new HashMap<Player, Stats>();
            addPlayer();
        public void addPlayer(){
            //Silkeborg IF
            players.put(new Player("Martin ?rnskov", 1), new Stats(19, 3, 1));
            players.put(new Player("Thomas Raun", 1), new Stats(23, 6, 0));
            players.put(new Player("Jimmy Mayasi", 1), new Stats(26, 26, 3));
            players.put(new Player("Lasse J?rgensen", 1), new Stats(33, 0, 0));
            //FC Midtjylland
            players.put(new Player("Frank Kristensen", 2), new Stats(19, 3, 1));
            players.put(new Player("Thomas R?ll", 2), new Stats(23, 6, 0));
            players.put(new Player("Simon Poulsen", 2), new Stats(26, 26, 3));
            players.put(new Player("Magnus Troels", 2), new Stats(33, 0, 0));
        public DefaultTableModel showPlayers(int club){
            String[] columNames = {"Spiller", "Klub", "Kampe", "M?l", "R?de kort"};
            //Object[][] data = {{"Martin ?rnskov", 19, 3, 1}, {"Thomas Raun", 23, 6, 0}};
            Set<Player> keys = players.keySet();
            Object[][] data = new Object[keys.size()][columNames.length];
            int i = 0;
            for(Player player : keys){
               if(player.getClub() == club){
                   data[0] = player.getName();
    data[i][1] = player.getClub();
    data[i][2] = players.get(player).getMatches();
    data[i][3] = players.get(player).getGoals();
    data[i][4] = players.get(player).getRedCards();
    i++;
    DefaultTableModel table = new DefaultTableModel(data, columNames);
    return table;

  • Unable to update a field using the Data tab on a VIEW

    When viewing data using a VIEW instead of going to the table directly, am unable to change the values in any of the fields
    When I click on the list of VIEWs for a schema, then select a view that is based on a SELECT statement for a single table with a Primary key, and then click on the DATA tab to modify the value in one of the fields, SQL Developer does not allow me to change the value.
    Went into SQL Plus, and was able to execute an UPDATE statement against the same row of that VIEW, and update that field ("UPDATE vw_mytable SET thisfield = 'YES' WHEN row_id_number = 1'").
    Does SQL Developer not allow updating tables through a VIEW?
    Will it allow updating in the future? Please say yes.
    Oracle 10g DB and latest version of SQL Developer.

    Remember to add feature requests and vote on them on the SQL Developer Exchange!
    <br>
    <p>We have added updateable views to 1.1, but do remember, not all views are updateable - even in SQL*Plus.</p>
    <br>
    Sue

  • Updating a JTable when using an AbstractTableModel

    Hi,
    I have tried to create a JTable with an AbstractTableModel but I am obviously missing something in all the tutorials and examples as I cannot get the table to update when using my model.
    My application reads data in from a CSV file that is selectable at run time, but I have written a small app that demonstrates the problem I am having.
    If you uncomment the DefaultTableModel lines of code all is OK, but I need to use my Abstract Class as I intend to colour certain rows and add a Boolean column, that I would like to display as a CheckBox and not just the String representation.
    Any help would be great as I am tearing my hair out here!!
    My Test Class
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.util.*;
    public class TestTable extends JFrame implements ActionListener
    private JPanel jpTestTable = new JPanel();          
    private Vector vColumnNames = new Vector();
    private Vector vCellValues = new Vector();
    private DefaultTableModel dtmTestTable;
    private CustomTableModel ctmTestTable;
    private JTable jtTestTable;
    private JScrollPane jspTestTable;
    private JButton jbGo = new JButton();
         public TestTable()
         dtmTestTable = new DefaultTableModel();
         ctmTestTable = new CustomTableModel();
         //jtTestTable = new JTable( dtmTestTable );  //using this instead of my CustomModel works fine
         jtTestTable = new JTable( ctmTestTable );
         jtTestTable.setAutoCreateRowSorter(true);
         jtTestTable.setFillsViewportHeight( true );
         jspTestTable = new JScrollPane( jtTestTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
         jspTestTable.setBounds( 10, 10, 350, 400 );
         jspTestTable.setBorder( BorderFactory.createLoweredBevelBorder() );
         jbGo.setText( "Go" );
         jbGo.setBorder( BorderFactory.createRaisedBevelBorder() );
         jbGo.setBounds( 125, 430, 100, 25 );
         jbGo.addActionListener(this);
         jpTestTable.setLayout( null );
         jpTestTable.setBounds( 0, 0, 375, 500 );     
         jpTestTable.add( jspTestTable );
         jpTestTable.add( jbGo );
         this.setTitle( "Test Table" );
         this.getContentPane().setLayout( null );
         this.setBounds( 200, 50, 375, 500 );
         this.getContentPane().add( jpTestTable );
         this.setResizable( false );
         public void actionPerformed( ActionEvent e )
         updateTable();
         public void updateTable()
         vColumnNames.add( "Please" );
         vColumnNames.add( "work" );
         vColumnNames.add( "you" );
         vColumnNames.add( "git!" );
         vColumnNames.trimToSize();
         Vector vRow = new Vector();
              for( int i = 0; i < 10; i++ )
                   for( int x = 0; x < vColumnNames.size(); x++ )
                        vRow.add( "" + i + "" + x );
              vCellValues.add( vRow );
         //dtmTestTable.setDataVector( vCellValues, vColumnNames );  //using this instead of my CustomModel works fine
         ctmTestTable.setDataVector( vCellValues, vColumnNames );
         public void processWindowEvent(WindowEvent e)
         super.processWindowEvent(e);
              if(e.getID() == WindowEvent.WINDOW_CLOSING)
              exit();
         public void exit()
         System.exit( 0 );     
         public static void main(String args[])
         TestTable tt = new TestTable();
         tt.setVisible( true );
    }And my CustomTableModel Class
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.util.*;
    public class CustomTableModel extends AbstractTableModel
    protected Vector columnIdentifiers  = new Vector();
    protected Vector dataVector = new Vector();
         public CustomTableModel()
         public CustomTableModel( Vector data, Vector columnNames )
         setDataVector( data, columnNames );
         public int getColumnCount()
         return columnIdentifiers.size();
         public int getRowCount()
         return dataVector.size();
         public String getColumnName( int col )
         return "" + columnIdentifiers.get( col );
         public Object getValueAt( int row, int col )
         Vector vRow = new Vector();
         vRow = (Vector) dataVector.get( row );
         return (Object) vRow.get( col );
         public Class getColumnClass(int c)
         return getValueAt(0, c).getClass();
         public boolean isCellEditable(int row, int col)
              if (col < 2)
                   return false;
              else
                   return true;
         public void setValueAt( Object value, int row, int col )
         Vector vTemp = (Vector) dataVector.get( row );
         Vector<Object> vRow = new Vector<Object>();
              for( int i = 0; i < vTemp.size(); i++ )
                   vRow.add( (Object) vTemp.get( i ) );
         vRow.remove( col );
         vRow.add( col, value );
         vRow.trimToSize();     
         dataVector.remove( row );
         dataVector.add( row, vRow );
         dataVector.trimToSize();
         fireTableCellUpdated(row, col);
         public void setDataVector( Vector data, Vector columnNames )
         columnIdentifiers  = (Vector) columnNames.clone();
         dataVector = (Vector) data.clone();
         fireTableDataChanged();
    }I have just tried adding the following code after reading another example, but same result - arrrrrrrgggggggghhhhhhhhh!!!!
    ctmTestTable = (CustomTableModel) jtTestTable.getModel();
    ctmTestTable.fireTableDataChanged();Edited by: Mr_Bump180 on Jul 28, 2008 2:51 PM

    Hi camickr,
    Well that is good news as my Abstact class is about as much good as an ashtray on a motorbike. I think I must have misread or misunderstood the Table Tutorials as I thought I had to use an Abstrat class to get colurs based on conditions and to get Check Boxes to represent Boolean variables.
    I am clearly struggling with this concept - which I have never used before - do you know of any tutorials, that explain how to update a JTable with file data at runtime, as all the ones I have looked at set it as part of the java code - which is no good to me.
    Also am I overriding the DefaultTableModel Class correctly - I have written a seperate Model class but wounder if I need to include it in with my JTable class. I was trying to make it generic so I didn't have to write one for each JTable - but as I can't get it to work I should perhaps try to walk before I run.
    I'm not asking for the code, but just a guide to how close I am to where I want to be, and some links to tutorials that are closer to what I want to achieve. I will reread the Java Table Tutorial tonight - and you never know the penny may drop all on it's own this time!!!
    Thanks

  • Update a table using plsql procedure

    Can any one help me to write a plsql procedure to update a table with new records and changes;
    Table rtest1 contains following records:
    deptno(number) deptname(varchar2(10)
    10 EWP
    20 PWD
    30 EPF
    Table rtest2 contains follwing records:
    deptno(number) deptname(varchar2(10)
    10 prod
    40 ops
    how to write a plsql procedure to to update table rtest2 using rtest1 data .

    use a merge statement, like this:
    SQL> create table rtest1
      2  as
      3  select 10 deptno, 'EWP' deptname from dual union all
      4  select 20, 'PWD' from dual union all
      5  select 30, 'EPF' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table rtest2
      2  as
      3  select 10 deptno, 'prod' deptname from dual union all
      4  select 40, 'ops' from dual
      5  /
    Tabel is aangemaakt.
    SQL> create procedure my_merge
      2  is
      3  begin
      4    merge into rtest2 r2
      5    using (select deptno, deptname from rtest1) r1
      6       on (r2.deptno = r1.deptno)
      7     when matched then
      8          update set deptname = r1.deptname
      9     when not matched then
    10          insert (deptno,deptname) values (r1.deptno,r1.deptname)
    11    ;
    12  end;
    13  /
    Procedure is aangemaakt.
    SQL> exec my_merge
    PL/SQL-procedure is geslaagd.
    SQL> select * from rtest2 order by deptno
      2  /
                                    DEPTNO DEPT
                                        10 EWP
                                        20 PWD
                                        30 EPF
                                        40 ops
    4 rijen zijn geselecteerd.Regards,
    Rob.

  • I bought new i phone 5 3 days back, after that asked for new update which is 6.1.4, after updating my iphone i am not able to use cellular data services. I called up data provider, they says its the problem with new software update. There is no option add

    I bought new i phone 5 3 days back, after that asked for new update which is 6.1.4, after updating my iphone i am not able to use cellular data services. I called up data provider, they says its the problem with new software update. There is no option add APN. Now when i switch to safari its showing you are not subscribed for cellular data. But I am able to use data on other phone.
    Will you please help me in this regard?
    Another issue, since i bought my new iphone there is dust inside back main camera.
    Your advises are highly appreciated.

    Hey Shaiju isac,
    I'd take a look at the following article, it'll guide you though steps to you troubleshoot cellular data issues on your iPhone:
    iPhone: Troubleshooting a cellular data connection
    http://support.apple.com/kb/ts3780
    Cheers,
    David

  • HT1688 iPhone 5S, Settings Cellular Use Cellular Data For Apps - Not Updating

    I have iPhone 5S iOS 7.0.4 with AT&T Contractual Plan.
    When I change any settings in Settings > Cellular > Use Cellular Data For to disable or enable apps to use cellular data. And, if I exit and enter again it shows the old settings.
    Also Call Time > Current Period is not updating.
    This is happening for last one week. I have also noticed heavy cellular data usage for last one week.
    I have reset the phone as a new phone this it is solved, but if I restore from my backup, then the problem is returning again. Even I have deleted some apps, but it doesnot help.
    Please help me to solve this.

    Call AT&T - it seems they are forcing their own settings on you.

  • Use cellular data for iTunes Match & Radio but not app Updates

    Is there any way to set an iOS device so that it will allow using cellular data for iTunes Match and iTunes Radio but not downloading app Updates. I want to be able to set my wife's phone so that the apps are automatically updated over Wifi but she can then use iTunes Match and iTunes Radio when she is out. She only uses those in limited capacity so I am not too worried about her using up her data plan with those. However, app Downloads seems to be quite large, and they happened a lot recently when they all updated for iOS8.
    Thanks,
    Tony

    No, but you could turn off Updates under Automatic Downloads in Settings>iTunes & App Store, then update them manually when you're connected to wifi.

  • Can I use cellular data for updating ios 7.0.2 to 7.0.4 in iPhone 5

    Can I use cellular data for updating ios 7.0.2 to 7.0.4 in iPhone 5.  I just want to know coz i only have 3G cellular data ....

    No.

  • Becouse of expire of credit card I updated billing information by providing data of new credit card but system just says "We're sorry, the billing information on file could not be used for this payment. Please update your information.". What exactly is wr

    Becouse of expire of credit card I updated billing information by providing data of new credit card but system just says "We're sorry, the billing information on file could not be used for this payment. Please update your information.". What exactly is wrong?

    Are you 100% sure that every detail of your information is the same in each place?
    Make sure that EVERY DETAIL is the same in every place you enter your information
    -right down to how you spell and punctuate the parts of your name and address
    Change/Verify Account https://forums.adobe.com/thread/1465499 may help
    -Credit card https://helpx.adobe.com/utilities/credit-card.html

  • HT5815 The most important piece of info about an update I need is how much data does it require. I am travelling and using prepaid data. I cannot even consider an update until I know how much data it will use. Please provide this information.

    The most important piece of info about an update I need is how much data does it require. I am travelling and using prepaid data. I cannot even consider an update until I know how much data it will use. Please provide this information.

    http://www.apple.com/feedback/macosx.html

  • How to update list item using client object model without changing created/modified dates?

    Hello All,
    I want to update list item using the SharePoint Client Object
    Model without updating the created / modified date. Is it possible?
    Please help.
    Thanks.

    Using the SystemUpdate method should do the trick, according
    to its literature.
    Additionally, would something like this be of any use for you?  Taken from this
    Stack Exchange thread: -
    public static class SPListItemExtensions
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void Update(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.Update();
    finally
    rh.EnableEventFiring();
    else
    item.Update();
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="incrementListItemVersion"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool incrementListItemVersion, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate(incrementListItemVersion);
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate(incrementListItemVersion);
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate();
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate();
    private class SPItemEventReceiverHandling : SPItemEventReceiver
    public SPItemEventReceiverHandling() { }
    new public void DisableEventFiring()
    base.DisableEventFiring();
    new public void EnableEventFiring()
    base.EnableEventFiring();
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Dynamically update swf file in sharepoint using xml data

    Hi,
    I need some help/enlightenment on how to auto-update the swf file in sharepoint using xml data.
    I am encountering an error "Cannot access External Data" and pointing to adobe's Cross-domain policy file extension.
    My questions is:
    1. Where should the cross-domain file be copied? In the sharepoint webserver's root folder?
    Right now, we generate the swf file from xcelsius and manually upload them in the sharepoint. However, we wish to automate the data content of this file.
    Thanks for the help.
    Emerson

    GetFileByServerRelativeUrl.... since you're getting a FILE, you'll need a URL to a FILE (not just a library)... by SERVER relative URL, so you'll need to include the site collection path and such, not just the subsite relative URL.
    Now working fine....
    url: appweburl + "/_api/SP.AppContextSite(@target)/web/ GetFileByServerRelativeUrl('/sites/apps/Shared Documents/test.txt')/CheckOut()?@target='" + hostweburl + "'",
            method: "POST",
            data: metatdata,

  • I want to update the Custom table using the data available in ITAB.

    Hi,
    I want to updaste the Custom Table which is created by me (Ztable) using the data available in itab.(which i got from defferent standard tables)
    I want to update the custom table using the itab data How is it possible?
    Is any possible by using Modify ?
    DPK.

    example here
    modifying datbase table useing internal table
    advises before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
    MODIFY fkkvkp FROM TABLE lt_fkkvkp .
    and finally unlock the table
    example
    *To lock table for further operations
    constants: lc_tabname TYPE rstable-tabname VALUE 'FKKVKP' . "FKKVKP
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    tabname = lc_tabname
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    IF sy-subrc EQ 0.
    To fetch all the contract accounts for customers of the segment
    Households/SME.
    PERFORM fetch_contract_accounts using lc_tabname .
    ENDIF. " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
    MODIFY fkkvkp FROM TABLE lt_fkkvkp .
    *unlock the tbale
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    TABNAME = uc_tabname .

Maybe you are looking for