Welcome To My BLOG

This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me

Share this link with your friends

http://www.rebtel.com/u/15163104576

For every friend who signs up using this link and makes a payment, we'll give you 8 €!


Monday, December 13, 2010

OOPS:sampel program with local classes

REPORT YSUBDEL1 LINE-SIZE 120.

TYPES : BEGIN OF TYP_TAB ,
NAME(15) TYPE C ,
AGE TYPE I ,
END OF TYP_TAB .

DATA : num1 type i value 5 .

CLASS c1 DEFINITION .
public section.
methods : meth1 .
DATA : l_num like num1 ,
it_tab type standard table of typ_tab ,
w_tab like line of it_tab.
ENDCLASS.

CLASS c1 IMPLEMENTATION.
method : meth1 .
data : l_cnum(2) type c.
l_num = 0.
do 5 times.
l_num = l_num + 1.
l_cnum = l_num.
concatenate 'Student-'
l_cnum
into w_tab-name.
w_tab-age = num1 * l_num .
append w_tab to it_tab.
clear w_tab.
enddo.
loop at it_tab into w_tab.
write:/5 w_tab-name ,
w_tab-age.
endloop.
endmethod.
endclass.


START-OF-SELECTION.
DATA : obj1 type ref to c1.

create object : obj1.
call method obj1->meth1.


Output

Student-1 5
Student-2 10
Student-3 15
Student-4 20
Student-5 25

No comments: