Google Search - Blog...........

ABAP - OOPS: Sample Program On Method Calling Itself In Method Programming.

report ysubdel1 message-id 00.

class c1 definition .
public section.
class-data : statnum type i .
methods : m1 .
endclass.

class c1 implementation.
method : m1.
statnum = statnum + 10.
if statnum gt 100.
exit.
endif.
write:/5 statnum .
call method m1.
endmethod.
endclass.

start-of-selection.
data : obj1 type ref to c1 .
create object obj1.
call method obj1->m1 .


Output

10
20
....
....
90
100

No comments:

Post a Comment