Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Syntax Error

Former Member
0 Likes
478

Hi,

Could some one tell me what is wrong in the followin code.

I am getting a syntax error in a code similar to the following:


CLASS cl_class2 DEFINITION DEFERRED.

CLASS cl_calss1 DEFINITION.
PUBLIC SECTION.
    METHODS: method1 IMPORTING ref_class2 TYPE REF TO cl_class2.
ENDCLASS.

CLASS cl_class1 IMPLEMENTATION.
   METHOD method1.
     CALL METHOD ref_class2->method2 EXPORTING ref_class1 = me. 
  ENDMETHOD.
ENDCLASS.

CLASS cl_class2 DEFINITION.
  PUBLIC SECTION.
    METHODS: method2 IMPORTING ref_class1 TYPE REF TO cl_class1.
ENDCLASS.

CLASS cl_class2 IMPLEMENTATION.
    METHOD method2.
     <some logic comes here>
   ENDMETHOD.
ENDCLASS.

In the above code I am getting a syntax error saying "Method 'method2' is unknown or PROTECTED or PRIVATE." when the method2 is called in the method1 implementation.

Thanks in advance.

Regards,

Naga Sai

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
450

hi...

it has got a simple problem in that and the problem is....

THE METHOD needs to have decleared and defined befor being used...

and here its coming befor declearation and definition so you are getting the error ....I TOO HAD SAME PROBLEM BEFORE THIS

REGARDS

2 REPLIES 2
Read only

Former Member
0 Likes
451

hi...

it has got a simple problem in that and the problem is....

THE METHOD needs to have decleared and defined befor being used...

and here its coming befor declearation and definition so you are getting the error ....I TOO HAD SAME PROBLEM BEFORE THIS

REGARDS

Read only

0 Likes
450

Thanks a lot Mohit.