‎2008 Aug 25 8:21 PM
I have a question about peristent objects and inheritance.
I've watered down an example.
Lets say I have two tables for doc headers and their line items.
HEADERS
Client Key MANDT MANDT CLNT
DocNumber Key DOC BELNR_D CHAR
HeaderText DTEXT BKTXT CHAR
DocDate DDATE BLDAT DATS
User Name DOWNER USNAM CHAR
LINE ITEMS
Client Key MANDT MANDT CLNT
DocNumber Key DOC BELNR_D CHAR
LineItem Key LINEITEM BUZEI NUMC
Date IDATE DATUM DATS
ItemText ITEXT SGTXT CHAR
I want to create theses as persistent objects, and I want the detail object to inherit from the header object so that I can call doc related methods from the line item object.
Is this doable.
Intuitively, I tried
Create ZCL_HEADER as persistent (with actor and base class)
Do the Peristence Mapping
Create ZCL_DETAIL as persistent (with actor and base class)
Set SUperclass
Do the persistence mapping.
This did not work.
Is there an easy way to do this?
Thanks...
....Mike
‎2008 Aug 25 8:29 PM
I don't think the approch, you have taken, will work.
You can Create presistence classes for both the tables individually.
Now, create a wrapper class which can take care of all the GET and SET methods.
Like in your wrapper class, you have methods like INSERT_DATA, READ_DATA. Both the methods will have the Header and ITEM tables as the parameters. In the method implementation, you can call the GET and SET methods from the both persisitence class to insert or retrieve data.
Regards,
Naimesh Patel
‎2008 Aug 25 8:29 PM
I don't think the approch, you have taken, will work.
You can Create presistence classes for both the tables individually.
Now, create a wrapper class which can take care of all the GET and SET methods.
Like in your wrapper class, you have methods like INSERT_DATA, READ_DATA. Both the methods will have the Header and ITEM tables as the parameters. In the method implementation, you can call the GET and SET methods from the both persisitence class to insert or retrieve data.
Regards,
Naimesh Patel
‎2008 Dec 16 8:52 PM