04-12-2010 12:39 PM
some body please tell why this code snippet is giving a syntax error
syntax error:interface component "INTERF~A" doesnot exist
interface interf.
data a type i.
aliases a1 for interf~a.
endinterface.
class abc definition.
public section.
interfaces interf.
private section.
methods use.
endclass.
class abc implementation.
method use.
endmethod.
endclass.
data obj type ref to abc.
start-of-selection.
create object obj.
04-13-2010 7:18 AM
Hi,
Its giving error because aliases cannot be declared within an interface for the component of same interface. You can create aliases for the component of interface a in interface b or in a class. For example the following is valid:
INTERFACE I1.
METHODS method1.
ENDINTERFACE.
INTERFACE I2
METHODS method2
ALIASES m1 for I1~method1.
ENDINTERFACE.
Hope it will help you.
Thanks & Regards
Rocky
04-13-2010 8:15 AM
Try out with this code and let me know if it works.
interface interf.
data a type i.
endinterface.
Here, create a second Interface 'interf_added' & use aliasing ''a1'' for the component 'a' of Interface ' interf' within it**
interface interf_added.
aliases a1 for interf~a.
endinterface.
class abc definition.
public section.
interfaces interf_added.
private section.
methods use.
endclass.
class abc implementation.
method use.
endmethod.
endclass.
data obj type ref to abc.
start-of-selection.
create object obj.