How to find out that the database table is empty

Hello all,
How to find out in ABAP in the best performant way, that the database table is empty. The table could have several milions of records or be empty. SELECT count( * )  looks to me as not the best way.
Kind regards
Radim Benek
Moderator message: FAQ, please search for previous discussions of similar topics.
example: "SELECT SINGLE" vs. "SELECT UP TO 1 ROWS"
Moderator message: Please Read before Posting in the Performance and Tuning Forum
Edited by: Thomas Zloch on Aug 11, 2011 5:06 PM

Hi,
One approach is:
check lt_mytable is initial.
This will be true if there are no lines.
Another:
describe table lt_mytable lines lv_count
if lv_count = 0.
"Empty
Thanks.
Anitha a

Similar Messages

  • Moving data between tables (how to find out if the 2nd table is empty)

    Hi,
    I have 2 tables, and I'm copying records from one table to another.
    I've followed the Wiki: [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/movingdatabetween+tables]
    So far, everything works ok.
    Here is my question: how do I get the number of records passed?
    I mean, how do I know the number of rows in the 2nd table? (Remember that this number is variable, because it depends on how many rows I've inserted and deleted on the 2nd table).
    I've tried to achieve that using a data store with a numeric field, but I couldn't find the way to increment/decrement the numeric field on data store, and insert/delete the row on table at the same time .
    All I want is to find out if the 2nd table is empty or not.
    Any ideas to solve this?
    Thanks in advance!
    Help will be point-rewarded.
    Marcelo

    Hi Ahmed
    thanks for your reply, it was very helpful!! (I've assigned points to you)
    However the user can add twice or more times the same row... so the counter doesn't reflect the real number of rows in the 2nd table.
    I've partially solved this also using a data store with a parameter called key_list, where I add (I mean, concatenate) the key field for the selected row.
    So, if I have a table with 4 rows with key fields "key1", "key2", "key3", the parameter key_list would get "key1;key2;key3".
    So far, it's ok. But when I remove a row previosly added.... I can't remove the key from the key_list parameter. (I mean, from 2nd table I choose to remove the "key2" row, but I don't know how also remove the key name from the key_list)
    I hope be clearly enough.
    Any help will be really appreciated and point-rewarded.
    Thanks again.
    Best Regards
    PS: is there any way of "mark" a row that has been added to the 2nd table? I mean, using (for example) a hidden boolean field named "added", that becomes true when the selected row is added to the 2nd table.

  • How can we find out that the Z table is adjusted or not???

    Dear Friends,
    How can we find out that the Z table is adjusted or not???
    I have activated it but I need to se that the table is adjusted or not? I know we can do it from SE14 but I don't have an authorization ,
    Thnaks,
    Sridhar

    Hi, Thanks for the reply,
    As per ur suggestion of path direction I have checked the table in production and development both.
    In my Z table, I have 2 key fields and for those 2 key fields the primary indexs are created automaticaly and displayed in Developement but in Production there is no indexs are created for those 2 fields.
    Could you please guide me what could be the reason?
    Thanks in advance.
    Regards
    Sridhar

  • How to find out that the card in a given NIDAQ slot is a DSA card?

    In the description of DAQ_Op(...) function in the traditional NIDAQ function reference one reads:
    "buffer" is an integer array. "buffer" has a length equal to or greater than count.
    When DAQ_Op returns with an error number equal to zero, buffer contains the acquired data.
    For DSA devices, buffer should be an array of i32. These devices return the data
    in a 32-bit format in which the data bits are in the most significant bits.
    Question 1: How to find out programmatically that the card in a given NIDAQ slot is a DSA card?
    Question 2: How many MSB carry the information? How do I find out bit-ness of the card (programmatically)?
    The obvious solution to create and keep updated the table/fil
    e with the data for all existing DAQ cards is unacceptable. This could be maintained by NI itself, but not by 3rd party developpers, like me.

    Bryan, thanks for your answer.
    I hope that my NIDAQ-wish-list will not only reach NIDAQ developers but some of it will be implemented in the next versions of NIDAQ.
    I should say that I am quite pessimistic because I was sending similar requests via German support few YEARS ago and I am still even do not know whether they reached developers or not. Even if yes, the present NIDAQ still does not have these functions and this means that NI takes 2..4 years to react on the feedback.
    At the moment I have no choice, and I do maintain self-made info file (nidaq.ini). But beleive me, it is a pain in the @ss to scan help files and manuals of the DAQ cards which I've never seen just to include info in nidaq.ini. And when my customers of a brand new NIDAQ ca
    rd call and wonder why the card is not reacognized by my application correctly, I tell to them that this is basically fault of NI. Because NI provides no way to get card info. I am doing my best analysing error codes, but it does not help in all cases. Sorry, guys, but you left no choice to me.
    As for NIDAQmx, this is not a solution either. I am not going to rewrite my existing and working rather big application. It could be a good suggestion for those who just starts developing a new applications from the scratch, but not for those who almost finished it. Even for those who begin now, NIDAQmx may not be a good choice, because, as I saw in this forum, it does not support all cards that are supported by NIDAQ. It also looks like that instead of improoving, developing and fixing NIDAQ, NI dicided to change API completely. It is not yet clear to me whether NIDAQmx is supposed to substitute NIDAQ in the future or not. If not, I would concentrate on improoving trad. NIDAQ. If yes, it wou
    ld be a disaster for many developers. :-(
    Anyway, I hope that the interaction between NIDAQ team and application developpers will be improoved, and we will see some results of this feedback.

  • How to find out what the underlying table/query of a form in Oracle Apps.

    Hi
    I am trying to find out who owns the underlying objects of a query when a user runs the Transactions > Line_Items form for Receivables .
    I have selected Help > Record History but I get a message Record History not available here.
    The query is running slow and I'd like to see if the objects have been analyzed lately.
    Thanks
    Andy

    Hi
    I should have said in the ticket that this is version 11.5.10
    It was close to giving me the answer I need. It gives me the following details. Unfortunately it doesn't give me the underlying sql. I hhave tried using v$session and sys.v_$sql but the sql is over 1000 characters long so I dont get to see the table/object being referenced.
    I appreciate the feedback.
    Thanks
    Andy
    Database Server
    RDBMS : 10.2.0.4.0
    Oracle Applications : 11.5.10.2
    Machine : alabama
    User : APPS
    Oracle SID : accausr1
    System Date : 12-SEP-2011 13:33:58
    Database Server PID : 16875
    Session SID : 1065
    SERIAL# : 1273
    AUDSID : 201640233
    Database CPU Usage (in secs) : 8.85
    Forms Server
    Oracle Forms Version : 6.0.8.27.0
    Application Object Library : 11.5.0
    Machine : AUSTIN
    Forms User CPU (secs) : 3.430000
    Forms System CPU (secs) : 0.840000
    Forms Process ID : 6347
    Forms Server Environment Variables
    AU_TOP : /oracle/finapps/accausr1/accausr1appl/au/11.5.0
    FDBDMCHK : [Unset]
    FDFGCXDBG : [Unset]
    FDSQLCHK : [Unset]
    FDUDEBUG : [Unset]
    FNDNAM : APPS
    FND_TOP : /oracle/finapps/accausr1/accausr1appl/fnd/11.5.0
    FORMS60_APPSLIBS : APPCORE FNDSQF APPDAYPK APPFLDR GLCORE HR_GEN HR_SPEC ARXCOVER
    FORMS60_CATCHTERM : 1
    FORMS60_ERROR_DATETIME_FORMAT : [Unset]
    FORMS60_ERROR_DATE_FORMAT : [Unset]
    FORMS60_FORCE_MENU_MNEMONICS : 0
    FORMS60_MAPPING : http://austin.accanet.org:8002/OA_TEMP
    FORMS60_MMAP : [Unset]
    FORMS60_OUTPUT : /oracle/finapps/accausr1/accausr1comn/temp
    FORMS60_OUTPUT_DATETIME_FORMAT : [Unset]
    FORMS60_OUTPUT_DATE_FORMAT : [Unset]
    FORMS60_PATH : /oracle/finapps/accausr1/accausr1appl/au/11.5.0/resource:/oracle/finapps/accausr1/accausr1appl/au/11.5.0/resource/stub:/oracle/finapps/accausr1/accausr1appl/au/11.5.0/forms/US
    FORMS60_RESOURCE : [Unset]
    FORMS60_TIMEOUT : 5
    FORMS60_USER_DATETIME_FORMAT : DD-MON-RRRR HH24:MI:SS
    FORMS60_USER_DATE_FORMAT : DD-MON-RRRR
    FORMS60_USE_CBO : [Unset]
    GWYUID : APPLSYSPUB/PUB
    NLS_DATE_FORMAT : DD-MON-RR
    NLS_DATE_LANGUAGE : AMERICAN
    NLS_LANG : AMERICAN_UNITED KINGDOM.WE8ISO8859P1
    NLS_NUMERIC_CHARACTERS : .,
    ORACLE_HOME : /oracle/finapps/accausr1/accausr1ora/8063
    ORACLE_PATH : [Unset]
    ORA_NLS_CHARSET_CONVERSION : [Unset]
    TNS_ADMIN : /oracle/finapps/accausr1/accausr1ora/8063/network/admin/accausr1_austin
    TWO_TASK : accausr1
    Current Form
    Form Application : Receivables
    Form Name : ARXTWMAI
    Form Path : /oracle/finapps/accausr1/accausr1appl/ar/11.5.0/forms/US/ARXTWMAI.fmx
    Form Version : 11.5.200
    Form Last Modified : $Date: 2005/01/07 11:50 $
    Forms
    APPSTAND : 11.5.33
    ARXRWMAI : 11.5.21
    ARXRWMAI : 11.5.21
    ARXTWMAI : 11.5.200
    FNDSCSGN : 11.5.122
    Form Menus
    FNDMENU : 11.5.51
    Forms PL/SQL
    APPCORE : 11.5.151
    APPFLDR : 11.5.55
    ARXARWIN : 11.5.65
    ARXBOEIF : 11.5.2
    ARXCWUTL : 11.5.8
    ARXPLCOM : 11.5.68.15104.2
    ARXQRCIF : 11.5.2
    ARXRCTIF : 11.5.2
    ARXRWBAT : 11.5.96
    ARXRWMAI : 11.5.19
    ARXTWBAT : 11.5.11
    ARXTWMAF : 11.5.27
    ARXTWMAI : 11.5.302.15104.9
    ARXTWUTL : 11.5.39.15104.2
    FNDSQF : 11.5.111
    GHR : 11.5.174
    GLOBE : 11.5.38
    GMS : 11.5.230.90.7
    IGILUTIL2 : 11.5.97
    IGILUTIL : 11.5.29
    OPM : 11.5.33.115100.2
    PQH_GEN : 11.5.124
    PSA : 11.5.162
    PSAC : 11.5.16
    PSB : 11.5.24
    VERT : 11.5.6

  • How to find out who updated database tables

    Hi
    We are using Oracle Database 10g Release 10.2.0.4.0.
    A user, via pl/sql developer, has been updating data on our database. This resulted in certain reports not balancing. At that time, we did not have database triggers on the tables concerned. We now need to go back at least a month or more to see who had updated these tables. We have a username, is there any script that we can use? How accurate is v$active_session_history? Would it give us all the info we need?

    781424 wrote:
    Hi
    We are using Oracle Database 10g Release 10.2.0.4.0.
    A user, via pl/sql developer, has been updating data on our database. This resulted in certain reports not balancing. At that time, we did not have database triggers on the tables concerned. We now need to go back at least a month or more to see who had updated these tables. We have a username, is there any script that we can use? How accurate is v$active_session_history? Would it give us all the info we need?It is little easy to know with AUDITING, or use Log miner to analyze log files.

  • How to find out that particular structure is used in which tables

    Hello Friends,
    Most of the times through techinal information we come to know the table name for a particular field.And in se16 when i give that table name than system says its structure and not the table.So in se11 when i give that structure name in database table field, its shows all the field in that structure, but not the data stored in that field.
    So my question is how to find out that particular structure is used in which tables,so that i can view data stored in that structure?
    Thanking you guys in advance.
    Regards,
    Jitendra

    Dear,
    When you click on the technical information it will give the structure name and field, double click on the structure and it will take you the display structure screen, there you will have the where-used List icon (Ctrl + Shift + F3) at the top , click on that and it will show the options, select Database tables and execute, it will give the tables related to the structure, you can explore the list of tables and find where your required field is stored in them.
    Thanks & Regards,
    Vijaya Bhaskar A

  • How to find out that a record is empty or null

    hi
    how can i find out that a record is empty or null.
    in other languages when a object or record is not initialized it will be null.
    after initialization how can i find out its values are null. so far i tried this
    declare
    v_r_emp emp%rowtype := null;
    BEGIN
         if (v_r_emp is null) then
         dbms_output.put_line('record is not initialized');
         end if;
    END;
    it seems in plsql we can assign null but cannot compare it with null clause why? if we are able of assign null we must should about to compare it with null too.
    also how record can be made empty. how can we find out that a record variable is empty
    please help me to understand the concept
    thanks

    You need to check every element in the record.

  • How to find out about the SMTP Server

    Hi,
    I have been trying to configure groupware in the portal - in particular I want to enable the sending of emails through the portal. I already have a how-to-guide that that seems to explain the steps quite well. However, it mentions that I need to know the SMTP Server of the email. Can you tell me how to find out about the SMTP Server? Where do I need to look for the name of it?
    Thank you and regards,
    Katharina

    Hi Katharina,
    you need the SMTP server of your company. This means you can't look for it in the portal, but have to ask the responsible person in your company.
    Kind regards,
    dominik

  • How to find out whether the system user is a vendor or a purchaser

    Hi,
    I am working in SRM 5.0. I have a requirement that some fields of Bid invitation can be visible by purchaser but not to bidder.
    How to find out whether the system user (user id though which system logged in) is a vendor or a purchaser. Kindly help me to resolve this issue.
    Sushmita Singh

    check his role.
    is surrogate bidding available for that bidder.
    via surrogate bid , purchaser can submit bid on behalf of the bidder.
    masa is correct
    pposa_bbp - search via user . so he might be  a purchaser.
    maintain business partner -supply your bidder bp number -edit
    go to bidder data .Under bidder data you must flag "PERMIT PROXY BIDDING"
    regards
    Muthu
    br
    muthu

  • How to send  changes in the Database Table Periodically using Change Pointe

    Hi,
           How to send  changes in the Database Table to the external system Periodically using Change Pointers.
    Thanks & Regards,
    Gopi.

    That depends on what table you are referring to.

  • Where can i find out all the standared table name

    Dear Friend,
    could you please tell me where can i find out all the standard table names,
    ( for example: tstc for find all the T-codes) .

    HI Srinivas,
      DD02L has the name of all the TABLES in the SYSTEM. It has both SAP and Customer's TABLES.
      First of all exclude all Z* and Y* tables from dd02L. Still there are many tables in CUSTOMER NAMSPACE.
      So make a program, LOOP at all entries of DD02L and then check the name space of each entry using the function module:-
    <b>TRINT_OBJECT_NAMESPACE_INFO</b>.
    If the namspace is not EQUAL to 'S', then dont count that entry else add one to the counter.
      This would tell you all SAP Standard Tables in the system.
    Thanks and regards,
    RAVI :).
    NOTE: Points keep me alive on SDN .

  • What is ilife ?? is it comes with macbook pro 13in ?? how to find out in the system

    what is ilife ?? is it comes with macbook pro 13in ?? how to find out in the system?? I am using OSX 10.8.5

    These are the iLife applications:
    http://www.apple.com/ilife/
    They come with every new Mac.  If they are not in your applications folder, download them from the App store.
    Ciao.

  • How to find out all the tables in a schema with a particular column

    Hi
    Is there a way to find out all the tables in schema1 that has col1 as one of the columns?

    select table_name from dba_tab_cols where owner='schema' and column_name='col1';

  • How to find out all the tables associated with particular T-code or Program

    Hi All,
    In 4.6B we have a transaction code SE49, where we can see all the tables associated with particular Transaction code or Program.
    But in ECC 5.0 or in ECC 6.0 this transaction code is not available.So is there any alternative where i can find out all the tables associated with particular T-code or Program.
    Thanks
    Shubham

    Hi,
    you are right, Transaction SE49 as well as SE48 do not exist anymore I'm afraid, they        
    are discontinued.                                                              
    You might try to create a transaction variant:                                        
    1) Start SE93 to create a transaction variant                                         
    2) Specify a name, eg. ZSE49, and choose the first option:                            
       "program and screen (dialog transaction)                                           
    3) Here specify SAPMSEUZ as program, and 200 as screen number                         
    4) Choose a suitable development class (package) if you want it to be                 
       transportable or Local (=$TMP) if non-transportable                                
    5) press Save                                                                         
    Same applies for SE48, same program but dynpro 100.                                   
    Sorry for not being able the reasons behind the decision to discontinue            
    these transactions. I suppose at least part of the functionality was               
    integrated in SE38.           
    Best regards
    Erika

Maybe you are looking for

  • Difference between ECC 5.0 and R/3 4.7

    Hi all, Can anyone help me in finding difference between ECC5.0 and 4.7 versions? Regards, Murali.

  • Form data

    I am designing a form something similar to this site: http://www.webdesignersnyc.com/web-design-quotes.htm My question is how do I capture the infomation from the text fields when someone submits the form? Do I need PHP and MySql.  I am using a MAC w

  • Change fields caption and internatiolization

    I need way to display custom field caption in profile by user locale like system fields behavior I need switch from English to different lanuage How can I do that? Thanks

  • Possible Refresh Problem

    I think I've run into an issue with a Discoverer refresh and any search I run is fruitless. A Discoverer admin refreshed one of our business areas and apparently it deleted some of the folders. He told me he wasn't paying too close attention to the "

  • Wysiwyg on my drupal 5 no longer appears with firefox 17 help!

    I am the web administrator for my work and uses firefox mainly for my web browser. With the new version, the Wysiwyg no longer appears. Do you know if there is a solution on our end?