Regarding persistent classes  & objects

Hi all,
I am new to abap objects, please  give me some simple links of persistent classes & object.
Let me know the difference between persistent classes & other simple classes..
I ensure you for points!
cheers.

Hi,
Transient and persistent data
In principle, ABAP programs work with local program data, which resides in the program’s internal session. This data lives only as long as its context – that is, as long as its associated procedure (for local procedure data); its object (for attributes of classes); or its program (for global program data). This data is known as transient. Data that can be preserved beyond the runtime of the program is known as persistent. In SAP Systems, persistent data usually occurs as the content of database tables, but also as the content of files on application and presentation servers.
To work with persistent data, the system has to load it into transient data objects belonging to the ABAP program while that program is being executed. Then, after processing has been completed, it stores the data in a persistent form again. During this time, the content of the data exists twice: once in the ABAP program (transiently), and once in the appropriate storage medium (persistently). A typical process would be reading data from a database table using the SELECT statement into a transient work area; modifying the work area; and then updating the database table (using UPDATE). In such cases, the contents of transient and persistent data are different in the interim during this process.
Data in object-oriented programming
In an ideal object-oriented application, data occurs only as the attributes of objects (if we ignore the local data in methods for the time being). Objects are an aggregation of functions (in methods) and data (in attributes). The description of an object – that is, the class – occurs persistently as a piece of source code, but its attributes exist only as long as the object. However, an object in ABAP Objects is transient in principle. It exists in the internal program session only from the time it is generated (using CREATE OBJECT) until it is deleted by the Garbage Collector. Therefore, to work with persistent data in objects, you must program access to where those objects are stored within the methods of the class.
However, in completely object-oriented business application programming, then it is pointless simply to transfer the classical separation of data and functions to the methods – that is, to work with objects, but use procedural programming within the objects themselves. Ideally you could save the encapsulation of data and functions persistently within the object instead. A program could then leave an object in a certain state and a second program could continue working on the object in that state. Classes of objects are already persistent anyway, but you need some way of saving the attributes of an object persistently and then make reference to the appropriate class. The Persistence Service allows you to do exactly that.
Persistent Classes
To use the Persistence Service for objects, the classes of these objects must be created as persistent classes in the Class Builder. The term persistent class does not imply that a class is persistent. (As a template for objects, every class is persistent). Rather, it means that the objects of that class and their state are managed by the Persistence Service. For example, the objects of these classes are instantiated in the ABAP program with a method of the Persistence Service, which ensures that the initialization is correct (not with the usual CREATE OBJECT statement). When the Class Builder creates a persistent class, it automatically generates an associated class, known as the class actor or class agent, whose methods manage the objects of persistent classes. As well as their identity, persistent classes can contain key attributes, which allow the Persistence Service to ensure that the content of each persistent object is unique.
Managed Objects
The objects of persistent classes are managed by the Persistence Service. This means, among other things, that these objects are instantiated with a method of the class actor, not with the CREATE OBJECT statement. These objects are known as managed objects. Objects managed by the Persistence Service can be either persistent or transient.
Persistent objects must be managed by the Persistence Service. The Persistence Service connects the object and the database.
Transient objects of persistent classes are also managed by the Persistence Service. For example, the Persistence Service ensures that the object is unique within a program (by checking its key attributes), but not for a connection to the database.
Plz refer to this link:
http://help.sap.com/saphelp_nw70/helpdata/en/f5/a3682ebc6911d4b2e80050dadfb92b/content.htm
Thanks,
Samantak.
Rewards points for useful answers.

