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

Regarding ABAP OOP's need help

Former Member
0 Likes
864

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
835

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

6 REPLIES 6
Read only

Former Member
0 Likes
835

Hi,

Do make a habit of searching on SCN.

Many threads discussed before are available there. Hope you understand.

Thanks

Read only

Former Member
0 Likes
835

Hi,

you can call the other method.

Read only

Former Member
0 Likes
836

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

Read only

0 Likes
835

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

Read only

0 Likes
835

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

Read only

JoffyJohn
Active Contributor
0 Likes
835

You cannot have nested method:

METHOD XXXX.

ENDMETHOD.

You cannot implement another method inside this.