To count the records in the database table...

I want to count the number of records in the database table (infotypes PA0000)
is it possible to count ?
Any function module is there?
Thanks in advance..

Hi dhavamani ponnusamy,
SELECT COUNT(*) FROM <DB TABLE NAME> WHERE <CONDITION>.
or
SY-DBCNT Will have total no of records satisfying the given criteria in where clause.
See below sample..
Data: itab like mara occurs 0 with header line.
Select * from mara into table mara.
write:/ sy-dbcnt.
Hope it will solve your problem...
Reward points if useful..
Thanks & Regards
ilesh 24x7

Similar Messages

  • Not able to edit the records in the table

    Hi Experts,
    I am not able to edit the records or delete the records from a database table.
    Those fields are not enabled.
    Edit icon is not at all there.
    Wat can i do.
    Cheers,
    Karthick

    Hi,
            In SM30, u can edit or delete records from a table.Before goin to this u need to create table maintainance generator for this table.
    regards
    lakshmi

  • Deleting and updating records in a database table

    dear all ,
    i have created a databse table to which i have to update and delete records thru my program whixh i am unable to do so plz help me.

    Hi Sonu,
    To delete and update the records in your database table, you can create a Function Group and all the necessary function modules for it. This will a good approach as this will separate the database interface logic and the business logic. You need to use the DELETE and UPDATE ABAP keywords to delete and update the records of the database tables. Have a look at the ABAP Keyword documentation for a complete details of the usage.
    Have a look at the following link:
    DELETE
    http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3aef358411d1829f0000e829fbfe/frameset.htm
    UPDATE
    http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3aef358411d1829f0000e829fbfe/frameset.htm
    Hope this will help.
    Thanks,
    Samantak.

  • Access is not inserting, updating or deleting records in my database table on the server

    I am having a problem with an application I developed using Dreamweaver 8 and Access 2000 several years ago which is no longer working correctly. The problem is that Access is not inserting, updating or deleting records in my database table on the server but is reflected in changes to my Web site. I used the Dreamweaver server behaviors: insert record, update record and delete record to make the changes to my Access table on the server. My Access table on the server shows all of the records I inserted or updated in the past, but not any of the newly inserted on updated records.
    does any one have any ideas as to what my problem is?
    Jim

    No, that has nothing to do with your problem. Let's make sure I understand the symptoms.
    1) Your site is online at a remote host.
    2) You use a dynamic page in your online site to update a database record (insert, delete, or update)
    3) The update then appears correctly on your dynamic content page.
    4) You download the mdb and it appears to not have any of the upates you just made.
    Please correct any of these statements if they are wrong.
    If the above is correct, then you must be looking at a cached mdb, or the mdb you are looking at is in the wrong location. Do this: search your entire drive for copies of the mdb, including in the Windows temp directories which is likely where the cached copy is located. Delete any extra copies and download again.

  • Count Number of Records in Oracle Database Table

    Please help me to see if I "set" and "return" the number of records in my database table correctly (I am using the Oracle 9i):
       public int getNumberOfRecipientBeans() throws AssertionException, DatabaseException
          Connection conn = null;
          PreparedStatement stmt = null;
          String query = "SELECT count(*) FROM ContactEntry WHERE ContactTypeID = 6";
          ResultSet rs = null;
          try
             conn = DBConnection.getDBConnection();
             stmt = conn.prepareStatement( query );
             rs = stmt.executeQuery();
             // do I have to set anything here?
             if ( !rs.next() )
                throw new AssertionException("Assertion in servuce.getNumberOfRecipients");
              // Am I returning the counts here?
              return rs.getInt( 1 );
          catch( SQLException sqle )
             sqle.printStackTrace();
             throw new DatabaseException( "Error executing SQL in service.getNumberOfRecipients." );
          finally
             if ( conn != null )
                try
                   stmt.close();
                   stmt = null;
                   conn.close();
                catch( Exception Ex )
                   System.out.println( "Problem occurs while closing " + Ex );
                conn = null;

    public class MyE extends Exception {
        public MyE() {
            super(); // this line is not necessary. An empty method would suffice
        public MyE(String msg) {
            super(msg);
        // Check the API for Exception or Throwable--I may have the args backward
        public MyE(String msg, Throwable cause) {
            super(msg, cause);
        public MyE(Throwable cause) {
            super(cause);
    // Replace the log_warn() calls with appropriate logging calls for your context
    public class Closer {
        public static final void close(ResultSet closeMe) {
            if (closeMe != null) {
                try {
                    closeMe.close();
                catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
        public static final void close(Statement closeMe) {
            if (closeMe != null) {
                try {
                    closeMe.close();
                catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
        public static final void close(Connection closeMe) {
            if (closeMe != null) {
                try {
                    closeMe.close();
                catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
        public static final void close(ResultSet rs, Statement stmt, Connection con) {
            close(rs);
            close(stmt);
            close(con);
    }

  • How to delete the complete contents of database table ? should be empty !!

    Hi Guys,
    I have requirement where i have delete the contents of database table..i have make it empty (no records at all) and then i have to fill it with the records from the excel sheet.
    I can upload data from the excel sheet.
    Please tell me how to delete the complete contents of the database table ??
    Regards
    Rahul

    hi ,
    just write like this,
    delete from <database table>.
    commit work.
    sample code, here edpar is database table.
    delete from edpar." FROM TABLE g_tab_delete.
      call function 'DB_COMMIT'.
      loop at g_tab_edpar into g_wa_edpar.
        insert into edpar values g_wa_edpar.
        if sy-subrc  eq 0.
          move-corresponding g_wa_edpar to g_wa_edpar1.
          append g_wa_edpar1 to g_tab_edpar1.
        else.
          move-corresponding g_wa_edpar to g_wa_edpar2.
          append g_wa_edpar2 to g_tab_edpar2.
        endif.
      endloop.
    that's all it works.
    reward points if helpful.
    regards,
    seshu.

  • How to restrict the entries of a database table based on the user name

    Hi All,
    I have created a Database Table. Table maintenance generator is generated for the table.
    UNAME(user name) is one of the fields in the table. whenever the user creates a new entry, the field UNAME will be populated automatically with SY-UNAME value. I have used Table event '05' to do this.
    My requirement is...
    When a user tries to maintain the entries of the table using SM30, when 'DISPLAY' is chosen, all the records of the table should be displayed.
    When 'MAINTAIN' is chosen, only those records which have UNAME = SY-UNAME(User Logged in) should be in EDIT mode. and rest all the records should be in DISPLAY mode(greyed out). It should allow to edit only those records which are created by the user logged in.
    Could you please tell me how to do this..? Thanks in advance.
    Thanks & Regards,
    Paddu.

    HI,
    In table main. gen there are number of events , try to select one event like 05 for the Sy-uname.
    For the  requirement:
    In that event write the code like
    this is basic idea not the code:
    Case ' Sy-ucomm'.
    when 'display'.  " button
       Nomally for the display button it will show all the records, but we need to write a code like this.
    select all records frm the table.
    ( Need to write the code in case if the user first maintained the data then again press the display , list has to be refreshed.)
    when ' Maintain'. " button.
    Fetch the records that are with SY-UNAME and find out the edit function and implement it on each and every record.
    endcase.
    Thanks and Regards,
    Bharani.

  • How to tracke the new entries in database table ?

    Hi,
    How to tracke the new entries in database table ? is there any FM or report is there to check it ?
    regards
    vishnu

    Hi Vishnu,
    u can write a report program for this and in that use the event  :
    AT NEW <field-name> ( use primary key)
    your statements
    ENDAT
    for eg.
    loop at itab ( herfe itab must be of type of table for which u want to track new entries)
    at new matnr
    write:/ new record
    endat
    endloop.
    schedule this report in background to run in every 5 or 10 mins as per your requirement and hence changes can be tracked.
    regards
    Vinod

  • Error while saving the records in the database

    Hi,
    I am running into a wierd error.
    I have built a new page which contains the information about the employees. Some of the fields are updatable fields. The page shows the details of the person who logs into the page.
    I am not using EO in this page. The data is queried from the database from VO and displayed in the page and when the records are updated, they are saved in the databased using pl/sql procedure which is
    being called from AM. So i am basically not using VO to save the records in the database.
    The error which i am getting is,
    If 2 users are trying to update the page at the same time, user A's details are updated in user B's page.
    This is really causing the issue. Any help is greatly appreciated.
    Thanks in advance.
    PK

    I have posted the code used along with the dialog page. Please review.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Pavan, Start1",OAFwkConstants.STATEMENT);
    if (pageContext.getParameter("XYZBack")!=null)
    pageContext.setForwardURL("OA.jsp?OAFunc=OAHOMEPAGE"// OAWebBeanConstants.RETURN_TO_MENU_URL also tryed this , same error
    ,null
    ,OAWebBeanConstants.KEEP_MENU_CONTEXT
    ,null //not needed as we are retaining menu context
    ,null // no parameters are needed,true //retain AM,OAWebBeanConstants.ADD_BREAD_CRUMB_YES
    ,true
    ,null
    ,OAWebBeanConstants.IGNORE_MESSAGES);
    if(pageContext.getParameter("XYZUpdate") !=null)//The fields and their values are loaded as soon as the update button is clicked. We do this before calling the oadialog page so that the values are not lost
    OAViewObject EmpDetailsVO3 = (OAViewObject)OAAppl.findViewObject("XYZPersInfoVO");
    OARow EmpDetailsRow3 = (OARow)EmpDetailsVO3.first(); //Bringing the control over to the first row which is nothing but the displayed row.
    if(EmpDetailsRow3 !=null)
    s_workphone = EmpDetailsRow3.getAttribute("WorkPhone").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workphone is: "+s_workphone,OAFwkConstants.STATEMENT);
    s_fax = EmpDetailsRow3.getAttribute("WorkFax").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Fax is: "+s_fax,OAFwkConstants.STATEMENT);
    s_building = EmpDetailsRow3.getAttribute("Building").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Building is: "+s_building,OAFwkConstants.STATEMENT);
    s_room = EmpDetailsRow3.getAttribute("Room").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Room is: "+s_room,OAFwkConstants.STATEMENT);
    s_box = EmpDetailsRow3.getAttribute("Box").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Box is: "+s_box,OAFwkConstants.STATEMENT);
    s_preferedname = EmpDetailsRow3.getAttribute("KnownAs").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Preferred name is: "+s_preferedname,OAFwkConstants.STATEMENT);
    OAException OAExcep1 = new OAException("PER","XYZ_UPDATE_DETAILS");
    OAException OAExcep2 = new OAException("PER","XYZ_UPDATE_MESSAGE");
    OADialogPage OADialogPG1 = new OADialogPage(OAException.WARNING,OAExcep1,OAExcep2,
    OADialogPG1.setOkButtonToPost(true);
    OADialogPG1.setNoButtonToPost(true);
    OADialogPG1.setOkButtonLabel("Yes");
    OADialogPG1.setNoButtonLabel("No");
    OADialogPG1.setOkButtonItemName("DoOk");
    OADialogPG1.setNoButtonItemName("DoNo");
    OADialogPG1.setPostToCallingPage(true);
    pageContext.releaseRootApplicationModule();
    pageContext.redirectToDialogPage(OADialogPG1);
    else if(pageContext.getParameter("DoOk") != null)
    OAApplicationModule EmpDetailsAM = pageContext.getApplicationModule(webBean);
    Class[] paramtypes = {String.class, String.class, String.class, String.class,String.class,String.class,String.class};
    Serializable[] params = {s_personid,s_workphone,s_fax,s_building,s_room,s_box,s_preferedname};
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"personid is :"+s_personid,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workphone is :"+s_workphone,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workfax is :"+s_fax,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"building is :"+s_building,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"room is :"+s_room,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"preferredname is :"+s_preferedname,OAFwkConstants.STATEMENT);
    pageContext.releaseRootApplicationModule();
    OAAppl.invokeMethod("TransactionCommit",params,paramtypes);
    OAAppl.invokeMethod("initDetails");
    throw new OAException("The Building and Phone Information have been saved successfully"
    ,OAException.INFORMATION);
    thank you

  • Need Help : Urgent : Making one of the record Bold in a Table

    Hi Frds,
    I am new to OAF.......
    I am  facing the issue that i have to make one of the record bold in a table...........
    By using the query, i m trying to display the payslip
    It contains the list of Earnings ,Deductions and NetPay amount..........
    this is the part of the query........
    select payment_date,element_name,arabic_name,val,balance from
      select '0' flag,assignment_id,null payment_date,'Payslip for the Month'  element_name,to_char(payment_date,'Month-YYYY')arabic_name,
       null val, null balance from xx_payroll_info
    where 1 =1
    and payment_date = last_day(:2) 
    and assignment_id = (select assignment_id from xx_people_reporting_info
        where person_id = :1)
    union all
    select '1'flag,assignment_id,payment_date,element_name,arabic_name,
       value val,null,balance
      from xx_payslip_details_mv
    where 1 = 1
    and payment_date = last_day(:2)
    and earn_deduct = ('E')
    and assignment_id in (select assignment_id from xx_people_reporting_info)
    union all
    select '2' flag,assignment_id,payment_date,'Earnings-Total',null,sum(value) val,null
      from xx_payslip_detail_mv
    where 1 =1
    and payment_date = last_day(:2)
    and earn_deduct = 'E'
    and assignment_id in (select assignment_id from xx_people_reporting_info
           where 1 =1
                and person_id = :1 )
    group by assignment_id,payment_date
    My Requirement is : I have to make the Payslip For the month of , Date, Earnings-Total  into Bold.....  How can i do this.... plz... help me out in this......
    Thanks &Regards,
    Jaya

    Hi Jaya,
    Set CSS Class property as  OraDataText for respectiveb column.
    OR
    /In Controller PR
                    import oracle.cabo.style.CSSStyle;
                    CSSStyle customCss = new CSSStyle();
                     customUnCss.setProperty("text-transform","uppercase");
                     customUnCss.setProperty("font","bold 16px \"Trebuchet MS\", Verdana, sans-serif");//# -red
                     OAMessageStyledTextBean styledTextBean =(OAMessageStyledTextBean)webBean.findIndexedChildRecursive("POCommentsItem");
                     if(styledTextBean!=null)
                      styledTextBean.setInlineStyle(customUnCss);
           Thanks,
            Dilip

  • How to check the records in Master Data Table?

    Hi,
       I am trying to load the Master Data Table using the Flat File.Now how to check the records in Master Data Table?
    I done the following way:
    Info Provider->Info Object->Right Click->Display Data or Maintain Master Data
    But it's not showing the records.It's asking like CID from......To......
                                                                        CID(SID)from.............To.......
                                                                         here CID means customer id(characteristic).
    and showing some settings.
    Please guide me.
    Thanks & Regards

    Hi Sri,
    Go to T- code RSD1 and type your info object name and open the P- table in the infoobject then select execute symbol to see the updated  data in to master data info object.
    regards
    sap

  • If I have an EntityBean that mappes to two tables within one database, when I create that EJB, whoes reponsibilty to generate the primary key in database table? The RDBMS or EJB?

    If I have an EntityBean that mappes to two tables within one database, when I create
    that EJB, whoes reponsibilty to generate the primary key in database table? The
    RDBMS or EJB?
    Thanks,
    JW

    Refer to http://e-docs.bea.com/wls/docs81/faq/ejb.html/#257430
    "Jingwei Zhang" <[email protected]> wrote:
    >
    If I have an EntityBean that mappes to two tables within one database,
    when I create
    that EJB, whoes reponsibilty to generate the primary key in database
    table? The
    RDBMS or EJB?
    Thanks,
    JW

  • Problem with mapping the Entity beans onto database tables

    Hi,
    I got a problem with mapping the Entity beans onto database tables. Here are what I did:
    First Step:
    asant capture-schema
    Second Step:
    capture-schema -driver com.pointbase.jdbc.jdbcUniversalDriver -dburl jdbc:pointbase:server://localhost/sun-appserv-samples -username pbPublic -password pbpublic -table APPLICANT -table APPLICANTSKILL -table CUSTOMER -table LOCATION -table job -table JOBSKILL -table SKILL -out build/agency.dbschema
    The first step was fine. But, in the second step, I got the error message as follow:
    using dburl:jdbc:pointbase:server://localhost/sun-appserv-samples
    using username:pbPublic
    using password:pbpublic
    using driver:com.pointbase.jdbc.jdbcUniversalDriver
    using schemaname:null
    using output file:build/agency.dbschema
    JDO71100: Failed to find a class. Verify that the class is available on your CLASSPATH
    java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at com.sun.forte4j.modules.dbmodel.jdbcimpl.ConnectionProvider.<init>(Co
    nnectionProvider.java:38)
    at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch
    ema.java:130)
    at com.sun.jdo.spi.persistence.support.ejb.util.CaptureSchemaWrapper.mai
    n(CaptureSchemaWrapper.java:29)
    Thanks for your help!

    You need to add the pbclient.jar or some similar name like that, in the CalssPath.

  • Determining the relationship between 2 database tables

    hi all,
    is it possible to write a java program that can determine the relationship between 2 database tables, given only the database tables? can you provide examples please? thanks.

    java.sql.DatabaseMetaData provides the methods ....Just as long as the relationships are simple and the database and driver are known. For example there is no way that it is going to be able to tell you about a trigger that connects two tables.

  • Do you know of a standard tool to compare the fields of 2 database tables?

    do you know of a standard tool to compare the fields of 2 database tables? please note i dont want to compare data just the fields.
    ~Suresh

    Hi,
    I am not aware any standard tool but you can write custom report to use FM DDIF_FIELDINFO_GET to get fields information of SAP database table.
    Call the above FM twice in order to get field names for two different database tables. Then compare the results (table parameter DFIES_TAB) to find out the differences of field names.
    Hope this will help ...
    Regards,
    Ferry Lianto

  • Count of records/rows in a Table

    Hi
    This could be a basic question , but i don't have an idea how to do that .
    Could you please tell me , how get an count of records/rows in a specific table ?
    Thank you
    Luke

    sb92075 wrote:
    It takes time to get count of records if the table size is hugCan YOU count to 1000000000000000000 as quickly as you count to 10?????????????????????????
    If it takes you longer to count many things, why do you expect Oracle to do better than you?Really??
    Let's try some counts and see.
    First off, let's count a few 1000 rows.
    SQL> set timing on
    SQL> select count(*) from all_objects;
      COUNT(*)
         45045
    Elapsed: 00:00:17.08So 17 seconds for 45,000 rows.
    Now if you're logic is correct, counting let's say a few billion rows, should take an hour? Perhaps more?
    Here's what I see on one of my larger tables:
    SQL> select count(*) from daily_xxxxxxx;
      COUNT(*)
    2569780329
    Elapsed: 00:00:10.03Oops... it is faster.
    Get a clue!I hereby sincerely apologise that my database does not adhere to your fine logic that says it should take a few hours - I will speak disapprovingly to the CBO for allowing the 2nd select count (on the same database) to be faster than the 1st select count. I will even use the backchannel to inform Larry that this is not acceptable.
    Of course, this is assuming that you do not have your head stuck up somewhere and are indeed correct that it takes a "+looooonnngggg+" time to count lots of rows.
    !http://smileyicons.net/smilies/actions1.gif!

Maybe you are looking for