04-18-2007 7:48 AM
Hi Friends,
Can a local class make friend with global class???
for example i have a local class in se38 editor and this local class should access the private attribute of global class which is there in se24.
Deepak
04-18-2007 8:18 AM
04-18-2007 8:21 AM
04-18-2007 8:27 AM
CLASS lcl_class DEFINITION CREATE PRIVATE FRIENDS cl_global.
regards,
Hans
Please reward all helpful answers !!!!!
04-18-2007 11:22 AM
Hi
Yo can define your ABAP Unit test class as a friend of the global class to be tested in the local class definition include of your global class. So, you have to add a line of code like
<b>CLASS <name of global class to be tested> DEFINITION LOCAL FRIENDS <name of local ABAP Unit class></b> in the include where the definition of local ABAP Unit Class is in.
Then you can call the private methods of your global class in the local abap unit class methods.
Regards,
Dinesh
Please tell if it worked and dont forget to reward if useful
04-19-2007 12:19 PM
Hi Dinesh,
Still i am not getting your point.
where should i declare the statement
<b>CLASS <name of global class to be tested> DEFINITION LOCAL FRIENDS <name of local ABAP Unit class></b>
is it in the global class where i should declare the above statement?
bcos when i declare this statement the "local class definition" of the global class it asks for local class <b><name of local ABAP Unit class></b>.
please help me out.
Deepak Diwakar
04-19-2007 12:28 PM
HI Deepak
Yo can define your ABAP Unit test class as a friend of the global class to be tested in the local class definition include of your global class. So, you have to add a line of code like
CLASS <name of global class to be tested> DEFINITION LOCAL FRIENDS <name of local ABAP Unit class> in the include where the definition of local ABAP Unit Class is in. Then you can call the private methods of your global class in the local abap unit class methods.
just refer these links
http://help.sap.com/saphelp_nw2004s/helpdata/en/ec/d9ab291b0b11d295400000e8353423/content.htm
Regards Rk
04-19-2007 12:26 PM
Hi Deepak,
Global Class Local Class
Any program Only the program where it is defined.
In the Class Repository Only in the program where it is defined.
Created using transaction SE24
Created using SE38
Must begin with Y or Z Can begin with any character
Rewords points if it helpful.
Rgds,
P.Naganjana Reddy
04-19-2007 12:30 PM
Global Class Local Class
Any program
In the Class Repository
Created using transaction SE24
Must begin with Y or Z
Local Class
Only the program where it is defined.
Only in the program where it is defined.
Created using SE38
Can begin with any character
rgds,
P.Nag
04-20-2007 8:28 AM
hi ,
private members cannot be inherited from the base class or super class..
if it is friend of this class means it will access the private members also ..
regards,
kumar