‎2008 Jun 11 1:05 PM
Hi all,
I have done simple oops program. the program is below
class class definition . It is throwing error Method *** is unknown or protected or private.
PUBLIC SECTION.
DATA : WTEXT(40) VALUE 'ABAP OBJECTS'.
METHODS:DISPLAY.
ENDCLASS.
&----
*&
class c1 IMPLEMENTATION
*&
&----
CLASS Class IMPLEMENTATION.
METHOD DISPLAY.
WRITE:/ ' THIS METHOD TO DISPLAY'.
ENDMETHOD.
ENDCLASS.
*********************
START-OF-SELECTION.
DATA: CLASS TYPE REF TO class.
CREATE OBJECT: CLASS.
*WRITE:/ CLASS->WTEXT.
call method:
CLASS-> DISPLAY.
It is throwing error Method *** is unknown or protected or private.
Please rectify the error.
thanks &rgds
vvvvvv
‎2008 Jun 11 1:30 PM
Hi,
The error in your program is remove the space before display.This solve your problem.
replace call method CLASS-> DISPLAY with CAll method CLASS->DISPLAY.
Reward if useful.
Regards,
Swetha.
‎2008 Jun 11 1:16 PM
Hello
You should not use ABAP keywords (CLASS) as name of your class. Replace it with lcl_myclass or something else.
Regards
Uwe
‎2008 Jun 11 1:30 PM
Hi,
The error in your program is remove the space before display.This solve your problem.
replace call method CLASS-> DISPLAY with CAll method CLASS->DISPLAY.
Reward if useful.
Regards,
Swetha.
‎2008 Jun 11 1:42 PM
rather thaen you can create ref of other name bkz it is calling class method
‎2008 Jun 12 8:48 AM
Hi,
class class definition .
PUBLIC SECTION.
DATA : WTEXT(40) VALUE 'ABAP OBJECTS'.
METHODS:DISPLAY.
ENDCLASS.
CLASS Class IMPLEMENTATION.
METHOD DISPLAY.
WRITE:/ ' THIS METHOD TO DISPLAY'.
ENDMETHOD.
ENDCLASS.
DATA: CLASS TYPE REF TO class.
START-OF-SELECTION.
CREATE OBJECT: CLASS.
*WRITE:/ CLASS->WTEXT.
call method CLASS->display.