‎2007 Aug 14 8:03 AM
hallow
i new in oo and i buield this class for training and lets say i wont to call to metod
get_user with pattern but when i call it i have popup that unable to find metod get_user from class c_user <b>or</b> c_user class dosent existent .
how i change it?
CLASS c_user DEFINITION.
PUBLIC SECTION.
CLASS-DATA: instance_count type i.
DATA: id type i.
METHODS: CONSTRUCTOR,
display,
get_user RETURNING value(p_user) like sy-uname.
PRIVATE SECTION.
DATA: a_user like sy-uname.
ENDCLASS.
CLASS c_user IMPLEMENTATION.
METHOD CONSTRUCTOR.
a_user = sy-uname.
ENDMETHOD.
METHOD display.
WRITE 😕 a_user, id, instance_count.
ENDMETHOD.
METHOD get_user.
p_user = a_user.
ENDMETHOD.
ENDCLASS.
Regards
‎2007 Aug 14 8:07 AM
Hi,
How you are calling, can you paste calling code, object creation?
Is it in INCLUDE and check its activated?
‎2007 Aug 14 8:07 AM
Hi,
How you are calling, can you paste calling code, object creation?
Is it in INCLUDE and check its activated?
‎2007 Aug 14 8:11 AM
hi prasad
i copy this code and activated and call it like i cal to function with pettern
in objects i give class name and metod
Regards
‎2007 Aug 14 8:14 AM
Hi,
Then how it has got activated?
are you calling like this,
data: obj type ref to c_user.
data: user type sy-uname.
create object obj.
user = obj->get_user( ).
‎2007 Aug 14 8:38 AM
hi prasad
i do like that ,i just wont to now how i b\can call to metod from regular program
thankes
CREATE OBJECT my_obj.
CALL METHOD my_obj->display.
‎2007 Aug 14 8:39 AM
Hi Shnya,
The problem is that you are creating Local class rather than Global class.
Define class as Global class using SE24 and then use pattern then you will get the instance of the method into your report.
Thanks,
Vinay
‎2007 Aug 14 9:04 AM
hi Vinaykumar G
thankes
i try to create in se24 but and i write the metod but where i put defntion?
Regards
3000... points great men.