Problem related to locking the table

Hi all,
i am facing a problem while applying locks on the oracle table.my intention is stop the accessing of table to other users, if the table is locked by one user.
for this i wrote the code as follows
Class.forName("oracle.jdbc.driver.OracleDriver");       con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.2.123:1521:xe",         "root", "paridb");   con.setAutoCommit(false);             System.out.println("Successfully connected to " +           "Oracle server using TCP/IP..."); String lock="lock table report@xe in exclusive mode";-------------------------------------->1  query to lock the table Statement stmt1=con.createStatement(); stmt1.executeUpdate(lock); System.out.println("lock is applied"); Statement stmt=con.createStatement();                 for(int i=0;i<6;i++)         {         sql="insert into report values(1921682123,'device','host')";         stmt.executeUpdate(sql);         }
after locking i inserted some data into table, after insertion i am not commiting it because if i commit,the lock will be release.next i am trying to insert data into that table from another system,acutually the data don't insert.but data is inserted. how it is happening like that ??
in another scenario, if execute the locking query on the database directly then trying to insert into database through java application, at that time it is not giving permission to access table.
plz guide me
thanks&regards,
nagaraju

Hi! Thank you so much for your reply. Yes, I´m using ADF. I attach you the iterator´definition from the page definition:
<iterator id="MovimientosCtbView3Iterator" RangeSize="10"
Binds="MovimientosCtbView3" DataControl="AppModuleDataControl"/>
If I set the RangeSize to 11, the problem is solved, but my project manager want to find out why this situation happens with RangeSize=10.
Thank you so much and sorry for bothering you

