‎2005 Nov 17 11:50 AM
<b> Give me The scenario and solution to the above problem </b>
‎2005 Nov 17 11:56 AM
Welcome to Forum!
to access an object from a class you must create an instance of that class using
data: inst type ref to class.
and using CREATE OBJECT .
then you can access the attributes and methods of that class(Public only)
it will be more helpfull for us to solve your problem if you can put more light to your problem
cheers
Message was edited by: Hemendra Singh Manral
‎2005 Nov 17 12:22 PM
Hi Singh,
pl can u send me one program which is solve multiple inheritance by interfaces to my mail-id as follows.
mn_kumar_2000@yahoo.com
‎2005 Nov 17 12:43 PM
at present i dont have any ready program.
for global classes go like this--
goto se80 select class/interface and write name of interface press enter
this will create a global interface, where you can define attributes and methods.
from here you can also create class. or through tx:se24.
this will create global class.
inside a class you can define attributes,interfaces, methods etc as well in properties you can assign a super class also.
for local classes---
local classes/interfaces are defined inside a abap program, their visibility is only within program while global classes are visible throughout the system.
check this link also it will provide a fast way to learn about abap onjects its short too.
http://www.intelligententerprise.com/channels/applications/feature/archive/heymann.jhtml
read the link already provided it has sample code also.
regards.
‎2005 Nov 17 12:02 PM
Hi Take a look in this c1 class i am using c2 objects.
CLASS C2 DEFINITION DEFERRED.
CLASS C1 DEFINITION.
PUBLIC SECTION.
DATA O2 TYPE REF TO C2.
ENDCLASS.
CLASS C2 DEFINITION.
public section.
data : num type i value 5.
ENDCLASS.
start-of-selection.
data : obj1 type ref to C1.
CREATE OBJECT obj1.
create object obj1->o2.
write:/5 obj1->o2->num .
regards
vijay
‎2005 Nov 17 12:05 PM
The thing is how to solve the MULTIPLE-INHERITANCE in ABAP OBJECTS.
C is a subclass want to access the different methods of 2 different super classes A and B.
‎2005 Nov 17 12:11 PM
then in that case use Interface.
multiple inheritance is not possible
regards
vijay
‎2005 Nov 17 12:14 PM
In abap OO you can have only one super class.
multiple inheritence can be acheived by inheriting multiple interfaces.
abap OO is similler to that of JAVA in inheritence.
so you can not have classes a and b both as super at same time for a class.
however if still you want to acheive your perpose then you can do it using heirarchical inheritance where b inherits a and c inhrites b. so this way public methods will be accesible in c
do revert back if any other doubt.
check this link for more clear picture:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dba81635c111d1829f0000e829fbfe/frameset.htm
regards.
kindly close the thread if problem by awarding points on left side.
Message was edited by: Hemendra Singh Manral
‎2005 Nov 17 12:23 PM
Use two interfaces and implement them in your class which u are going to access.
regards
vijay