Calss

Hi.
what is the use of CLASS in ABAP. is this is same as c++.
please explain how to use this in ABAP.

Hi
Both are same. No Big differences between them. Check this about class
Classes are templates for objects. Conversely, you can say that the type of an object is the same as its class. A class is an abstract description of an object. You could say that it is a set of instructions for building an object. The attributes of objects are defined by the components of the class, which describe the state and behavior of objects.
<u><b>Local and Global Classes</b></u>
Classes in ABAP Objects can be declared either globally or locally. You define global classes and interfaces in the Class Builder (Transaction SE24) in the ABAP Workbench. They are stored centrally in class pools in the class library in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes. Local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined. When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, it then looks for a global class. Apart from the visibility question, there is no difference between using a global class and using a local class.
There is, however, a significant difference in the way that local and global classes are designed. If you are defining a local class that is only used in a single program, it is usually sufficient to define the outwardly visible components so that it fits into that program. Global classes, on the other hand, must be able to be used anywhere. This means that certain restrictions apply when you define the interface of a global class, since the system must be able to guarantee that any program using an object of a global class can recognize the data type of each interface parameter.
The following sections describe how to define local classes and interfaces in an ABAP program. For information about how to define local classes and interfaces, refer to the  Class Builder section of the ABAP Workbench Tools documentation.
<u><b>Defining Local Classes</b></u>
Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS ... ENDCLASS. A complete class definition consists of a declaration part and, if required, an implementation part. The declaration part of a class <class> is a statement block:
CLASS <class> DEFINITION.
ENDCLASS.
It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data. You should therefore place it at the beginning of the program.
If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
CLASS <class> IMPLEMENTATION.
ENDCLASS.
The implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding that is not itself part of a processing block is therefore not accessible.
<b><i>Structure of a Class</i></b>
The following statements define the structure of a class:
A class contains components
Each component is assigned to a visibility section
Classes implement methods
The following sections describe the structure of classes in more detail.
<u><b>Class Components</b></u>
The components of a class make up its contents. All components are declared in the declaration part of the class. The components define the attributes of the objects in a class. When you define the class, each component is assigned to one of the three visibility sections, which define the external interface of the class. All of the components of a class are visible within the class. All components are in the same namespace. This means that all components of the class must have names that are unique within the class.
There are two kinds of components in a class - those that exist separately for each object in the class, and those that exist only once for the whole class, regardless of the number of instances. Instance-specific components are known as instance components. Components that are not instance-specific are called static components.
In ABAP Objects, classes can define the following components. Since all components that you can declare in classes can also be declared in interfaces, the following descriptions apply equally to interfaces.
<u><b>
Attributes</b></u>
Attributes are internal data fields within a class that can have any ABAP data type. The state of an object is determined by the contents of its attributes. One kind of attribute is the reference variable. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
<u><b>Instance Attributes</b></u>
The contents of instance attributes define the instance-specific state of an object. You declare them using the DATA statement.
<u><b>
Static Attributes</b></u>
The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.
All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.
<b><u>Methods</u></b>
Methods are internal procedures in a class that define the behavior of an object. They can access all of the attributes of a class. This allows them to change the data content of an object. They also have a parameter interface, with which users can supply them with values when calling them, and receive values back from them The private attributes of a class can only be changed by methods in the same class.
The definition and parameter interface of a method is similar to that of function modules. You define a method <met> in the definition part of a class and implement it in the implementation part using the following processing block:
METHOD <meth>.
ENDMETHOD.
You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules). You call methods using the CALL METHOD statement.
<u><b>
Instance Methods</b></u>
You declare instance methods using the METHODS statement. They can access all of the attributes of a class, and can trigger all of the events of the class.
<b><u>Static Methods</u></b>
You declare static methods using the CLASS-METHODS statement. They can only access static attributes and trigger static events.
<u><b>Special Methods</b></u>
As well as normal methods, which you call using CALL METHOD, there are two special methods called CONSTRUCTOR and CLASS_CONSTRUCTOR, which are automatically called when you create an object (CONSTRUCTOR) or when you first access the components of a class (CLASS_CONSTRUCTOR).
<u><b>Events</b></u>
Objects or classes can use events to trigger event handler methods in other objects or classes. In a normal method call, one method can be called by any number of users. When an event is triggered, any number of event handler methods can be called. The link between the trigger and the handler is not established until runtime. In a normal method call, the calling program determines the methods that it wants to call. These methods must exist. With events, the handler determines the events to which it wants to react. There does not have to be a handler method registered for every event.
The events of a class can be triggered in the methods of the same class using the RAISE EVENT statement. You can declare a method of the same or a different class as an event handler method for the event <evt> of class <class> using the addition FOR EVENT <evt> OF <class>.
Events have a similar parameter interface to methods, but only have output parameters. These parameters are passed by the trigger (RAISE EVENT statement) to the event handler method, which receives them as input parameters.
The link between trigger and handler is established dynamically in a program using the SET HANDLER statement. The trigger and handlers can be objects or classes, depending on whether you have instance or static events and event handler methods. When an event is triggered, the corresponding event handler methods are executed in all registered handling classes.
<u><b>Instance Events</b></u>
You declare instance events using the EVENTS statement. An instance event can only be triggered in an instance method.
<u><b>Static Events</b></u>
You declare static events using the CLASS-EVENTS statement. All methods (instance and static methods) can trigger static events. Static events are the only type of event that can be triggered in a static method.
<b><i>See also Triggering and Handling Events.</i></b>
<u><b>Types</b></u>
You can define your own ABAP data types within a class using the TYPES statement. Types are not instance-specific, and exist once only for all of the objects in a class.
<u><b>Constants</b></u>
Constants are special static attributes. You set their values when you declare them, and they can then no longer be changed. You declare them using the CONSTANTS statement. Constants are not instance-specific, and exist once only for all of the objects in a class.
<u><b>Visibility Sections</b></u>
You can divide the declaration part of a class into up to three visibility areas:
CLASS <class> DEFINITION.
  PUBLIC SECTION.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.
