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

How do I call a method inside another method belonging to the same class?

aris_hidalgo
Contributor
0 Likes
10,739

Hello experts,

How do I call a method inside a method? they are both methods of the same class.

For example, I declared a class named as LCL_MAIN and has 4 methods namely get_data,

combine_data, get_asset and show_data. Now what I want to do is to call method get_asset

inside the method combine_data. How do I do that guys? Again, thank you guys and have

a nice day!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,319

Hi,

with the me-> statement

class lcl_1 definition.

public section.

methods:

call_1.

private section.

methods:

call_2,

call_3.

endclass.

class lcl_1 implementation.

method call_1.

call method me->call_2.

endmethod.

method call_2.

WRITE:/ 'Hello class 2'.

endmethod.

method call_3.

endmethod.

endclass.

start-of-selection.

data clas type ref to lcl_1.

create object clas.

call method clas->call_1.

Cheers,

Stefan

Hello experts,

How do I call a method inside a method? they are both methods of the same class.

For example, I declared a class named as LCL_MAIN and has 4 methods namely get_data,

combine_data, get_asset and show_data. Now what I want to do is to call method get_asset

inside the method combine_data. How do I do that guys? Again, thank you guys and have

a nice day!

1 REPLY 1
Read only

Former Member
0 Likes
4,320

Hi,

with the me-> statement

class lcl_1 definition.

public section.

methods:

call_1.

private section.

methods:

call_2,

call_3.

endclass.

class lcl_1 implementation.

method call_1.

call method me->call_2.

endmethod.

method call_2.

WRITE:/ 'Hello class 2'.

endmethod.

method call_3.

endmethod.

endclass.

start-of-selection.

data clas type ref to lcl_1.

create object clas.

call method clas->call_1.

Cheers,

Stefan