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 to create report using classess

Former Member
0 Likes
669

hi all ,

how to create report using classess

plz post som examples

i want to do everything using classes

like selection of data

display of data

plz guide me .

rthnx in advance

3 REPLIES 3
Read only

Former Member
0 Likes
618

hi check this...

1.

REPORT YSUBDEL LINE-SIZE 120.

CLASS parentclass DEFINITION .

PUBLIC SECTION.

DATA : commondata(30) type c value 'Accessible to all'.

METHODS : SHOWVAL.

PROTECTED SECTION.

DATA : protectdata(40) type c value 'Protected data'.

private section.

data : privatedata(30) type c value 'Private data'.

ENDCLASS.

CLASS parentclass IMPLEMENTATION.

METHOD : SHOWVAL.

write:/5 'All data from parentclass shown:-'.

write:/ sy-uline.

WRITE:/5 COMMONDATA,

/5 PROTECTDATA,

/5 PRIVATEDATA.

endmethod.

endclass.

CLASS childclass DEFINITION INHERITING FROM parentclass.

PUBLIC SECTION .

METHODS : subval.

ENDCLASS.

CLASS childclass IMPLEMENTATION.

method : subval.

skip 1.

write:/5 'Data of parent shown from child-'.

write:/5 sy-uline.

WRITE:/5 COMMONDATA,

/5 PROTECTDATA.

Commondata = 'Public data changed in subclass'.

Protectdata = 'Protected data changed in subclass'.

write:/5 sy-uline.

WRITE:/5 COMMONDATA,

/5 PROTECTDATA.

endmethod.

endclass.

START-OF-SELECTION.

DATA : parent type ref to parentclass ,

child type ref to childclass .

create object : parent ,

child .

call method : parent->showval ,

child->subval.

skip 2.

  • parent->commondata = ‘User changing public data’.

write:/5 parent->commondata.

progarm2

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.

regards,

venkat

Read only

0 Likes
618

hi venkat

this is really very helpful could u plz post som more typical examples

ALSO PLZ TELL WHETHER I SHOULD KEEP MY SELECTION SCREEN CODE INSIDE THE CLASS OR OUTSIDE THE CLASS

PLZ GUIDE ME

thamx in advance

Edited by: SARABPREET CHADHA on May 5, 2008 5:21 PM

Read only

0 Likes
618

Keep selection screen out of class. Classes do not (yet) support screen processing.