Similar Messages

  • Regarding Wrapper class objects

    I know that we've to use equals() method in place of '==' to compare two objects. but some one pls explain me how the following code snippet works. Is here anything is related to auto boxing?
    Integer j1 = 127;
    Integer j2 = 127;
    System.out.println( j1==j2); //Works!!!
    Integer k1 = 128;
    Integer k2 = 128;
    System.out.println( k1==k2); //Doesn't Work!!!
    Integer w1 = -128;
    Integer w2 = -128;
    System.out.println( w1==w2); //Works!!!
    Integer m1 = -129;
    Integer m2 = -129;
    System.out.println( m1==m2); //Doesn't Work!!!

    Diablo_Chiru wrote:
    yeah i know that thing but i don't know why it is
    giving the correct result for these two?
    System.out.println( j1==j2); //Works!!!
    System.out.println( w1==w2); //Works!!!and contradicing result for the following?
    System.out.println( m1==m2); //Doesn't Work!!!
    System.out.println( k1==k2); //Doesn't Work!!!can u expain it in details ? pls
    DiabloI tried to avoid answering that since you the get VM dependent. The documentation says that some values might be cached, and values in the range -128 to 127 must be cached according to the specification. Other values can also be cached, so your later comparisions might return true in the future.
    Kaj

  • Change documents with persistent class

    Hi,
    I have created a persistent class and want to use a set-method to change data in the mapped table - nothing special.
    But: Does anybody know if there's a possibility to write change documents for the changed field without calling FMs like CHANGEDOCUMENT_SINGLE_CASE?
    There would be the event if_os_state~changed but unfortunately no information about the changed field itself is available in this event. Is it possible to redefine events?
    Thanks a lot for each answer!
    Best regards
    Jörg

    Hi Narin,
    thanks for your answer!
    The first point is plain to me (although I don't really feel happy about this ) but I have problems understanding your second point because I don't really know what "Business object events" are... I'll try a different phrasing, maybe this is better:
    My persistent class inherits the event if_os_state~changed. Can I redefine this event in my class so that I can add an additional parameter where I can put the information about the changed attribute?
    Jörg

  • OO Design--do ABAP Persistent Classes make sense for ALV reports in NW2004?

    Hello experts,
    At our company, we started using ABAP OO in the last year.
    I am on NW-2004 .  We just acquired a business that is on 4.6C.
    We have a lot of customization to bring into our system. There are a lot of reports with common queries that span multiple tables.
    I would like to follow the best practice for OO design and create global classes for the data access layer  the business logic layer and the UI layer.  For the UI layer, I will be utilizing the SALV class, since NW2004 doesn't have ABAP WebDynpro (we don't have a java stack available for development and software change management).
    For the data access layer,  I would like to use the persistent classes,  but without the query manager, it just doesn't make sense.
    Thomas Jung said in a blog that he sometimes used SQL to get the keys and then used persistent classes to retrieve the remaining data.  But for straight ALV reporting, that just seems inefficient.  But it could be that I am just not familiar enough with the technology.
    I am looking for suggestions on how to design the data access layer for these intense  and commonly used queries.
    (Ironically, we will upgrade to NW2004s after this migration -- ouch!)
    All ideas are appreciated.
    Thanks.

    Hi Kimberly,
    the main advantage of persistent objects is that their state can be saved in the database. If a persistent object changes in your program, these changes can be reflected in the corresponding database field(s). Thus, persistent objects are very useful when doing CRUD (create, read, update and delete) operations with business objects.
    However, if you just want to read data (for simple reporting) but do not plan to implement any of the other CRUD operations, I doubt if a persistency layer is necessary since this causes extra effort during design time and runtime. In that case, simple SELECT statements seem to be more appropriate.
    Regards,
    David

  • Improving persistent class performance with on-demand DB reads?

    Hi,
    Something that has been troubling me for some time is the data access design of persistent classes. A persistent class loads the ENTIRE data set when it is instantiated.
    To me this defeats one of the advantages of get/set methods. What I would like is to be able to read data when it is first accessed.
    For example: A purchase order header can be loaded in a few ms. However with items it can take 10 times as long - even more if the items are implemented as persistent classes themselves. If items are only needed half the time, a significant performance gain is realized by only reading items the first time the GET_ITEMS method is called. In my own persistence implementations using BI_PERSISTENT (Nothing to do with ABAP Persistent Classes), I implement this using private attributes to buffer data, along the lines of:
    method get_items.
      if m_items[] is initial.
        m_items = <read and/or instantiate items>.
      endif.
      re_items = m_items.
    endif.
    Using ABAP Persistent Objects this does not appear to be possible since they insist on loading everything up front in the DB mapping or IF_OS_STATE~INIT methods. Is some kind of on-demand reading possible using ABAP Persistent Classes?
    Any input appreciated
    Cheers,
    Mike

    Hi Mike,
    yes, I am also very interested in this topic. While developing my first (and only a mid-complex) persistence application, I am expecting slightly different behaviour of linked persistent objects than you described above. According to the book 'Object Services in ABAP' and lazy loading paradigm mentioned there, the referenced persistent objects should be instantiated as representative objects only, containing no data, and the data should be physically loaded from database only once it's really needed (ie. accessed or explicitly instantiated). This should be the approach preventing the situation of mass chained instantiation of many linked persistent objects where most of them will not be needed, probably.
    This is what they say about instantiation of persistent objects that are linked by persistent references.
    However, since the persistent objects do not allow creating of 1:N relationships (classics: HEADER->ITEMS) via persistent references automatically, then this kind of relationship has to be maintained manually and therefore I expect you having full control of when it is accessed and instantiated for the first time...? What I want to ask here is then: is there any suitable approach which allows to maintain 1:N relationship fully or semi-automatically and which (as a disadvantage) makes the problem for you with 'full' instantiation? Am I missing something? There are also some threads Table attributes and persistent classes  regarding persistent mapping of table-like attributes, but no relevant answers (this should solve my problem as the table of persistent references could be saved then).
    Until now, I have found almost nothing about how the 1:N relationship should be correctly built (only 1:1 or M:1 is supported via persistent references), so I am applying the following approach in my app. Any comments are welcome (excuse some typos, as this is written in Notepad, not on the running system):
    ref_header = zca_header=>agent->create_persistent( ).
    guid_of_header_class = ref_header->get_cl_guid( )."cl_guid is set in IF_OS_STATE~INIT
    guid_of_header_instance =
      zca_header=>agent->if_os_ca_service~get_oid_by_ref( ref_header ).
    ref_header->set_inst_guid(                   "keep header inst. ref. for future lookups
    i_inst_guid = guid_of_header_instance
    lt_r_items = ref_header->create_items(       "lt_r_items = table of items references
      i_cl_guid = guid_of_header_class
      i_inst_guid = guid_of_header_instance
      it_items = lt_items )
    and the method zcl_header->create_items then looks somewhat like this:
    loop at it_items assigning <it_items>.
      ref_item = zca_item=>agent->create_persistent( ).
      ref_item->set_cl_guid( i_header_cl_guid = i_cl_guid ).
      ref_item->set_inst_guid( i_header_inst_guid = i_inst_guid ).
      ref_item->set_some_other_attrib(
        i_some_other_attrib = <it_items>-some_other_attrib
      append ref_item to rt_r_items.             "rt_r_items = table of items references
    endloop.
    I have created a secondary index on items for header_cl_guid and header_inst_guid. This is used during the re-load of already saved items for particular header entry. Query service is used with header_cl_guid and header_inst_guid of actual header entry as filter criteria for item pesistent objects and table of item references is returned. Thus the instance attribute lt_r_items of ref_header is filled with references to relevant items again.
    Thank you
    Michal

  • Cannot persist detached object with @ManyToOne

    I have a simple table that holds named relationships between 2 objects. I am using a @ManyToOne type from the relationship object to each of the parent and child objects.
    If the parent and child have NOT already been persisted everything works fine. However if either of them have been previously persisted I fail with a "Cannot persist detached object" error. Why is this, and what is the resolution?
    Through much trial and error I was never able to get em.merge to resolve the issue. However I did implement a @PrePersist and registered both parent and child in the UnitOfWork and this did make the problem go away. This 'hack' however cannot be the right solution since its not portable in any fashion across other ORM providers.
    It's seems as though the Cascade.PERSIST should handle the fact that the objects have already been persisted?
    The following is the relationship class:
    @Entity
    @Table(name="UDM_RELATIONS")
    public class UdmRelationship extends UdmPersistentObject
    * If the parent has not be saved then let the persist of this object take care of it.
    * Don't touch the parent if this relationship is removed.
    @ManyToOne(cascade=CascadeType.PERSIST)
    @JoinColumn(name="PARENT_ID")
    protected UdmPersistentObject parent = null;
    * If the child has not be saved then let the persist of this object take care of it.
    * Don't touch the parent if this relationship is removed.
    @ManyToOne(cascade=CascadeType.PERSIST)
    @JoinColumn(name="CHILD_ID")
    protected UdmPersistentObject child = null;
    * Name the relationship for easier querying and viewing of direct table data.
    @Column(name="REL_NAME")
    protected String relationshipName = null;
    // Initialization
    public UdmRelationship(String relationshipName)
    this.relationshipName = relationshipName;
    public UdmRelationship()
    Annotation annotation = this.getClass().getAnnotation(DiscriminatorValue.class);
    if ( annotation != null )
    DiscriminatorValue dv = (DiscriminatorValue) annotation;
    this.relationshipName = dv.value();
    // Data Management
    @XmlAttribute(name="type")
    protected String getRelationshipName() { return this.relationshipName; }
    @XmlTransient
    protected UdmPersistentObject getParent() { return this.parent; }
    protected void setParent(UdmPersistentObject parent) { this.parent = parent; }
    @XmlTransient
    protected UdmPersistentObject getChild() { return this.child; }
    protected void setChild(UdmPersistentObject child) { this.child = child; }
    @PrePersist
    public void merge()
    Server server = (Server) SessionManager.getManager().getSession("udm-tests");
    Session session = (Session)server.getActiveSession();
    session.acquireUnitOfWork().registerObject(this.parent);
    session.acquireUnitOfWork().registerObject(this.child);
    The following is the error:
    junit.framework.AssertionFailedError: Unable to create Personal Contact: [Persistent Object [com.riscs.tools.data.udm.support.PersonalContact] save failed.; nested exception is javax.persistence.EntityExistsException:
    Exception Description: Cannot persist detached object [com.riscs.tools.data.udm.support.Person@1f47ae8].
    Class> com.riscs.tools.data.udm.support.Person Primary Key> [403]]

    Hello,
    I wasn't clear. Merge is used on unmanaged objects to 'merge' the changes into the managed object. If the object is new, it will return a managed copy of the object. The only difference between merge and persist when passed in a new object, is that persist makes the passed in object managed, where as merge returns a managed copy - the object passed in remains unmanaged.
    As for it being a no-op - it takes a unmanaged copy of an object and returns the managed copy. It will take any changes and merge them into the managed copy, which as you said, is a no-op if there aren't changes. But your object model must have changes - you set a parent-child bidirectional relationship. Also, merge will cascade over the tree. So if you call it on your parent, and you have added a new child in say a 1:M mapping, it will persist the child - if you have the relation set to cascade merge+persist.
    What are the problems you run into with merge?
    As for find - depending on your options, it will hit the cache. The point is that the spec requires you to only reference managed objects. I believe this is to allow the cache to maintain object identity - it would cause problems if you read back the newly persisted child and its referenced parent was unmanaged. Any changes to the parent (such as adding the child to its collection) also need to be managed, so the only way to do that is on a managed copy -either by first using find and then making the changes or by merging the changes made to a detached copy.
    Best Regards,
    Chris

  • What are exception class and persistant class?

    hi,
    what are exception class and persistant class?
    how are they different from the normal class?
    Regards,
    Anil

    Hii!
      Persistent Classes
    To use the Persistence Service for objects, the classes of these objects must be created as persistent classes in the Class Builder. The term persistent class does not imply that a class is persistent. (As a template for objects, every class is persistent). Rather, it means that the objects of that class and their state are managed by the Persistence Service. For example, the objects of these classes are instantiated in the ABAP program with a method of the Persistence Service, which ensures that the initialization is correct (not with the usual CREATE OBJECT statement). When the Class Builder creates a persistent class, it automatically generates an associated class, known as the class actor or class agent, whose methods manage the objects of persistent classes. As well as their identity, persistent classes can contain key attributes, which allow the Persistence Service to ensure that the content of each persistent object is unique.
      Check out this link
    http://www.sapnet.ru/abap_docu/ABENABAP_EXCEPTION_CLASSES.htm
    Regards
    Abhijeet

  • What  is  Persistancy  Class ?

    What is  Persistancy  Class ?..with  Example  .

    Hi Girish,
       There is a way to avoid building a fully object-oriented program while still working with non-object-oriented relational database. The object services layer now provides a <b>persistence framework</b> that closes the object-relational gap.
    You no longer need to write <b>SQL code</b> as objects are transparently loaded from the database when needed. You must create a <b>persistent class</b>. Choose transaction SE24 and create a persistent class; this class must be protected.
    steps :
    Go to se 24 - choose persistence class
    it will be always protected class.
    next screen will give u the persistence button when u click on that it will ask u to
    add the table or struture.
    now u can see two division of the screen where bottom portion of the screen will list uall the fields available and u need to double click and map to the top portion.
    Save the persistence class and hit back button..
    Whenever u create persistence class zcl_example_persist - it will create two classes - zca_example_persist
    and zcb_example_persist automatically
    Where zca_example_persist is the agent class and zcb_example_persist is base agent class..
    Save and activate.
    Activate the whole class. Now that we have a persistent object to access the database table SFLIGHT, we must access it in a program. Here is a small example to read/write data into SFLIGHT using persistent objects.
    REPORT  ZPERSISTENCECLASS.
    data : l_flight type ref to zcl_persist.
    data : l_flight_agent type ref to zca_persist.
    data : l_seatsfree type i.
    data : l_seatsocc type i.
    l_flight_agent = zca_persist=>agent.
    * CATCH CX_OS_OBJECT_NOT_FOUND .
    *ENDTRY.
    *TRY.
    CALL METHOD L_FLIGHT_AGENT->GET_PERSISTENT
      EXPORTING
        I_CARRID = 'LH'
        I_CONNID = '0400'
        I_FLDATE = '20060701'
      RECEIVING
        RESULT   = l_flight
    * CATCH CX_OS_OBJECT_NOT_FOUND .
    *ENDTRY.
    l_seatsfree = L_FLIGHT->GET_SEATSMAX( ) - L_FLIGHT->GET_SEATSOCC( ).
    if l_seatsfree > 0.
    l_seatsfree = L_FLIGHT->GET_SEATSOCC( ) + 1.
    l_flight->set_seatsocc( l_seatsfree ).
    endif.
    There are lots of other methods and techniques that you can use in persistent classes.
    A demonstration of this can be found in program <b>DEMO_CREATE_PERSISTENT</b>.
    <b>DEMO_QUERY_PERSISTENT</b>
    kindly look into below link for screen shot to create persistence class
    http://erpgenie.com/abaptips/content/view/417/38/
    Regards
    Sathish

  • Problem with Dynamically accessing EJB Class objects in WL 7.0 SP1

    I am trying to build a component which has the ability to instantiate and execute
    an known EJB method on the fly.
    I have managed to build the component but when I try and execute it I get a ClassNotFoundException.
    I know that the EJB I am trying to invoke is deployed and available on the server,
    as I can see it in the console, I also seen to have been able to get the remote
    interface of the object, my problem occurs when I try and access the class object
    so I can perform a create on the object and then execute my method
    The code I have written is below:
    private Object getRemoteObject(Context pCtx, String pJNDIName, String pHomeBean)
    throws Exception {
         String homeCreate = "create";
         Class []homeCreateParam = { };
         Object []homeCreateParamValues = {};           
    try {  
    //This call seems to work and doesn't throw an exception     
    Object home = pCtx.lookup(pJNDIName);
    //However this call throws a java.lang.ClassNotFoundException
    Class homeBean = Class.forName(pHomeBean);
    Method homeCreateMethod = homeBean.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    } catch (NamingException ne) {             
    logStandardErrorMessage("The client was unable to lookup the EJBHome.
    Please make sure ");
    logStandardErrorMessage("that you have deployed the ejb with the JNDI
    name "+pJNDIName+" on the WebLogic server ");
    throw ne;
    } catch (Exception e) {
    logStandardErrorMessage(e.toString());
    throw e;     
    Any advice would be really appreciated, I'm fast running out of ideas, I suspect
    it has something to do with the class loader but I'm not sure how to resolve it
    Regards
    Jo Corless

    Hello Joanne,
    Congratulations! I'm very happy that you've managed to fix your problem. It's
    always essential to understand how to package applications when deploying on BEA
    WebLogic. Usually, by throwing everything into an EAR file solves just about all
    the class loader problems. :-) Let us know if you have any further problems that
    we can assist you with.
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Joanne Corless" <[email protected]> wrote:
    >
    >
    I've fixed it!!!!!!!!
    Thanks to everyone who gave me help!!!!
    The class loader was the culprit which is what I suspected all along.
    As soon
    as I put the 2 jar files I was using into an EAR file the problem went
    away!!!!!
    Thanks again
    Jo Corless
    "Ryan LeCompte" <[email protected]> wrote:
    Hello Joanne,
    As Mr. Woollen mentioned, I also believe it's a problem with the class
    loader.
    You need to be careful how you arrange your EJBs, because WebLogic has
    a specific
    method in which it loads classes in an EAR, JAR, and WAR file(s). Please
    refer
    to http://dev2dev.bea.com/articles/musser.jsp for more information about
    BEA WebLogic
    class loading mechanisms and caveats. Also, try printing out the various
    methods
    that are available on the object that was returned to you via reflection.
    For
    example, use the getMethods() method, which returns an array of Method
    objects
    that you can subsequently cycle through and print out the various method
    names.
    This way you can discover if the class found/returned to you is indeed
    the one
    you intend to locate.
    Hope this helps,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    Rob Woollen <[email protected]> wrote:
    I believe the issue is the home interface class for this EJB is not
    available in the class loader which is doing the reflection.
    If you do:
    getClass().getClassLoader().loadClass(homeInterfaceClassName)
    I suspect it will fail. Reflection still requires that the class be
    loadable.
    -- Rob
    Joanne Corless wrote:
    Hi Slava,
    If I make my code look like you describe below I get a compliationerror telling
    me that
    home.getMethod() is not recognised (no such method)
    If I change it slightly and use
    Method homeCreateMethod =
    home.getClass().getMethod(homeCreate,homeCreateParam);
    The code will compile OK but when executed it still throws a NoSuchMethodException
    Any ideas ?
    Thanks for your help so far
    Regards
    Jo Corless
    Your code should look like
    Object home = pCtx.lookup(pJNDIName);
    Method homeCreateMethod =
    home.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    Regards,
    Slava Imeshev
    "Joanne Corless" <[email protected]> wrote in message
    news:[email protected]...
    Hi Ryan,
    I also wanted to mention that if you do a "header search" in this
    particular
    newsgroup
    with the search query as "reflection", you will see many previousmessages
    regarding
    reflection and EJBs. I believe you could learn a lot from thedifficulties
    that
    others have faced and solved.I tried that and although there was a number of similar cases noneof them
    actually
    seem to fix my issue. Thanks for the suggestion though
    Are the EJBs that you are trying to access accessible via your
    system
    classpath?
    Try to avoid having them accessible via the main system classpath,and
    only bundle
    them in your appropriate EJB jar files (contained in an EAR file,for
    example).Maybe I should have laid the problem out a little clearer.
    I have a number of EJB's bundled up in a JAR file which is hot deployedto
    the
    server. Within this first JAR file is an EJB (SSB) component that
    needs
    to
    be
    able to invoke a known method on another EJB. This second EJB may
    or
    may
    not be
    within the first JAR file but it also will be hot deployed.
    The component trying to invoke the method on the 2nd EJB has to
    be
    able to
    create
    an instance of the 2nd EJB without actually knowing anything bar
    a
    JNDI
    Name which
    is passed in at runtime.
    I can get as far as doing the
    Object home = pCtx.lookup(pJNDIName);
    This returned a class with the name
    "com.csc.edc.projects.allders.httppostoffice.postman.PostmanBean_mp8qy2_Home
    Impl_WLStub"
    My problem seems to occur when I try and invoke the create method
    Method homeCreate = home.getClass().getMethod("create", new Class[0]);
    My code throws a java.lang.NoSuchMethodException at this point so
    I
    am
    unable
    to progress to the next step of :
    Object bean = homeCreate.invoke(home, null);
    So I can return the instantiated bean back to the calling client.
    Why am I getting the NoSuchMethodException, is is because I am gettinga
    stub
    back rather than the home interface and if so how do I get the truehome
    interface
    from the bean
    Thanks in advance
    Jo Corless

  • Problem in creating a Persistent Class

    Hi All,
    I am working on Persistent Classes for the first time. I have tried to gain some info by going through some related threads and of course Thomas' Blog on Persistent Classes.
    My Problem:
    I have been trying to create a Persistent Class that takes fields from multiple database tables (KNA1 and KNVV).
    I wasn't able to generate mapping successfully.
    So, the solution was to create 2 Persistent Classes and create a data model class for these two (It was mentioned in one of the threads)
    I have been trying to create a Persistent Class for the fields from table KNA1 (I need only some 11 fields)
    When I activate, I again get a warning 'No mapping exists for the fields' as a result of which the main class is not activated.
    I read somewhere that all fields from a table needs to be included in the 'Inclusion area', otherwise, the class doesn't activate.
    So I tried creating a view, but I get another warning message saying 'Database operations with view are not allowed' and the main class remains unactivated.
    Please suggest.
    Also, if there are any related materials on how to deal with multiple tables, I would be more than glad.
    Thanks for all your time.

    If you are creating a persistent class for SAP tables, then effectively you are attempting to update the tables directly.  And that is a really bad idea.
    See [here|regarding updation of database table...; and [here |Important points to be cautios of when updating a standard table; for more discussion on that topic.
    Only create persistent classes for database operations on your own tables.
    I guess your classes are failing because you haven't done the mapping.  Did you click on the button marked "persistence" on the SE24 view of your ZCL class?
    matt
    One more thing - it's against the forum rules to ask for material and links...

  • How to get a LabVIEW class object to expose an invoke-node method?

    Hi,
          I like the property/invoke-node "paradigm" used for interacting with "objects".  Can LabVIEW-class objects expose their properties and methods this way?  Can one or more LabVIEW-class objects be compiled into a library or "assembly" (or other distrubution format) that allows the property/invoke-node usage?
    I've looked at (but not completely understood) "Creating LabVIEW Classes".  Have also searched for related posts.
    The pic below shows an invoke node wired to a class with a Public VI "VAT.Status.Hello.vi".  I'd like to see VAT.Status.Hello show-up as a Method.  (I just tried "Select Method", and selected "VAT.Status.Hello.vi" but dialog's "OK" button stays greyed-out.)
    Cheers.
    Message Edited by tbd on 03-29-2007 03:15 PM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
    Attachments:
    VATStat.JPG ‏54 KB

    Hi Aristos,
          Thanks for the reply!  It was a bit dissappointing, though.
    It appears the LabVIEW-class object will be moving away from (what seems to me) a convenient object-interface presented by the invoke-node/method paradigm - which allows us to interface with a large set of "objects" (.NET, ActiveX, LabVIEW GUI, VISA Resource, ?) in a similar manner and independent of the object's origin.  Being able to read the methods and parameters that appear in these nodes is also helpful for understanding diagram logic!
    I do like the option of dropping a friendly "VI looking" icon on the diagram, but perhaps an optional - even default - VI-icon representation for a class-object invoke-node is feasible - so the LabVIEW class-object could be the more generic object first, but with a traditional-G representation(?)
    Given the answer "We would like, someday, to support the property node"
    and "in the next version of LV, wiring the LV class to the property/invoke nodes will break the wire so we'll avoid confusion in the future",
    ... I guess you'll break the wire in the next version, but (perhaps) allow it again - if support of the property node is ever implemented?
    Regards.
    P.S. For the record, huge THANKS to whoever it was that straightened-out enumerated-types (somewhere) between LV4.1 and LV6.1.  Every time I add or remove an enumeration in a typedef, I silently give thanks to the bright and thoughtful soul(s) who made this valuable tool work so well!
    Hello. This is your friendly neighborhood R&D guy for LabVIEW classes.
    Regarding your request about property and invoke nodes as relates to LV classes....
    Short story: We would like, someday, to support the property node. We have no intention of ever supporting the invoke node.
    Long story: As we were creating LV classes, we had to evaluate the right programming interface for these things. We wanted LV classes to behave as new data types in LV. A developer should be able to create a LV class, then give it to someone who doesn't even know OO programming, and that second programmer could use the new data type without learning a lot of new concepts. From this principle, we held fast to the idea that the programming interface should be subVI calls whereever possible. The invoke node is really nothing more than a VI minus the icon. If you want, you can popup on any subvi node and uncheck the option "View as Icon". This will make the node display in a way that has the terminals listed as text, like the invoke node. So, at the end of the day, the invoke node is simply a subroutine call in LV that is language dependent, as opposed to the language independent iconography of LV generally.
    The property node is a slightly different story -- the functionality of a property node is actually different than an invoke node as its terminals are various subsets of the properties available, not a fixed list of parameters like the invoke node. The property node provides a nice interface for setting multiple properties in a block and only having to check a single error return. Very friendly. Our intent is to allow you to create a VI that has 5 terminals: object in, object out, error in, error out, and either a single input or a single output of your chosen type. VIs with this conpane could be marked as "properties" of the class and would show up when you wire the class wire to the property node. We would call the subVIs behind the scenes as needed to get/set the properties.
    This is on the longer term roadmap because it is "syntactic sugar" -- it sweetens the programming style, but it is not necessary to program effectively. You can get the same effect by writing those same VIs and stringing them along on a block diagram "railroad track" style. We'll probably get around to it in three or four versions of LV -- there are some major user requests that impact functionality that have to get done first.
    PS -- in the next version of LV, wiring the LV class to the property/invoke nodes will break the wire so we'll avoid confusion in the future of people thinking there's a way to use these nodes.
    Message Edited by Aristos Queue on 04-02-2007 09:56 AM
    Message Edited by tbd on 04-03-2007 12:39 PM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • Error while activating a persistent class

    Hi,
    I have created a persistent class and included fields of the custom table in persistent mapping.
    But when I tried to activate the class I am getting the following error
    Method IF_OS_FACTORY~CREATE_TRANSIENT has already been implemented.
    Pls suggest how this can be resolved.
    Regards,
    Savitha

    Hi Savitha,
    By the error I can deduce that there are multiple implementations done for the method CREATE_TRANSIENT
    of the interface IF_OS_FACTORY which is not recommended..
    So please check the Where used list of that method or interface so that you could come to a conclusion.
    Hope this would help you.
    Good luck
    Narin

  • Problems in actvating a persistent class

    Hello All
    I have created a persistent class. When I am trying to activate it I am getting a
    message in status bar that
    'There is no mapping defined for one or more fields'.
    I have defiend 4 attributes in the class - then clicked on the PERSISTENCE tab in
    in the main toolbar, gave the table name and mapped the table fields to the class attributes. Still I am getting the message.
    Could anyone please suggest why this is happening?
    Also could anyone please explain to me why do we always need to define the instantiation as "protected" when creating a persistent class.
    Thanks in advance.
    Regards
    Indrajit

    Hello All,
    The problem is solved.
    I was of the understanding that I can take only few of the table fields and map it to class attributes. So I took only 4 fields of the table SPFLI and mapped it to the corresponding 4 attributes of the persistent class. So I was getting the message that
    'There is no mapping defined for one or more fields'.
    So I tried by defining class attributes corresponding to all fields of the table and mapped accordingly all table fields. This time I could activate the class.
    This I believe is a constarint because one may not be really interested in all fields of the database table.
    Regards
    Indrajit

  • Difference Between Business Object And Class Object

    Hi all,
    Can any one tel me the difference between business object and class Object....
    Thanks...
    ..Ashish

    Hello Ashish
    A business object is a sematic term whereas a class (object) is a technical term.
    Business objects are all important objects within R/3 e.g. sales order, customer, invoice, etc.
    The business objects are defined in the BOR (transaction SWO1). The have so-called "methods" like
    BusinessObject.Create
    BusinessObject.GetDetail
    BusinessObject.Change
    which are implemented (usually) by BAPIs, e.g.:
    Business Object = User
    User.Create => BAPI_USER_CREATE1
    User.GetDetail => BAPI_USER_GET_DETAIL
    CONCLUSION: Business Object >< Class (Object)
    Regards
      Uwe

  • Why cannnot derived class pointer point to a base class object?

    Hi,
    Pleaseeee... explain me why cannot the derived class pointer point to a base class object.
    I know that Base class pointer can point to a derived class object.
    Thanks & Regards,
    Vig....

    Example:
    class Base
    { public: void foo(); } * pBase;
    class Derived : public Base
    { public: void bar(); } * pDerived;
    Now, what would happen if you assign pDerived = new Base() and then call pDerived->bar()?By forbidding such an assignment, compiler prevents you from writing error-prone code.

Maybe you are looking for