2008 Dec 11 5:08 AM
Hello Friends,
I am new to ABAP OOPS, I have created a Class and interface, In the interface I have created 3 public methods A, B & C. My question is can I call methods B and C inside method A.
Thanks you,
Shreekant
2008 Dec 11 5:18 AM
Hello shreekanth,
You can use B and C in method A and vice-versa.
Please note the purpose of Public methods. as the three methods are public methods you can access them directly. if a method is private then you can use its functionality in a public methods
For more info please go throgh the corresponding docu
Best Regards
Ramchander Rao.K
Hello Friends,
I am new to ABAP OOPS, I have created a Class and interface, In the interface I have created 3 public methods A, B & C. My question is can I call methods B and C inside method A.
Thanks you,
Shreekant
2008 Dec 11 5:15 AM
Hi,
Do make a habit of searching on SCN.Many threads discussed before are available there. Hope you understand.
Thanks
2008 Dec 11 5:17 AM
2008 Dec 11 5:18 AM
Hello shreekanth,
You can use B and C in method A and vice-versa.
Please note the purpose of Public methods. as the three methods are public methods you can access them directly. if a method is private then you can use its functionality in a public methods
For more info please go throgh the corresponding docu
Best Regards
Ramchander Rao.K
2008 Dec 11 6:30 AM
Hi Ram,
Please can u help me to provide some sample code.
method A, B and C are public.
I want to access B and C methods within method A.
Thanks,
Shreekant
2008 Dec 11 6:46 AM
Hello Shreekanth,
**REPORT zooabap.
interface ifac." definition.
methods : meth1, meth2, meth3.
endinterface.
class cl_class definition.
public section.
interfaces ifac.
endclass.
class cl_class implementation.
method : ifac~meth1.
write : / 'I am from First Method'.
call method ifac~meth2( ).
call method ifac~meth3( ).
endmethod.
method : ifac~meth2.
write : / 'I am from Second Method'.
endmethod.
method : ifac~meth3.
write : / 'I am from Third Method'.
endmethod.
endclass.
start-of-selection.
data : obj type ref to ifac.
create object obj type cl_class.
obj->meth1( ).
Best Regards
Ramchander Rao.K
2008 Dec 11 5:20 AM
You cannot have nested method:
METHOD XXXX.
ENDMETHOD.
You cannot implement another method inside this.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |