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

ABAP - OOPS: Methods Pointing To Tables In Method programming.

REPORT YSUBOOPS19 .

class testclass definition.
public section.
methods : testmethod .
class-data : num type i.
endclass.

class testclass implementation.
method : testmethod.
num = num + 5.
write:/5 num.
endmethod.
endclass.

start-of-selection.
data : myobj type ref to testclass ,
myobj_tab type table of ref to testclass.

do 5 times.
create object myobj .
append myobj to myobj_tab.
enddo.

loop at myobj_tab into myobj.
call method : myobj->testmethod.
endloop.


Output

5
10
15
20
25

No comments:

Post a Comment