Similar Messages

  • Locking the table

    Hi folks,
    I am new to using Numbers, or any spreadsheet for that matter, so I'm pretty baffled.
    I created a table to use in my lesson planning, as I found inserting a table into a Pages document didn't serve my purposes. The table looks great, but here's my problem:
    I created a large area in the middle of the page in which to type text by merging a whole whack of cells. I did this as it seemed like the best way to create a large area but still maintain the integrity of the format of the page. The problem, however, is that I have no clue how to lock the table - to set the table so that none of the cells change size when I insert text. I have been typing in the text, and the cell keeps expanding, and I have no idea why - I haven't reached the "end" of the cell so I'm not sure why it's not just staying the same size.
    I tried to read through the user guide, but I wasn't able to find what I'm looking for.
    Thanks folks,
    Shawn

    Shawn,
    Without knowing more about why you need a large text area in the middle of your table, it's a little difficult to suggest solutions. In general though, it's not a good idea to Merge Cells just for visual effect. Having affected all those rows and columns will cripple any future efforts to sort the table, or to add or delete rows and columns. You could Insert a Text Box and put your prose there. Position the text box anywhere you like - even over the middle of the table - without causing any future problems with the table.
    Generally we want table cells to expand when we run out of room while making input. I assume that you already have turned on the Wrap feature in the Cells Inspector so that you get more than one line in the cell. You can begin with an oversize cell by dragging the borders of the labels. Beyond that, with Wrap turned on, Numbers will (as you have noticed) accommodate all your input by expanding the height of the cell.
    Jerry

  • Lock Object (Not locking the table)

    Hi Guys
    I have a custom table ZDRAD same like standard table DRAD with an additional 'DATE' field . ZDRAD's Key fields are same like DRAD . I have created a lock object 'EZDRAD' where I put name = 'ZDRAD' (Custom table) and mode = 'EXCLUSIVE CUMULATIVE' . Now I want to lock the table(Whole table) before modifying/Inserting/deleting the records in se38. Please check the code below and suggest me if I am passing wrong values to the lock object Function module.
    Code
    TABLES : ZDRAD.
    CALL FUNCTION 'ENQUEUE_EZDRAD'
    EXPORTING
       MODE_ZDRAD           = 'E'
       MANDT                = SY-MANDT
       DOKAR                = ' '
       DOKNR                = ' '
       DOKVR                = ' '
       DOKTL                = ' '
       DOKOB                = ' '
       OBZAE                = 0
       OBJKY                = ' '
       X_DOKAR              = ' '
       X_DOKNR              = ' '
       X_DOKVR              = ' '
       X_DOKTL              = ' '
       X_DOKOB              = ' '
       X_OBZAE              = ' '
       X_OBJKY              = ' '
       _SCOPE               = '2'
       _WAIT                = 'X'
       _COLLECT             = ' '
    EXCEPTIONS
       FOREIGN_LOCK         = 1
       SYSTEM_FAILURE       = 2
       OTHERS               = 3
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    IF SY-SUBRC = 0.
    ZDRAD table is locked.
        P_L_LOCK_STAT = 'X'.
        EXIT.
      ELSE.
    ZDRAD table is not locked
        CLEAR P_L_LOCK_STAT .
      ENDIF.

    Hi Kanthimathi
    That is numeric field . Please suggest me how can i check the lock.

  • Lock the table by user with grant only for select

    Hallo.
    It is possible that the user has rights only for SELECT, do not lock the table? Now, where do "SELECT * FROM table FOR UPDATE", does not make the change, but it locks the entire table, and another user to get into it.
    Thanks

    And here is the "evidence" ;)
    SQL> select * from v$version ;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> create user u1 identified by u1 ;
    User created.
    SQL> grant connect to u1 ;
    Grant succeeded.
    SQL> connect hr/hr
    Connected.
    SQL> create or replace view v_t1 as select username, user_id, created from t1 group by username, use
    r_id, created with read only ;
    View created.
    SQL> grant select on v_t1 to u1 ;
    Grant succeeded.
    SQL> connect u1/u1
    Connected.
    SQL> select * from hr.v_t1 where rownum = 1 for update ;
    select * from hr.v_t1 where rownum = 1 for update
    ERROR at line 1:
    ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
    SQL> select * from hr.v_t1 where rownum = 1
      2  ;
    USERNAME                          USER_ID CREATED
    AK                                     36 08-MAY-00

  • Newby: locking the table on a SELECT?

    I have just downloaded SQL developer and have been using it to look at the back end of my work database, but it seems just as I started browsing through tables (by clicking on them in the tree explorer) people started getting kicked out of their front end applications. When I stopped, they stopped getting kicked out. Does my viewing a table lock that table? I have tried also through select tables, and I am not sure about whether it leaves the transaction open and locks the table, or not? Also, because of this I am unsure about the commit button (since it removes all the data when pressed). Can someone please enlighten me. thanks

    Along the same line as the database connection limit:
    If you are logged in as the same username as the other users, you could be hitting a limit on the username that you are logged in with.
    To find the limits specified for a user:
    SELECT * FROM sys.dba_profiles where resource_type != 'PASSWORD' AND profile in (select profile from all_users where username = :username) ORDER BY profile;
    The most likely value above to check is 'SESSIONS_PER_USER'
    There are other possibilities aside from specific user limits, so you may want to check with your dba to find out what you are running up against. The only other thing that I can think of is open cursor limits since I believe that viewing a table opens a cursor.
    Eric

  • Problems in WEB Dynpro The Table doesnt update

    Hi everyone, I did an WEB Dynpro Project and I created a table, and I wanna to fill that table  in the event doinit but it didnt update
    this is my code into a Controller methond
    public void llenaTabla( )
    IPublicVisualizarContrato.IProductDataElement prd = null;
        for(int i=0;i<5;i++)
          prd = wdContext.nodeProductData().createProductDataElement();
          prd.setProveedor("Provedor_"+i);
          prd.setAbasto("Abasto_"+i);
          prd.setAnual("Anual_"+i);
          prd.setConsigna("Consig_"+i);
          prd.setDistribucion("Dist_"+i);
          prd.setTemporada("Temp_"+i);
          prd.setPostVenta("PostV_"+i);
          prd.setNoVendible("NV"+i);
           wdContext.nodeProductData().addElement(prd);
    And I called this method in Another view in methos doinit()
    public void wdDoInit()
        //@@begin wdDoInit()
         wdThis.wdGetVisualizarContratoController().llenaTabla();
         //wdThis.wdFirePlugOutput();
        //@@end
    after deploying the table is empty
    Someone Could you tell what is the problem, thank you very much

    Hi Nitesh
    Thak you for your help, I solved that detail, but I have a problem some colums of the table are linktoaction, my question is how can I pass a value to the action whe the user click on this image , thank you very much
    Atte Israel

  • FM to lock the Table

    Could anybody check and tell me whether Function Module ENQUEUE_E_TABLE
    and DEQUEUE_E_TABLE are working fine and if it is so let me know the Parameters used for it.
    Full reward points for issue solver.
    Regards,
    Amol

    hi..
    check out the following documentation
    Lock objects are used to lock the database table while making the modifications on the database table.
    you can create your own lock objects using SE11.
    if you create lock objects on any table system will create two function modules.
    1.ENQUEUE....
    2.DEQUEUE.....
    first one is used to lock the table
    second one used to removing lock on the table.
    lock Table
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    Unlock Table
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    check this link :
    http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    _SCOPE = 1: The lock is not sent to the update program. The lock is removed when the transaction is ended.
    _SCOPE = 2: The lock is sent to the update program. The update program is responsible for removing the lock. The dialog program which requested the lock no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.
    _SCOPE = 3: The lock
    Re: lock objects
    Managingin lock entries
    http://help.sap.com/saphelp_nw04/helpdata/en/37/a2e3ae344411d3acb00000e83539c3/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cb/168237d30d974be10000009b38f8cf/frameset.htm
    <b>Reward points if useful</b>
    Regards
    Ashu

  • How can we lock the table?? how can we lock the record

    Hi
    how can we lock the complete table?? how can we lock the record ?/
    Thanks
    Rama

    Lock objects are used to lock the database table while making the modifications on the database table.
    you can create your own lock objects using SE11.
    if you create lock objects on any table system will create two function modules.
    1.ENQUEUE....
    2.DEQUEUE.....
    first one is used to lock the table
    second one used to removing lock on the table.
    lock Table
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    Unlock Table
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    tabname = table_name
    check this link :
    http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    _SCOPE = 1: The lock is not sent to the update program. The lock is removed when the transaction is ended.
    _SCOPE = 2: The lock is sent to the update program. The update program is responsible for removing the lock. The dialog program which requested the lock no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.
    _SCOPE = 3: The lock
    Re: lock objects
    Reward if this helps.

  • Is it Necessary to lock the table while accessing the entries from table

    Hi Gurus,
    While optimization of the Program i came through one type of coding is in  inside the Loop of The internal table  which is processing BDC call transcation through updating the Custom table.
    Before processing the BDC, the Custom table has been locked and read the entries from same custom  table ,if the process fails then it waits for another 20 seconds and retrying the same for another time .I could not able to understand the Logic behind this.if it is not the Correct way then i can straight away remove this Part which is very well improve the perfromance of the Object.
    For Your Better Understanding i have attached the Snippet of the Code .Please find the Code and advice me the same .
    +LOOP AT i_stk_req INTO wa_stk_req.+
    +**  Lock is set to '0',meaning that no lock exist.+
        ++v_lock = 0.    "FALSE.++
    ++*   Preparing variable key for locking.++
        ++CLEAR v_key.++
        ++v_key = sy-mandt.++
        ++v_key+3(3) = wa_stk_req-lgnum.++
        ++v_key+6(4) = wa_stk_req-werks.++
        ++v_key+10(18) = wa_stk_req-matnr.++
        ++v_key+28(10) = wa_stk_req-charg.++
    ++*   Try to lock the row for max of 100 times.++
        ++DO 10 TIMES.++
    ++*     this perform sends sy-subrc EQ 1. in case of foreign lock.++
          +PERFORM enqueue_tab IN PROGRAM saplsvix USING 'ZSDT_STK_REQ'  v_key c_e c_e.+
          +IF sy-subrc EQ 0.          "If Enqueue is successful.+
    +**      set lock as TRUE+
            ++v_lock = 1.  "TRUE++
    ++*       selecting the latest entry for the table(Entry might have changed-refer to++
            +SELECT SINGLE *+
                    ++FROM zsdt_stk_req++
                    ++INTO wa_stk_req++
                   ++WHERE lgnum = wa_stk_req-lgnum++
                     ++AND werks = wa_stk_req-werks++
                     ++AND matnr = wa_stk_req-matnr++
                     ++AND charg = wa_stk_req-charg.++
            ++IF sy-subrc NE 0.        "Checking if select statement was successful++
    ++*         Unlock the table row.++
              ++PERFORM enqueue_tab IN PROGRAM saplsvix USING c_table v_key c_e c_d.++
              ++v_lock = 0.            "If unsuccessful.Then we set lock as FALSE.++
              ++EXIT.++
            ++ENDIF.++
            ++EXIT.++
    ++*     If unsuccessful in locking then wait for 1 sec.++
          +ELSE.+
           +WAIT UP TO 20 SECONDS.+
          +ENDIF.+
    +** exit from DO. ENDDO.+
        ++ENDDO.++
    ++*   v_lock will be FALSE if all attempts for lock was unsuccessful or++
    ++*   if there is a problem in select single after lock.++
        ++IF v_lock = 0.++
          ++NEW-PAGE.++
          ++CLEAR v_display.++
          ++CONCATENATE text-004 text-012 wa_stk_req-matnr text-011 wa_stk_req-werks++
                      ++text-019 wa_stk_req-lgnum text-020 wa_stk_req-charg INTO v_display SEPARATED BY space.++
          ++WRITE :/ v_display.++
        ++ENDIF.++
    ++*   Only to process if lock is successful.++
        ++CHECK v_lock NE 0.++
    ++*   If UPDATE IS FALSE that means that no updates need to be done.++
    ++*   So we set v_update as FALSE in its initial state.++
        ++v_update = 0.++
    ++* Begin of Insert Optima App - 053++
      ++SELECT   lgnum++
               ++lqnum++
               ++matnr++
               ++werks++
               ++charg++
               ++lgtyp++
               ++meins++
               ++verme++
               ++lgort++
               ++qplos++
               ++bestq++
          ++FROM lqua++
          ++INTO TABLE i_lqua1++
         ++WHERE lgnum EQ wa_lqua-lgnum++
           ++AND matnr EQ wa_lqua-matnr++
           ++AND werks EQ wa_lqua-werks++
           ++AND charg EQ wa_lqua-charg++
           ++AND bestq EQ wa_lqua-bestq++
           ++AND lgort EQ wa_lqua-lgort++
           ++AND verme GE 0.++
    ++* End of Insert Optima App - 053++
    ++*   IF a requirement still exists.++
        ++IF wa_stk_req-verme > 0.++
          ++LOOP AT i_lqua INTO wa_lqua WHERE bestq  = 'Q'++
                                      ++AND   qplos  NE 0++
                                      ++AND   lgnum  =  wa_stk_req-lgnum++
                                      ++AND   werks  =  wa_stk_req-werks++
                                      ++AND   matnr  =  wa_stk_req-matnr++
                                      ++AND   charg  =  wa_stk_req-charg.++
            ++CLEAR v_target.++
            ++CHECK wa_stk_req-lgtyp = wa_lqua-lgtyp OR wa_stk_req-lgtyp IS INITIAL.++
    ++*       checking if still some stock needs to be transported.++
            ++IF wa_stk_req-verme < 0.++
              ++EXIT.++
            ++ENDIF.++
    ++*       we need to send the entire lot if the stock belongs to quality inspection++
            ++IF wa_stk_req-verme >= wa_lqua-verme.++
              ++IF wa_stk_req-lgort IS INITIAL.++
    ++*           fetch the Storage location value from the two custom tables.++
                ++PERFORM f_fetch_lgort.++
              ++ELSE.++
                ++v_lgort = wa_stk_req-lgort.++
              ++ENDIF.++
    ++*         checking if v_lgort is not initial.++
              ++CHECK NOT v_lgort IS INITIAL.++
    ++*         Calling QAC2++
              ++PERFORM f_qac2.++
    ++*         Checking if Post Good was successful.++
              +IF NOT wa_qamb-mblnr IS INITIAL.+
               +REFRESH i_lqua1.+
                +SELECT   lgnum+
                         +lqnum+
                         +matnr+
                         +werks+
                         +charg+
                         +lgtyp+
                         +meins+
                         +verme+
                         +lgort+
                         +qplos+
                         +bestq+
                    +FROM lqua+
                    +INTO TABLE i_lqua1+
                   +WHERE lgnum EQ wa_lqua-lgnum+
                     +AND matnr EQ wa_lqua-matnr+
                     +AND werks EQ wa_lqua-werks+
                     +AND charg EQ wa_lqua-charg+
                     +AND bestq EQ wa_lqua-bestq+
                     +AND lgort EQ wa_lqua-lgort+
                     +AND verme GE 0.+
                +SORT i_lqua1 BY lgtyp.+
                +CLEAR: wa_lqua1,+
                       +v_position.+
                +READ TABLE i_lqua1 INTO wa_lqua1 WITH KEY lgtyp = wa_lqua-lgtyp.+
                +IF sy-subrc EQ 0.+
                  +v_position = sy-tabix.+
                +ENDIF.+
                +SELECT SINGLE lgnum+
                               +ubnum+
                          +FROM lubu+
                          +INTO wa_lubu+
                          +WHERE lgnum = wa_lqua-lgnum+
                            +AND mblnr = wa_qamb-mblnr.+
                +CLEAR i_bdcdata.+
                +REFRESH i_bdcdata.+
                +REFRESH i_messtab.+
                +CLEAR wa_bdcdata.+
                +wa_bdcdata-program  = 'SAPML03T' .+
                +wa_bdcdata-dynpro   = '0141' .+
                +wa_bdcdata-dynbegin = 'X' .+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata .+
                +wa_bdcdata-fnam = 'BDC_OKCODE' .+
                +wa_bdcdata-fval = '/00' .+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata .+
                +wa_bdcdata-fnam = 'LUBU-UBNUM'.+
                +wa_bdcdata-fval = wa_lubu-ubnum.+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata .+
                +wa_bdcdata-fnam = 'LUBU-LGNUM'.+
                +wa_bdcdata-fval = wa_lqua-lgnum.+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata .+
                +wa_bdcdata-fnam = 'RL03T-DUNKL'.+
                +wa_bdcdata-fval = 'H'.+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata.+
                +wa_bdcdata-program  = 'SAPML03T' .+
                +wa_bdcdata-dynpro   = '0143' .+
                +wa_bdcdata-dynbegin = 'X' .+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CONCATENATE 'RL03T-SELKZ('+
                            +v_position+
                            +')'+
                      +INTO  v_str.+
                +CLEAR wa_bdcdata .+
                +wa_bdcdata-fnam = v_str.+
                +wa_bdcdata-fval = 'X'.+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata .+
                +wa_bdcdata-fnam = 'BDC_OKCODE' .+
                +wa_bdcdata-fval = 'BU' .+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata.+
                +wa_bdcdata-program  = 'SAPML03T' .+
                +wa_bdcdata-dynpro   = '0142' .+
                +wa_bdcdata-dynbegin = 'X' .+
                +APPEND wa_bdcdata TO i_bdcdata .+
                +CLEAR wa_bdcdata .+
                +wa_bdcdata-fnam = 'BDC_OKCODE' .+
                +wa_bdcdata-fval = 'BU' .+
                +APPEND wa_bdcdata TO i_bdcdata .+
    +*......changes as per ticket 44206+
    ++*            CLEAR wa_bdcdata .++
    ++*            wa_bdcdata-fnam = 'LQUAU-KZUAP(01)'.++
    ++*            wa_bdcdata-fval = 'X'.++
    ++*            APPEND wa_bdcdata TO i_bdcdata .++
    +*......end of changes as per ticket 44206+
                +CALL TRANSACTION 'LT05' USING i_bdcdata+
                                        +OPTIONS FROM wa_ctu_params+
                                        +MESSAGES INTO i_messtab.+
    Regards,
    Raja

    hi , please check the link below
    [http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm|http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm]

  • Problem while displaying all the table names from a MS Access Data Source.

    I started preparing a small Database application. I want to display all the Table Names which are in the 'MS Access' Data Source.
    I started to executing by "Select * from Tab" as if in SQL.
    But i got an error saying that "Not able to resolve Symbol 'Tab' in the query".
    Please let me know how can i display all the table Names in the MS Access Dats Source.

    Here i am developing the application in Swing using JDBC for accessing the database.
    I want to display all the Table names from the data source in a ListBox for easy selection of tables to view their details.

  • Need to know which user has locked the table.

    hi ,
    We are using a table named fm_sec_dict .when we try to disable the triggers and insert data into the table and enable the triggers asociated with the table.after inserting ,we are getting a message
    RESOURCE BUSY ACQUIRED NO WAIT option.
    please give the querry to find which user and what SID is using the Table ,so that we can kill the session.
    so that other users can work with out any obsturctions.
    thanks in advance...........

    Check in OEM.

  • Does MM_EKKO  archive write job lock the tables?

    Archive experts,
    We run MM_EKKO archiving twice a week. From my understanding the write job just read the data and write it to archive files. But we run Replenishment jobs which hit EKPO tables, the jobs run slow, and I noticed that the archive write job is holding the locks on this table. As soon as I cancelled the write job, the replenishment jobs move faster. why this happens?  Archive write jobs should not be causing any performance issues, only the delete jobs will impact the performance. Am I correct?  Is any one experiencing similar issues?
    Sam

    Hi Sam,
    Interesting question! Your understanding is correct, write job just reads the data from tables and writes it into archive files... but....write job of MM_EKKO (and MM_EBAN) is a bit different. The MM_EKKO write job also takes care of setting the deletion indicator (depending on whether its a one step or two step archiving. So its possible that it puts a lock during the process of setting the deletion indicator, as its a change to database.
    please have a look at the folloing link for the explanation of one step and two step archiving:
    http://help.sap.com/saphelp_47x200/helpdata/en/9b/c0963457889b37e10000009b38f83b/frameset.htm
    Hope this explains the reason for the performance problem you are facing.
    Regards,
    Naveen

  • How we can lock No more than one user can use the table  at a single time

    Hi Abapers,
    0)  which  function modules to lock & unlock a table.
    1) When you execute the program, we can check if there is any lock on this table. If yes, the user should be able to only view the table contents and not modify.
    2) If there is no lock, then lock the table and go into change mode.
    3) On exiting from the program, unlock the table using the function module.
    4) more than one user can't modify the table just display.
    Note: If there is any lock, display message saying table is locked.
    Plz help me for this requirement.
    Thanks
    Nani

    Hello Nani
    Have a look at the lock object EMMARAE (<i>Lock MARA and MARM/MAKT exclusively</i>) in transaction SE11.
    Inspect the F1 help for field <b>Lock mode</b>:
    DE ENQMODE
    Short Text
         Lock mode
    Definition
         Defines how to synchronize table record access by several users.
    The following modes exist:
         Exclusive lock
             The locked data can be read or processed by one user only. A request
             for another exclusive lock or for a shared lock is rejected.
         Shared lock
             Several users can read the same data at the same time, but as soon
             as a user edits the data, a second user can no longer access this
             data. Requests for further shared locks are accepted, even if they
             are issued by different users, but exclusive locks are rejected.
         Exclusive but not cumulative lock
             Exclusive locks can be requested by the same transaction more than
             once and handled successively, but an exclusive but not cumulative
             lock can only be requested once by a given transaction. All other
             lock requests are rejected.
    If you want to lock a standard table search whether the table is used in lock objects (<i>Where-Used-List</i>). If it is a customer table you have to create your own lock object (including two function modules: one for enqueuing and the other for dequeuing).
    The lock modules can be found in menu <b>GoTo -> Lock Modules</b>.
    Given these lock modules the logic should be quite clear after starting the program:
    1. Request lock -> if successful, continue in Change mode; -> if failed, continue in Display mode
    2. Before leaving the report remove lock (note: no problem if no lock has been set in the beginning).
    Regards
      Uwe

  • How can I lock a table so that a person can only enter data, not manipulate the table?

    I don't want to Lock the table as Numbers does it so perhaps locking is the wrong term. What I want to do is to lock the formatting of the table so it is possible to enter data but not possible to change the position, number of columns etc. I've been searching and all I can come up with is the regular lock function. But I still want to be able to use the cells. Just not change formatting.
    Thanks, Brad

    you cannot.  When you lock a table the whole table is locked.  I would consider segmenting the user input into a seprate, un-locked table and placing the calculations in a locked table

  • Locking the Custom table

    I have a custom tble zcustom_tab. I am modifying the entries in the program .  Right now i am locking the table.
    Now instead of table locking, i want the record level locking.
    How ?

    Hi,
    try if this code helps.
    *& Report  ZLOCKING                                                    *
    REPORT  zlocking                                .
    DATA : tab_emp TYPE TABLE OF zemp_51772,
           wa_emp TYPE zemp_51772.
    wa_emp-emp_no = '102'.
    wa_emp-emp_id = '157'.
    wa_emp-emp_name = 'SIVA'.
    wa_emp-emp_dept = 'SAP'.
    APPEND wa_emp TO tab_emp.
    CLEAR wa_emp.
    wa_emp-emp_no = '128'.
    wa_emp-emp_id = '138'.
    wa_emp-emp_name = 'RAMA'.
    wa_emp-emp_dept = 'SAP'.
    APPEND wa_emp TO tab_emp.
    CLEAR wa_emp.
    wa_emp-emp_no = '133'.
    wa_emp-emp_id = '121'.
    wa_emp-emp_name = 'KRISHNA'.
    wa_emp-emp_dept = 'SAP'.
    APPEND wa_emp TO tab_emp.
    CLEAR wa_emp.
    CALL FUNCTION 'ENQUEUE_E_TABLEE'
    EXPORTING
       mode_rstable         = 'X'
       tabname              = 'ZEMP_51772'
      varkey               =
      X_TABNAME            = ' '
      X_VARKEY             = ' '
      _SCOPE               = '2'
      _WAIT                = ' '
      _COLLECT             = ' '
    EXCEPTIONS
       foreign_lock         = 1
       system_failure       = 2
       OTHERS               = 3
    IF sy-subrc EQ 0.
      INSERT zemp_51772 FROM TABLE tab_emp.
    ENDIF.
    CALL FUNCTION 'DEQUEUE_E_TABLEE'
    EXPORTING
       mode_rstable       = 'X'
       tabname            = 'ZEMP_51772'
      VARKEY             =
      X_TABNAME          = ' '
      X_VARKEY           = ' '
      _SCOPE             = '3'
      _SYNCHRON          = ' '
      _COLLECT           = ' '
    IF sy-subrc EQ 0.
      WRITE:/ 'Unlocked the Table'.
    ENDIF.
    Thanks&regards,
    Sravani.

Maybe you are looking for

  • Error downloading and installing Yosemite

    Hello everyone, I have a problem. I downloaded about 5 times yosemite (5,16gb) and all 5 times downloaded gave me the same mistake at the time of 'installation this one : "Failed to verify this copy of the installation of OS X Yosemite. copying may h

  • My imac freezes while on Safari.

    The color wheel turns, force quit does not respond, the clock even stops.  I've left it like that overnight and when I awake it the next day the color wheel is still turning.  I have to shut it down with the power button and after I restart, then go

  • Guys, how can we get a volleyball emoji? They have basically everything else except volleyball.

    I've been waiting for a while to see a volleyball emoji, and still haven't seen one. When is apple going to realize that there are volleyball players who would use this emoji all the time? *cough cough* me *cough cough*

  • BSP Session times out in Portal iView

    HI, I have a stateful BSP Application with two pages. First BSP Page navigates via a POST to third party site from which, the request returns back to the original BSP to the second page. I pass the url of the application, along with the session infor

  • When opening tools on adobe reader, blank error box appears

    When opening tools on adobe reader with my laptop, a blank error box appears After clicking ok everything seems to work I have tried rebooting, uninstalling, rebooting, reinstalling, rebooting....still shows up. I have another laptop that has the sam