Thursday, September 23, 2010

Oops basic prog 01 / 02

report zalv_sel_screen .

class venkatesh definition.
public section .
data: publicdata(30) type c value 'this is the public data',
num1 type i value 2,
num2 type i value 3,
num3 type i.
methods: publicmethod.
protected section.
data: protecteddata(30) type c value 'this is the private data'.
private section.
data: privatedata(30) type c value 'this is the private data'.
endclass.

class venkatesh implementation.
method : publicmethod .
num3 = num1 + num2.
do num3 times.
write:/ 'this is venkatesh'.
enddo.
endmethod.
endclass.

start-of-selection.

data: venky type ref to venkatesh.

create object : venky .

call method: venky->publicmethod.
----------------------------------------------------------------------------------
report zalv_sel_screen .

data: begin of itab occurs 0,
name(20) type c,
age(2) type c,
end of itab,
num type i value 5.

class c1 definition.
public section.
methods: method .
data: i type i value '1',
j type i,
itab1 type standard table of itab,
wa_tab like line of itab.
endclass.


class c1 implementation.
method:method.
do 10 times.
if i <= 10.
j = i * i.
write:/ i , ' * ' , i ,'=', j.
i = i + 1.
endif.
enddo.
endmethod.
endclass.

start-of-selection.

data obj type ref to c1.
create object: obj.
call method obj->method.

No comments:

Post a Comment