FM to check if table (eg BUT000) is not locked

Hi experts,
Any idea which FM can check if the table (eg BUT000) is not being locked before attempting to write record into table?
Thanks

HI
go to SM12 transaction
You can use function ENQUEUE_READ.also you can use the function module GET_LOCKLIST_ADA
hope this helps you

Similar Messages

  • Best way to check if table is empty or not

    Hi. I had to check if a table was empty or not, and found different solutions.
    One of them called my atention, I readed it was the best way to do it (some 'dual' trick from Steven Feuerstein, they say) :
    SELECT 1 FROM DUAL WHERE EXISTS (SELECT 'X' FROM TABLE);
    Plan
    SELECT STATEMENT ALL_ROWSCost: 4 Cardinality: 1           
         3 FILTER      
              1 FAST DUAL Cost: 2 Cardinality: 1
              2 INDEX FAST FULL SCAN INDEX (UNIQUE) TABLE.UB_PK Cost: 2 Cardinality: 1
    But doing some tests I found this query to have lower cost:
    SELECT 1 FROM TABLE WHERE ROWNUM=1;
    Plan
    SELECT STATEMENT ALL_ROWSCost: 2 Cardinality: 1           
         2 COUNT STOPKEY      
              1 INDEX FAST FULL SCAN INDEX (UNIQUE) TABLE.UB_PK Cost: 2 Cardinality: 1
    So, what about that dual table trick? Should I keep the 'select 1 where rownum=1' as best possible way?
    I know it shouldn't matter much, but just wanna know what method works best for checking empty tables :)
    Thanks.

    As already mentioned, you cannot just base it on cost, as the cost is not specifically a good indicator of the amount of work that will need to be done, it's just an internal figure calculated for that query and isn't really that comparible across different queries.
    If you're intending to see if there is data in a table because you want to know whether to query it or not, you are actually better to just try and query the data and capture the NO_DATA_FOUND exception and handle that.  In that case it requires no effort or cost up front.

  • I need to add check whether 21 fields of a internal table are empty or not.

    Hello,
    I need to add check whether 21 fields of a internal table are empty or not.How can we write a code for the same wand what would be the correct syntax for it.
    I tried entering all the fields in the IF loop with AND condition but its giving syntax error.Perhaps this is because the lenght of the IF condition would be more than the allowed one.

    Hi,
    After the select quiery.
    If not itab is initial.
    Message 'Table is not empty'    type 'I'.
    Endif.
    Regards,
    Jagadish.

  • Check 2 tables(Table A and Table B) and figure out new columns present in Table A and add these new columns to Table B

    How to check 2 tables(Table A and Table B) and figure out new columns present in Table A and add these new columns to Table b.
    DDL-
    Create table A
    ( A INT,
    B INT,C VARCHAR(2)
    Create table B
    A INT,
    B INT
    Any advice on the best approach or method to achieve this.
    I understand that I need to check the schema of the columns and then do a match between 2 tables and find new columns and then alter my target table
    Mudassar

    Can you try this..
    CREATE TABLE A ( A INT, B INT, C VARCHAR(2) )
    CREATE TABLE B ( A INT, B INT )
    Declare @ColumnVar nvarchar(128),@DatatypeVar nvarchar(128)
    SELECT @ColumnVar=x.COLUMN_NAME, @DatatypeVar=x.DATA_TYPE
    FROM INFORMATION_SCHEMA.COLUMNS AS x
    WHERE TABLE_NAME = 'A'
    AND NOT EXISTS ( SELECT *
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_NAME = 'B'
    AND COLUMN_NAME = x.COLUMN_NAME )
    Declare @SQL VarChar(1000)
    SELECT @SQL = 'ALTER TABLE B ADD ' + @ColumnVar + ' '+ @DatatypeVar
    Exec (@SQL)
    select * from B
    Please Mark This As Answer if it helps to solve the issue
    http://stackoverflow.com/questions/2614101/alter-table-my-table-add-column-int

  • How to check the tables we have created in JDBC??

    I have created a table called COFFEE2 in a datasource called temp which is in SQL server...How to check the table values??
    i went into administrative tools and odbc cource then i could see the data source i have created but how to see the table??
    Can anyone help??
    thanx

    Hmm.. not sure that I understand the problem.
    Call getConnection on the DataSource, and then execute the select query on the connection.
    Kaj

  • How to check with table for cursor..?

    How to check with table for cursor..?
    Here I have Table temp_final_plan
    Here i want to update if already exit...below is the procedure....
    CREATE OR REPLACE PROCEDURE spu_final_profit_plan
    AS
    -- Constant declarations
      ln_errnum number := 0;
    -- Variable declarations
       ls_errmsg app_errors.err_msg%TYPE;
       ls_appmsg app_errors.app_msg%TYPE;
       ls_appid  app_errors.app_id%TYPE;
    -- Cursor declaration for final_update_el
    CURSOR cur_final_update_el IS
        select '910' ent,
               '9127316' center,
               post_acct,
               sum(avg_mtd_01) sum_avg_mtd_01,
               sum(avg_mtd_02) sum_avg_mtd_02,
               sum(avg_ytd_01) sum_avg_ytd_01,
               sum(avg_ytd_02) sum_avg_ytd_02
          from mon_act_cypy
         where rec_type = 'A'
           and sum_flag = 'D'
           and yr = '2008'
           and substr(ctr_or_hier, 1, 2) = 'el'
           and ent || sub_ent in
               (select ent || sub_ent
                  from ent_ref
                 where roll_ent || roll_sub_ent = '999100')
         group by post_acct
        having sum(avg_mtd_01) <> 0
            or sum(avg_mtd_02) <> 0
            or sum(avg_ytd_01) <> 0
            or sum(avg_ytd_02) <> 0;
    -- Cursor declaration for final_update
    CURSOR cur_final_update IS
        select b.plan_ent b_plan_ent,
               b.plan_ctr b_plan_ctr,
               a.post_acct a_post_acct,
               sum(a.avg_mtd_01) sum_avg_mtd_01,
               sum(a.avg_mtd_02) sum_avg_mtd_02,
               sum(a.avg_ytd_01) sum_ytd_mtd_01,
               sum(a.avg_ytd_02) sum_ytd_mtd_02
          from mon_act_cypy a,
               plan_unit_tbl b
         where a.ent || a.ctr_or_hier = b.ent || b.ctr_or_hier
           and a.rec_type = 'A'
           and a.sum_flag = 'D'
           and a.yr = '2008'
           and b.hier_tbl_num = '001'
           and a.ent || a.sub_ent in
               (select ent || sub_ent
                  from ent_ref
                 where roll_ent || roll_sub_ent = '999100')
         group by b.plan_ent, b.plan_ctr, a.post_acct
        having sum(a.avg_mtd_01) <> 0
            or sum(a.avg_mtd_02) <> 0
            or sum(a.avg_ytd_01) <> 0
            or sum(a.avg_ytd_02) <> 0;
    -- Begin the procedure body
       BEGIN
    -- Insert / Update final profit plan for final_update query using cursor
       FOR rec_final_update_el IN cur_final_update_el
       LOOP
       EXIT WHEN rec_final_update_el%NOTFOUND;
       IF rec_final_update_el. THEN
          UPDATE temp_final_plan
             SET sum_avg_mtd_01 = rec_final_update_el.sum_avg_mtd_01,
                 sum_avg_mtd_02 = rec_final_update_el.sum_avg_mtd_02,       
                 sum_avg_ytd_01 = rec_final_update_el.sum_avg_ytd_01,       
                 sum_avg_ytd_02 = rec_final_update_el.sum_avg_ytd_02,       
           WHERE ent = rec_final_update_el.ent
             AND center = rec_final_update_el.center
             AND post_acct = rec_final_update_el.post_acct;
       ELSE
          INSERT INTO temp_final_plan VALUES(rec_final_update_el.ent,
                                             rec_final_update_el.center,
                                             rec_final_update_el.post_acct,
                                             rec_final_update_el.sum_avg_mtd_01,
                                             rec_final_update_el.sum_avg_mtd_02,
                                             rec_final_update_el.sum_avg_ytd_01,
                                             rec_final_update_el.sum_avg_ytd_02);
       END IF;
       END LOOP;
    -- Insert / Update final profit plan for final_update query using cursor
       FOR rec_final_update IN cur_final_update
       LOOP
       EXIT WHEN rec_final_update%NOTFOUND;
       IF rec_final_update. THEN
          UPDATE temp_final_plan
             SET sum_avg_mtd_01 = rec_final_update.sum_avg_mtd_01,
                 sum_avg_mtd_02 = rec_final_update.sum_avg_mtd_02,       
                 sum_avg_ytd_01 = rec_final_update.sum_avg_ytd_01,       
                 sum_avg_ytd_02 = rec_final_update.sum_avg_ytd_02,       
           WHERE ent = rec_final_update.b_plan_ent
             AND center = rec_final_update.b_plan_ctr
             AND post_acct = rec_final_update.a_post_acct;
       ELSE
          INSERT INTO temp_final_plan VALUES(rec_final_update.b_plan_ent,
                                             rec_final_update.b_plan_ctr,
                                             rec_final_update.a_post_acct,
                                             rec_final_update.sum_avg_mtd_01,
                                             rec_final_update.sum_avg_mtd_02,
                                             rec_final_update.sum_avg_ytd_01,
                                             rec_final_update.sum_avg_ytd_02);
       END IF;
       END LOOP;
    -- EXCEPTION handling section
       EXCEPTION
    -- Fire OTHERS Exception case by default
       WHEN OTHERS THEN
    -- ROLL BACK Transaction, if any failure
       ROLLBACK;
       ln_errnum := SQLCODE;
       ls_errmsg := SUBSTR(SQLERRM, 1, 100);
    -- Log the ERRORS into APP_ERRORS table using SPU_LOG_ERRORS procedure
       spu_log_errors(ln_errnum, ls_errmsg, ls_appid, ls_appmsg);
    -- End of the stored procedure
    END spu_final_profit_plan;
    [\pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I'm not sure what you mean by, 'How to check with table for cursor..?' but I'll offer a comment on your Code Snippet. I think you want to know how to check if a record exists so you know if you need to perform an INSERT or an UPDATE.
    Here is a snippet of your code. I'll put my comments in "Comment" style in your code.
    -- Insert / Update final profit plan for final_update query using cursor
       FOR rec_final_update_el IN cur_final_update_el
       LOOP
    /* There is no need to test for %NOTFOUND since you are using Cursor FOR Loop! 
    ** This construct automatically exits when the last record is processed. */
       EXIT WHEN rec_final_update_el%NOTFOUND;
    /* Is this where you would like to know how to Check if the record already exist??
    ** I asked this because, 'rec_final_update_el.' is not valid syntax.  Are you looking for
    ** an Cursor Attribute or Method you can check here? 
    ** I would suggest a Primary Key or Unique Index on ENT, CENTER, and POST_ACCT
    ** on the TEMP_FINAL_PLAN table. Then simply perform an INSERT and code an
    ** Exception to UPDATE when you get a DUP_VAL_ON_INDEX exception.  Otherwise,
    ** you will need to simply run an Implicit or Explicit Cursor to test if the row exists and
    ** use this return value to determine if you should INSERT or UPDATE.  */
       IF rec_final_update_el. THEN
          UPDATE temp_final_plan
             SET sum_avg_mtd_01 = rec_final_update_el.sum_avg_mtd_01,
                 sum_avg_mtd_02 = rec_final_update_el.sum_avg_mtd_02,       
                 sum_avg_ytd_01 = rec_final_update_el.sum_avg_ytd_01,       
                 sum_avg_ytd_02 = rec_final_update_el.sum_avg_ytd_02,       
           WHERE ent = rec_final_update_el.ent
             AND center = rec_final_update_el.center
             AND post_acct = rec_final_update_el.post_acct;
       ELSE
          INSERT INTO temp_final_plan VALUES(rec_final_update_el.ent,
                                             rec_final_update_el.center,
                                             rec_final_update_el.post_acct,
                                             rec_final_update_el.sum_avg_mtd_01,
                                             rec_final_update_el.sum_avg_mtd_02,
                                             rec_final_update_el.sum_avg_ytd_01,
                                             rec_final_update_el.sum_avg_ytd_02);
       END IF;
       END LOOP;I hope I've answered your question, but if I haven't please provide more details so we can better understand your request.
    Craig...

  • How to check table is creating or not

    Hi,
    I am creating only one table by running a table creation script(table.sql) which contain 366 partition.but I dont know whether table is creating or not.it is taking long time,sometimes I feel like script is hanging.even before running the script I have even spooled but spool file shows nothing. so how to check table is creating or not from background? can anyone please let me know abt this.this is bit urgent
    sql>spool table.log
    sql>@table_partition.sql

    hi,
    I am running the script table_partition which consist of 366 partition and 31 sub partition but the script is hanging.there is no hint in alert log file or anything wat might be the reason is it because of extent size? as extent size for this tablespace where table has to be create is 1mb,wat i suspect is do i need to set for higher value inorder to avoid this?
    with regards;
    Boo

  • Syntax check for tables and function modules

    Hi,
    I am writing a program that perform syntax check on object such as executable programs , function modules and tables.
    Syntax check works fine for programs, but not for tables.
    How can I perform syntax check on my tables or structures?
    I get my data from the table TADIR. But I don't get my function modules from there. What is the table for this.
    Thanks 4 ur replies.
    Parvez

    hi
    good
    generally in sap while creating a table or structure we get the error and we solved them,but like reports during runtime it is not possible to check the syntax of a table or structure.
    thanks
    mrutyun^

  • How to check whether set up tables are filled or not

    Hi Gurus,
    How to check whehter set up tables are filled or not?
    Cheers,
    Reddy.

    Hi Reddy.......
    And another point I want to make u clear............LBWQ is not the Delta Queue.............Delta queue is RSA7...............it comes into play in delta loading.......LBWQ is Extraction Queue.........While delta loading....if we use the Update mode Queued Delta........then any Changes will not directly get updated in the Delta queue.....For the Delta set up.........
    1) First u hav to run init with data transfer(After filling the set up table)
    2) After that any Changed ........will be recorded in the Extraction Queue(LBWQ)........
    3) After a certain number of records get accumulated in LBWQ........We hav to run V3 jobs to bring the data in the Delta queue(RSA7)...
    Check this.....
    Re: question on LBWQ and RSA7
    Regards,
    Debjani.....

  • How to check the tables

    Dear experts!
    Thank you for your attention!
    I have studied the SAP SD for half a year, though I still don't know how to check certain table like:
    KNVS---customer master shipping data
    KNBK---customer master (bank detail)
    ADR---address table
    ect.
    could somebody help me?
    Best regard!
    Tangdark

    Hi Tang,
         SAP SD having lot of tables but i am telling main tables.
    VBAK   - Sales Document Headerdetailes
    VBAP   - Sales Document Itemdetailes
    VBEK   - Sales Document Scheduline data
    LIKP      - Delivery Header Detailes
    LIPS      - Deliver Item Detailes
    VBRK    - Billing Header Data.
    VBRP    - Billing Item Data.
    VBFA   - Sales Document Flow
    VBUK   - Sales document header status data
    VBUP   - Sales document item status data.......ctc.
    Regards
    Rajendra

  • How to check PSA Table Structure ?

    Hi Friends,
       Can you pls any one tell me how to find out PSA Table and how to check PSA Table Structure? .Thanks in advance.
    Regards,
    CS

    Hi Sri,
    Goto RSA1 trans> select your DS> right clcik> Manage> you will get a Pop-up with all the PSA requests--> on the top Left you can see the PSA name(Technical name) in the form PSA/BIC/BXXXXXX
    PSA & DS structue will be same. Goto RSO2 transaction> Enter your DS name> double click on the extract structure. It will take you to the Extract structure.
    (Or) if you know the extract structure name, directly goto Se11 trans & enter the technical name of Extract structure & Display.
    Take the screenshot & send it to your TL.
    Regards,
    Pavan

  • Input Check in Table Control

    A table control is created in screen painter and an internal table was used to store particular data in ABAP program.
    Information were entered into the table through ABAP program(insert value into internal table). The input check generated by data dictionary do not work due to data not inserted from screen field. How can I solved the problem?
    Do I need to manually program the input check using module as following:
    FIELD f Module m.
    But how can I make the whole row ready for input and with cursor on particular column just like what was done with normal data dictionary input check?
    Message class 00 number 058 with text
    Entry & & & does not exist in &4 - check your entry
    can be used for compute the message.

    What are those conditions that will trigger the input check for my situation?
    I can only do that for those fields with check table.
    Here are what I had done:
    <b>Flow Logic</b>
          field EBAN-EKGRP MODULE CHECK_EKGRP.  " Purchasing Group
    <b>Module code</b>
    MODULE CHECK_EKGRP INPUT.
    TABLES:  T024.
      CHECK:  EBAN-EKGRP IS NOT INITIAL.
      SELECT SINGLE * FROM T024 WHERE EKGRP = EBAN-EKGRP.
      IF SY-SUBRC NE 0.
        MESSAGE E058(00) WITH EBAN-EKGRP '' '' 'T024'.
      ENDIF.
    ENDMODULE.                 " CHECK_EKGRP  INPUT
    However, this is not applicable for those without check table.
    Please help. Points will be awarded for helpful answers.

  • Status Check on Table of Contents

    My status checks work fine for all of my slides, except when I have my "Next" button jump to a slide later down the line.  For some reason I'm not getting a checkmark on the TOB for that particular slide. 
    Also, on that particular slide, the duration will say "1:03" instead of "0.03."  0.03 is what I have allotted according to my slide timeline.  So I guess it's taking into account the duration for all of the slides that I'm jumping over.  Accessing the slides that I'm jumping over doesn't seem to give me a status check on the slide either.
    Has anyone had this problem? 
    Sorry if this is confusing!

    I'll give that a try and see what happens. 
    Although, my "Next" buttons are set up that way on each slide (they pause at 1.5 seconds) and they seem to be working fine.  It's only when I have the "Next" button jump over slides, for example, slide 8 jumps to slide 21 because slides 9-20 are set up as a Glossary, Examples, Resource Information, etc. 
    I put buttons on each slide so the student can access the Glossary, Examples, and Resource Information at any time during the training.  Then on the TOB, I have these slides turned off so the student only accesses them by clicking the button on the slides.
    But I'm open to trying anything so I appreciate your suggestion!
    Date: Tue, 4 May 2010 09:02:35 -0600
    From: [email protected]
    To: [email protected]
    Subject: Status Check on Table of Contents
    Hi there
    I don't believe the check mark will appear unless the slide plays fully. If you have a button on the slide that is pausing at perhaps 1.5 seconds and the total silde time is perhaps 3 seconds, you are essentially skipping over 1.5 seconds of the slide to visit the linked slide. You might try adjusting the pause point so it's at the end of the slide and see if that improves things. It may and it may not. I'm not certain. But it's worth a try.
    Cheers... Rick
    | http://www.robowizard.com/pc.gif | Helpful and Handy Links
    http://www.Adobe.com/cfusion/mmform/index.cfm?name=wishform&product=5
    http://www.ShowMeSolutions.biz
    http://sorcererstone.wordpress.com/
    http://www.gooberguides.com |
    >

  • How to check small table scan full table scan if we  will use index  in where clause.

    How to check small table scan full table scan if i will use index column in where clause.
    Is there example link there i can  test small table scan full table  if index is used in where clause.

    Use explain plan on your statement or set autotrace traceonly in your SQL*Plus session followed by the SQL you are testing.
    For example
    SQL> set autotrace traceonly
    SQL> select *
      2  from XXX
      3  where id='fga';
    no rows selected
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=13 Card=1 Bytes=16
              5)
       1    0   PARTITION RANGE (ALL) (Cost=13 Card=1 Bytes=165)
       2    1     TABLE ACCESS (FULL) OF 'XXX' (TABLE) (Cost=13 Card
              =1 Bytes=165)
    Statistics
              1  recursive calls
              0  db block gets
           1561  consistent gets
            540  physical reads
              0  redo size
           1864  bytes sent via SQL*Net to client
            333  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processed

  • How to check table is NULL or not when a form load?

    How to check table is NULL or not when a form load?
    I want to make the form when it load it check the data in table, if there are no data in table other form will be load.
    Sorry for bad English... 

    Maybe you can do this in form1's Form_Open event:
    if dcount("*", "table1") = 0 then
      Cancel = True
      Docmd.Openform "form2"
    end if
    -Tom. Microsoft Access MVP