These areas define the external visibility of the class components, that is, the interface between the class and its users. Each component of a class must be assigned to one of the visibility sections.
<u><b>Public Section</b></u>
All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.
<u><b>Protected Section</b></u>
All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses. Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section.
<u><b>Private Section</b></u>
Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.
<u><b>Encapsulation</b></u>
The three visibility areas are the basis for one of the important features of object orientation - encapsulation. When you define a class, you should take great care in designing the public components, and try to declare as few public components as possible. The public components of global classes may not be changed once you have released the class.
For example, public attributes are visible externally, and form a part of the interface between an object and its users. If you want to encapsulate the state of an object fully, you cannot declare any public attributes. As well as defining the visibility of an attribute, you can also protect it from changes using the READ-ONLY addition.
Reward all helpfull answers
Regards
Pavan

Similar Messages

  • Its urgent  how to use calss file of jar located in lib folder

    how to use calss file of jar located in lib folder.
    i want to use RowSetDynaClass class which is in beanutil jar file which is in my lib folder .if i use that class in my jsp following error is coming.
    Class RowSetDynaClass not found.
    RowSetDynaClass resultSet = new RowSetDynaClass(rs, false);
    how to access class in jar file.
    please help

    You have to either refer to the class in its fully quallified name, or import it into the JSP:
    <%
      some.full.packagename.RowSetDynaClass resultSet = new some.full.packagename.RowSetDynaClass(rs,false);
      ...-or-
    <%@ page import="some.full.packagename.RowSetDynaClass" %>
    <%
      RowSetDynaClass resultSet = new RowSetDynaClass(rs, false);
      ...As long as the class has public visibility and you have re-started the server/servlet context since you added the JAR.

  • How to restore the calsses I lost under oracle/jdeveloper/html?

    I use class wizard to create a class which extends oracle.jdeveloper.html.HTMLFieldRendererImpl and can't find it under the oracle/jdeveloper/html package. There are only two classes there : HTMLForm and HTMLElement. I remember there were many calsses there including HTMLFieldRendererImpl. If I lost them, how can I restore them? Thanks.

    As well as having had this problem a couple of times on different machines, both immediately after upgrades, I also use the synch capability so that tab groups from more than one machine can be accessed from any of the others - a really useful capability. It's really frustrating to have lost everything and have to try to recreate things from history. It occurs to me that the contents of my sets of groups are stored on a synch server somewhere so they ought to be recoverable from the hopefully, periodic automatic server backups - only problem is, how to access them? unlikely to be possible at this stage!
    In this context, a useful enhancement would be a capability to make user-created named backups of all current groups of tabs which could later be restored at will; any upgrade process should also automatically create such a backup for the user so that the problem of lost groups of tabs would be solved. In addition it would give users additional flexibility to create groups of groups - accessed by the save/restore mechanism - say for development, personal or social or whatever.

  • Abstract calss vs interface

    hi all,
    what are the pros and cons of abstract calss and interface?
    when to use abstract class and when to use interface???
    thanks.

    You know, I think that this question may have been asked a time or two before and that if you search the forum, you may get a couple of hits on this, some even useful.

  • G/L Account Asignment to Valuation calss

    Hi all ,
    Where do we assign G/L A/c assignment to valuation class and
    ex : during goods reciept for 101 , how are posting keys determined ?
    what is the relevance of feild status group in Account determination
    89 for Inventory
    86 for GR/IR... etc
    thanks
    ksr

    Hi,
    G/L acc. are assigned to valuation class in Tcode OBYC.
    Field status group:
    Field Status Group determines the screen layout for Document Entry for the GL Account.
    On the basis of Field Status Group you can make field as:
    1.Supress
    2.Hidden
    3.Optional
    4.Required
    Regards,
    Abhee.

  • Deploying BMP Entity Bean with primary key calss

    Hi,
    I am using EJB 2.0 with and websphere studio 5.0 and database is sql server 2000.
    My BMP Entity bean has a primary key class.From my client I am invoking the Entity Bean by calling it's findbyprimarykey method.
    The home interface of my findbyprimarykey method returns a class of type Remote.But in the Entity Bean class,the return type is the primarykey class type.
    My problem is invoking this findbyprimarykey from the client to get the remote interface so that the other business methods of the entity bean can be called.
    The control goes into the ejbFindbyPrimaryKey but when it is returing from the Entity Bean class,it gives a remote exception (as the return type in Entity Bean class and Home interface are different for the findbyprimarykey method).
    I think that somewhere in the deployment decriptor in my websphere,i have to specify the primarykey class type,which i am missing out and hence getting the error.
    Please help me out with your advice and solution.
    Thanks
    Rahul Priyadarshi

    Hi,
    Sorry to disturb you again.
    Even my code is also almost the same....i am pasting the code below...Please go through it and let me know if I have made any mistake..
    EditVendorEntityBean.....(Bean Class)
    package code.beans.EditVendor;
    import code.beans.dataAccess.*;
    import javax.ejb.CreateException;
    import javax.ejb.RemoveException;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import javax.ejb.EJBException;
    import javax.ejb.FinderException;
    import javax.ejb.ObjectNotFoundException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import java.sql.*;
    import javax.sql.*;
    import java.util.*;
    * Bean implementation class for Enterprise Bean: EditVendorEntity
    public class EditVendorEntityBean implements javax.ejb.EntityBean {
         private static Hashtable dataSources = new Hashtable();
         private String username;
    private int Vendor_ID;
    private int Category_Id;
    private String Category_Name;
    private String Vendor_Name;
    private String Vendor_Address1;
    private String Vendor_Address2;
    private String Contact_Name;
    private String Home_Phone;
    private String Work_Phone;
    private String email;
    private String faxno;
    private String userloginname;
    private boolean dirtyFlag = false;
    private EntityContext context;
    private static final String DS_NAME = "jdbc/spiPOPS";
    Connection con = null;
    Statement stmt = null;
    PreparedStatement st = null;
    ResultSet res = null;
         //***********************Business Methods*********************
    // Begin of Busines Methods
    public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax) {
              System.out.println("in setData where Vendor Id= "+ Vendor_ID);
                   boolean status=false;
                   boolean existing=false;
                   ArrayList cat=new ArrayList();
                   try
                        cat=getcategorylist(this.Vendor_ID);
                   catch(SQLException e)
                        System.out.println("Could not get category list");
                   System.out.println("Size of cat array -->" + cat.size() + " and string array size -->" + catname.length);
                   if(catname.length>0)
                        //Removing unwanted vendor categories for a particular vendor id
                        for(int i=0;i<cat.size();i++)
                                  existing=false;
                                  String tempdata=(String)cat.get(i);
                                  for(int j=0;j<catname.length;j++)
                                       if(tempdata.equals(catname[j]))
                                            existing=true;
                                  if(!existing)
                                       try
                                            delvencat(this.Vendor_ID,tempdata.trim());
                                       catch(SQLException e)
                                            System.out.println("Could not delete record in POPS_VENDOR_CATEGORY for -->" + tempdata);
                   //Adding new vendor categories for a particular vendor
                        try
                                  for(int i=0;i<catname.length;i++)
                                       status=false;
                                       String strcat=catname;
                                       status=checkcat(this.Vendor_ID,strcat.trim());
                                       if(!status)
                                            insertvencat(this.Vendor_ID,strcat.trim());
                        catch(SQLException e)
                                  System.out.println("Could not insert or select from POPS_VENDOR_CATEGORY table");
                   this.Vendor_Name          =vendorname;
              this.Vendor_Address1     =vendadd1;
              this.Vendor_Address2     =vendadd2;
              this.Contact_Name          =vendcontact;
              this.Work_Phone               =venoff;
              this.Home_Phone               =venres;
              this.email                    =mailid;
              this.faxno                    =venfax;
                   dirtyFlag = true;
                   System.out.println("Leaving set data method");
    public Vector getData() {
         Vector vctRec=new Vector();
         ArrayList arrdatas = new ArrayList();
         arrdatas.add(""+this.Vendor_ID);
         arrdatas.add(this.Vendor_Name);
         arrdatas.add(this.Vendor_Address1);
         arrdatas.add(this.Vendor_Address2);
         arrdatas.add(this.Contact_Name);
         arrdatas.add(this.Work_Phone);
         arrdatas.add(this.Home_Phone);
         arrdatas.add(this.email);
         arrdatas.add(this.faxno);
         vctRec.addElement(arrdatas);
         ArrayList cat=new ArrayList();
              try
              System.out.println("Calling getcategorylist from getdata with vendorid-->" + this.Vendor_ID);
              cat          = getcategorylist(this.Vendor_ID);
         catch(SQLException e)
                   System.out.println("Could not get datas for category list");
         vctRec.addElement(cat);
         ArrayList allcats=new ArrayList();
         try
                        allcats          = getallcategorylist();
              catch(SQLException e)
                        System.out.println("Could not get datas for category list");
         vctRec.addElement(allcats);
              dirtyFlag = false;
         System.out.println("Before return statement in getdata with vector size -->" + vctRec.size());
              return vctRec;
    // End of Business Methods
    //**************************Entity Bean Methods*******************************
         * ejbActivate
         public void ejbActivate() {
              Vendor_ID = Integer.parseInt((String)context.getPrimaryKey());
         System.out.println("Inside ejbActivate Vendor_ID-->"+ Vendor_ID);
         * ejbLoad
         public void ejbLoad() {
              System.out.println("Inside ejbLoad ********" );
    try {
    loadRow();
    }catch (Exception ex) {
              System.out.println("Failed in loadRow()");
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
         * ejbPassivate
         public void ejbPassivate() {
         System.out.println("Inside ejbPassivate " );
    Vendor_ID = 0;
         * ejbRemove
         public void ejbRemove() throws javax.ejb.RemoveException {
              //Empty Method
         * ejbStore
         public void ejbStore() {
    System.out.println("Inside ejbStore " );
    try {
    storeRow();
    }catch (Exception ex) {
              System.out.println("Exception thrown in storeRow" + ex.getMessage());
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
         * getEntityContext
         public javax.ejb.EntityContext getEntityContext() {
              return context;
         * setEntityContext
         public void setEntityContext(javax.ejb.EntityContext ctx) {
              System.out.println("Inside setEntityContext " );
    try{
         con = getConnection(DS_NAME);
         System.out.println("DB Connection Created!!");
    catch(Exception e){
    this.context = ctx;
         * unsetEntityContext
         public void unsetEntityContext() {
    System.out.println("Inside unsetEntityContext " );
    closeDbConnection(con, res, st);
    this.context = null;
         * ejbCreate
         //code.beans.EditVendor.EditVendorEntityKey
         public code.beans.EditVendor.EditVendorEntityKey ejbCreate(String vendorid)
              throws javax.ejb.CreateException {          
              return new EditVendorEntityKey(vendorid);
              //return null;
         * ejbPostCreate
         public void ejbPostCreate(String vendorid) throws javax.ejb.CreateException {
              //Empty
         * ejbFindByPrimaryKey
         //code.beans.EditVendor.EditVendorEntityKey
         public code.beans.EditVendor.EditVendorEntityKey ejbFindByPrimaryKey(
              code.beans.EditVendor.EditVendorEntityKey primaryKey)
              throws javax.ejb.FinderException {
    try {
    if(selectByPrimaryKey(Integer.parseInt(primaryKey.getVendorId()))) {
              System.out.println("Leaving the findbyprimarykey method from the entity bean");
         return primaryKey;
         //return null;
    }else {
         throw new ObjectNotFoundException
         ("Row for id " + primaryKey + " not found.");
    }catch (Exception ex) {
    throw new EJBException("EXCEPTION IN ejbFindByPrimaryKey :- " + ex.getMessage());
         /*********************** Database Utility Routines *************************/
    private boolean selectByPrimaryKey(int priKey)
    throws SQLException {
         System.out.println("inside selectByPrimaryKey for primary key " + priKey);
    String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR WHERE VENDOR_ID = " + priKey;
    System.out.println("in selectByPrimaryKey where queryString is: "+ queryStr);
              stmt = con.createStatement();
    ResultSet result = stmt.executeQuery(queryStr);
    if(!result.next()) {
    stmt.close();
         System.out.println("Did not find "+priKey);
    return false;
    else { //Found the primaryKey
    Vendor_ID = result.getInt("VENDOR_ID");
    stmt.close();
    return true;
    private void loadRow() throws SQLException {
              System.out.println("inside loadRow ...");
              stmt = con.createStatement();
              String queryStr = "SELECT VENDOR_NAME,VENDOR_ADDRESS1,VENDOR_ADDRESS2,CONTACT_NAME,HOME_PHONE,WORK_PHONE,EMAIL_ID,FAX_NO " +
                                  "FROM POPS_VENDOR WHERE VENDOR_ID=" + Vendor_ID;
              System.out.println("Inside loadRow()***********"+queryStr);
              ResultSet result = stmt.executeQuery(queryStr);
              ArrayList catadatas=new ArrayList();
         if(!result.next())
         throw new SQLException("No record for primary key" + Vendor_ID);
              this.Vendor_ID               =Vendor_ID;
                        this.Vendor_Name          =result.getString("VENDOR_NAME");
                        this.Vendor_Address1     =result.getString("VENDOR_ADDRESS1");
                        this.Vendor_Address2     =result.getString("VENDOR_ADDRESS2");
                        this.Contact_Name          =result.getString("CONTACT_NAME");
                        this.Home_Phone               =result.getString("HOME_PHONE");
                        this.Work_Phone               =result.getString("WORK_PHONE");
                        this.email                    =result.getString("EMAIL_ID");
                        this.faxno                    =result.getString("FAX_NO");
                             System.out.println("Leaving loadrow method with loaded datas for vendor -->" + Vendor_ID);
                             stmt.close();
    private ArrayList getcategorylist(int vendor) throws SQLException{
              String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID=" + vendor;
              System.out.println("Query for the cat list --> " + queryStr);
              stmt = con.createStatement();
              ResultSet result = stmt.executeQuery(queryStr);
              ArrayList catdatas=new ArrayList();
    try{
                   while(result.next())
                        catdatas.add(result.getString("VENDOR_CAT"));
              catch (SQLException e){
                   stmt.close();
                   System.out.println("Could not retrieve datas for Category list");
              stmt.close();
              System.out.println("size off array for cat -->" + catdatas.size() + " and datas ->" + catdatas);
              return catdatas;
         private ArrayList getallcategorylist() throws SQLException{
                   //String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY";
                   StringBuffer strquery=new StringBuffer(20);
                   strquery.append("SELECT DISTINCT(CATEGORY_NAME) FROM POPS_CATEGORY");
                   stmt = con.createStatement();
                   //ResultSet result = stmt.executeQuery(queryStr);
                   ResultSet result = stmt.executeQuery(strquery.toString());
                   ArrayList catdatas=new ArrayList();
                   try{
                        while(result.next())
                                  //catdatas.add(result.getString("VENDOR_CAT"));
                                  catdatas.add(result.getString("CATEGORY_NAME"));
                   catch (SQLException e){
                             stmt.close();
                             System.out.println("Could not retrieve datas for All Category list");
                   stmt.close();
                   return catdatas;
         private void delvencat(int vendor,String vencat) throws SQLException {
              int update=-1;
              stmt = con.createStatement();
              String queryStr ="DELETE FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + vencat.toUpperCase() + "'";
              System.out.println("Delete query --> " + queryStr);
              update= stmt.executeUpdate(queryStr);
              if(update!=1)
                   System.out.println("Did not find data to delete");
              stmt.close();
         private void insertvencat(int vendor,String vencat) throws SQLException {
              int update=-1;
              String queryStr ="INSERT INTO POPS_VENDOR_CATEGORY(VENDOR_ID,VENDOR_CAT)" +
                                  " VALUES(" + vendor +",'" + vencat + "')";
              System.out.println("Insert query --> " + queryStr);
              stmt = con.createStatement();
              update=stmt.executeUpdate(queryStr);
              if(update!=1)
                   System.out.println("Could not insert records in the database");
              stmt.close();
         private boolean checkcat(int vendor,String catven) throws SQLException {
              boolean datastatus=false;
              String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + catven.toUpperCase() + "'";
              stmt = con.createStatement();
              ResultSet result = stmt.executeQuery(queryStr);
              datastatus=result.next();
              stmt.close();
              return datastatus;
    private void storeRow() throws SQLException {
                   System.out.println("Inside ejb store");
         if (!dirtyFlag) {
         System.out.println("Skipping the UPDATE because object is not dirty");
         return;
         CallableStatement cs=null;
    try{
                        cs = con.prepareCall("EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
                        System.out.println("\n\n SQL Statement : \n " + "EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
                        cs.executeUpdate();
              catch (SQLException e){
                        cs.close();
                        System.out.     println("\n\n Error in calling stored procedure POPS_INSERT_NEW_REQUEST \n\n"+ e.getMessage() + "\n\n");
              cs.close();
              dirtyFlag = false;
         private Connection getConnection(String dbName) throws SQLException
              String configuredDataSourceName = null;
              if (dbName == null) {
                   System.out.println("Attemp to get connection failed. The requested database name is null");
              DataSource dbSource = getDataSource(dbName);
              return dbSource.getConnection();
         private DataSource getDataSource(String dbName)
              // looking from cache;
              DataSource dbSource = (DataSource) dataSources.get(dbName);
              if (dbSource == null) { //we need to find it from JNDI
                   try {
                        Context ic = new InitialContext();
                        dbSource = (DataSource) ic.lookup(dbName);
                        dataSources.put(dbName, dbSource);
                   }catch (NamingException e){
              return dbSource;
         * User calls this function to safely close an connection
         * @param connt The connection a datasource
         * @param rs The resulSet inside this connection
         * @param statement The statement associate with this connection
         private void closeDbConnection(Connection cont,ResultSet rs,Statement statement)
              if (rs != null)
              try {
                        rs.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
              if (statement != null)
                   try {
                        statement.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
              if (cont != null)
                   try {
                        cont.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
         } //closeDbConnection
    EditVendorEntity (Remote Interface)
    package code.beans.EditVendor;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    import java.util.*;
    * Remote interface for Enterprise Bean: EditVendorEntity
    public interface EditVendorEntity extends javax.ejb.EJBObject {
         public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax)
                   throws RemoteException;
    public Vector getData() throws RemoteException;
    EditVendorEntityHome (Home Interface)
    package code.beans.EditVendor;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import javax.ejb.DuplicateKeyException;
    import javax.ejb.EJBHome;
    import java.util.*;
    * Home interface for Enterprise Bean: EditVendorEntity
    public interface EditVendorEntityHome extends javax.ejb.EJBHome {
         * Creates an instance from a key for Entity Bean: EditVendorEntity
         public code.beans.EditVendor.EditVendorEntity create(String vendorid)
              throws javax.ejb.CreateException, java.rmi.RemoteException;
         * Finds an instance using a key for Entity Bean: EditVendorEntity
         public code.beans.EditVendor.EditVendorEntity findByPrimaryKey(
              code.beans.EditVendor.EditVendorEntityKey Vendor_ID)
              throws javax.ejb.FinderException, java.rmi.RemoteException;
    EditVendorEntityKey (Primary Key Class)
    package code.beans.EditVendor;
    * Key class for Entity Bean: EditVendorEntity
    public class EditVendorEntityKey implements java.io.Serializable {
         static final long serialVersionUID = 3206093459760846163L;
         public String primkey;
         * Creates an empty key for Entity Bean: EditVendorEntity
         public EditVendorEntityKey() {  }
         public EditVendorEntityKey(String primarykey) {     
              this.primkey=primarykey;
         public String getVendorId() {
    return primkey;
         * Returns true if both keys are equal.
         public boolean equals(java.lang.Object otherKey) {
              if (otherKey instanceof code.beans.EditVendor.EditVendorEntityKey) {
                   code.beans.EditVendor.EditVendorEntityKey o =
                        (code.beans.EditVendor.EditVendorEntityKey) otherKey;
                   return (primkey.equals(otherKey));
              return false;
         * Returns the hash code for the key.
         public int hashCode() {
              return (primkey.hashCode());
    Please go through and give me your comments and solution...
    Thanks in advance
    Rahul

  • Need info regarding calss extending AbstractSessionBean

    I have a JSF application and in one of my class �MainSessionBean extends AbstractSessionBean� and this bean is defied as session scope in the managed-bean.xml
    In this class MainSessionBean there are some methods like
    public void init() ,
    private void _init()
    public void passivate() ,
    public void destroy()
    The comment says these mathods are created automatically.
    These methods have lots of initialization code like setting data source, transaction attributes etc. And no where in my application these methods are called. When I tried to create similar java class I�m not able to create any of these methods. Is this IDE specific? How are these methods created?
    I�m using the RAD and websphere application server 6.1.

    I think you are confusing an EJB session bean with a JSF managed bean with scope of session.

  • Data is not updating in calss & Convert vi reference to strictly type reference vi

    Hi,
    In the attached project file there is a Class called 'ClassSample.lvclass' having 3 different data types Boolean, Numeric and Variant(not really sure, Variant can be use for strict data type reference). From this three we careated the 'VIs for data member access' you can see them in project file
    My questions are,(Please refer attached screenshot)
    1. Though member of same class, why value is not updating at probe 16 ?
    2. How to convert vi reference to strictly type reference vi ?
    Thank you.
    Attachments:
    Capture.JPG ‏426 KB
    ClassSample Project.zip ‏116 KB

    It depends a bit on your final intention. Bascially you have a shared state that you want to access asynchronously from different places. If you know that the actual object is only created once (terminilogie here is a bit shaky as every wire split would create a copy of the LVOOP object but I hope you know what I mean), you could use a global or Action Engine to store the state. Using a DVR for this state and adding the DVR to your object class data is however a more scalable approach as it will allow you to instantiate more than one object of that class and each one will contain its own DVR that will reference the same value for the specific object instance even if you split the object wire, creating actually two copies of that object (but for the purpose of this discussion they would be still the same object instance).
    Queues could work if you create a single element queue but you would always need to use Preview Queue rather than Dequeue in order to maintain the value in there.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Where to place application classes to override shared calsses?

    I use web application which requires to override some of shared classes. Where should I place these classes? It is necessary to override these classes in this application only. Placing it in WEB_INF/classes subdirectory inside web application folder has no effect. The only way I have found - to place these classes inside APPS subdirecory. But in this way all deployed applications will use these new classes. Can anyone help me?
    Thanks in advance,
    Vadim Lotarev

    Put these classes in WEB-INF/classes and enable dynamic reloading. To do that-
    open krededit-> SOFTWARE-> iplanet-> Application Server->6.0->CCS0->SYSTEM_JAVA->Versioning and set it to 0. Bydefault it is 1, disabled. And restart the iAS to pickup this change.
    Or, redeploy the application.
    Hope this would help.
    Should you have any question further, get back.
    Thanks,
    Rakesh.

  • Student with maximun calsses

    I have a question, can you guys plz look into this.
    Two tables student and class. I want to pull the data for the student with maximum number of classes
    I am using
    select student_name, count(*)
    from student, class
    group by student_name
    The above query will give me all the students and there number of classes.
    I only want to get the name of the student with maximum number of classes(only 1 row) and i cant use rownum.
    Can anyone please look into this and throw some light on how to get the query.

    Salim Chelabi  wrote:
    YesWell, ok, one table scan, but one more step - VIEW - according to the explain plan. Still better to avoid the subquery.
    SQL> explain plan for
      2  select max(dname) keep (dense_rank last order by count(*)) deptno
      3  from   dept, emp
      4  where  dept.deptno=emp.deptno
      5  group by dname;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    Plan hash value: 4041873517
    | Id  | Operation                      | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |         |     1 |    16 |     7  (29)| 00:00:01 |
    |   1 |  SORT AGGREGATE                |         |     1 |    16 |     7  (29)| 00:00:01 |
    |   2 |   HASH GROUP BY                |         |     1 |    16 |     7  (29)| 00:00:01 |
    |   3 |    MERGE JOIN                  |         |    14 |   224 |     6  (17)| 00:00:01 |
    |   4 |     TABLE ACCESS BY INDEX ROWID| DEPT    |     4 |    52 |     2   (0)| 00:00:01 |
    |   5 |      INDEX FULL SCAN           | PK_DEPT |     4 |       |     1   (0)| 00:00:01 |
    |*  6 |     SORT JOIN                  |         |    14 |    42 |     4  (25)| 00:00:01 |
    |   7 |      TABLE ACCESS FULL         | EMP     |    14 |    42 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       6 - access("DEPT"."DEPTNO"="EMP"."DEPTNO")
           filter("DEPT"."DEPTNO"="EMP"."DEPTNO")
    20 rows selected.
    SQL> explain plan for
      2  select max(dname) keep (dense_rank last order by ct) deptno
      3  from   (select dept.dname, count(*) ct
      4          from   dept, emp
      5          where  dept.deptno=emp.deptno
      6          group by dname);
    Explained.
    SQL> select * from table(dbms_xplan.display);
    Plan hash value: 3958887906
    | Id  | Operation                       | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |         |     1 |    22 |     7  (29)| 00:00:01 |
    |   1 |  SORT AGGREGATE                 |         |     1 |    22 |            |          |
    |   2 |   VIEW                          |         |     4 |    88 |     7  (29)| 00:00:01 |
    |   3 |    HASH GROUP BY                |         |     4 |    64 |     7  (29)| 00:00:01 |
    |   4 |     MERGE JOIN                  |         |    14 |   224 |     6  (17)| 00:00:01 |
    |   5 |      TABLE ACCESS BY INDEX ROWID| DEPT    |     4 |    52 |     2   (0)| 00:00:01 |
    |   6 |       INDEX FULL SCAN           | PK_DEPT |     4 |       |     1   (0)| 00:00:01 |
    |*  7 |      SORT JOIN                  |         |    14 |    42 |     4  (25)| 00:00:01 |
    |   8 |       TABLE ACCESS FULL         | EMP     |    14 |    42 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       7 - access("DEPT"."DEPTNO"="EMP"."DEPTNO")
           filter("DEPT"."DEPTNO"="EMP"."DEPTNO")
    21 rows selected.
    SQL>Nicolas.

  • Calss path in tomcat

    Is there anyway to put the classes not in the standart classes lib (WEB-INF\classes) and configure the new location??

    You are aware of WEB-INF/lib too, aren't you? That is on application level.
    Besides, the server itself has locations for common usage. Cf. the documentation. Watch out, some libs are used by the engine itself and not by the very applications.

  • Stub referance to calss by package full path

    i managed to create client stubs from xml configuration file...
    (i prefer to do that directly from the WSDL file)
    it's working fine..
    i am importing the generated stub files to eclipse IDE
    when i like to change the pakage name were the stub files located
    i am getting errors
    because the stubs files reference each other by full package name
    example :
    system.service.SystemImplServise = new .....the is an option or way to cancel that?
    thanks..
    i got lot of questions :)

    Are you using JAXRPC based service or JAXWS based service ?
    For JAXWS based services, you can use customization files when you run wsimport against the WSDL. HEre is a sample customization file :
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <bindings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    wsdlLocation="./SubtractNumbers.wsdl"
    xmlns="http://java.sun.com/xml/ns/jaxws">
    <bindings node="ns1:definitions"
    xmlns:ns1="http://schemas.xmlsoap.org/wsdl/">
    <package name="endpoint"/>
    </bindings>
    <bindings node="ns1:definitions/ns1:types/xsd:schema[@targetNamespace='http://duke.org']" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/">
    <jaxb:schemaBindings>
    <jaxb:package name="endpoint"/>
    </jaxb:schemaBindings>
    </bindings>
    </bindings>

  • LInk Between Equipment & calss type

    hi! All
         is there any Link between Equipment no. and Class type of it. Bz i need to fetch the class type for a Equipment No. to fetch its class attributes details.
    Thanks and Regards,
    Kv

    Hi Kv,
    AUSP - Character values
    KSML - Character of a class
    KLAH - Class Header
    KSSK - Object to class
    CABN - Characteristics
    KLAT - Class Header text
    EQUI - Equipments
    EQUI - Equipment time segments
    EQKT - Equipment texts
    try to relate these tables with OBJEK, CLINT, ATINN, EQUNR, HEQUI, IMERK
    The link goes linke this,,,
    EQUI-> KSSK->KLAH>CABN/KSML->AUSP.
    here OBJEK = EQUNR
    Hope this helps..
    Thanks & regards,
    Dileep .C

  • Use of singleton calss

    hi
    can any one tell me
    singleton class: -- we cant create object directly from out side, using factory method we can create object for that class.
    that means we are creating the object for singleton class.
    my doubt is why we go singleton class in sted of create the object directly using new key word.
    what is the difference between using singleton factory method to create object and using new key word to create object.
    thanks in advance.

    You're mixing up the factory method pattern and the singleton pattern here. Probably because most people implement their singletons using a factory method as well. The reason we use singletons (those of us who still do) is to ensure that only one instance of a class can exist. There are several reasons to use factory methods. We might want to optionally create an instance of a subclass, for example. Or give the methods meaningful names that a mere constructor can't communicate.

  • Upload security calss ID usding LSMW

    Dear all,
    I want to convert legacy data to new SAP CFM 2.0 using LSMW. When execute the step 'Start IDoc Processing', the system issue a error 'The IDoc interface is not complete for message type FINANCIALPRODUCTSEM_GETDETAIL'.
    I am not familar with the IDOC configuration. Could you pls give some comments?
    Many many thanks!
    Tiger Shen

    t
    Edited by: Sudhanshu Sharma on Feb 19, 2008 11:09 AM

Maybe you are looking for