Maybe you are looking for

  • Getting a "403 Forbidden" error when I login ..

    Hi all ... Well yesterday I did a new installation of Oracle Express Edition 11g DB, which installed fine ... I then installed OC4J, and then finally installed APEX Listener 4.1 ... Now, when I opened 127.0.0.1:8888/apex/listenerAdmin for the very fi

  • ORA-01489 Received Generating SQL for Report Region

    I am new to Apex and I am running into an issue with an report region I am puzzled by. Just a foreword, I'm sure this hack solution will get a good share of facepalms and chuckles from those with far more experience. I welcome suggestions and critici

  • Why is Java so hard?

    I know it's a lot easier than c++, but compare to VB.NET or to C#.NET it's a nightmare. For example, some code working under the IDE for loading images from a package directory won't work after jaring the project, since the images are jared. Why then

  • Duplexing not working for LaserJet 5M (maybe just LaserJet 5?)

    Hi, I have a HP LaserJet 5 printer (that's what it says on the front), and at one point, I believe that I bought the memory module that adds PostScript handling, which at the time I think made the printer equivalent to a LaserJet 5M. Anyway, I recent

  • Internal Order Deletion.

    Hi Can any body explain how to delete statical order ? any transation code is there>? i know only lock and delete indicater posible. i want to delete ? Regards