Application Development 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: 

report program

Former Member
0 Kudos

hi

my question.

a report program to display student information stud.no name percentage marks in 5 subjects,

my requirement is when execute the program it displays highest percentage in 3 subjects(maths,physics,chemisrty). which tables taken.

output is

stud,no name percentage (3subjectsonly)

101 xxxx 98

102 uuuu 87

103 ttt 76

how to write the start-of selection logic,

pls send the details report.

thanx and regrads,

priya

8 REPLIES 8

Former Member
0 Kudos

Hi

First create a Transparent Table(ZTABLE) in SE11 with the fields like

Studentno, Name and 5 subjects, Keep Stduent no as primary key

and create table maintenance generator for this table and enter the data and save

Now the table is ready with data

Now write a program in SE38 by giving student no in the selection screen

and in the program write the select statement to fetch all the data from the Above Z table

data: itab like ztable occurs 0 with header line,

v_per type P decimals 2.

select-options: s_student for ztable-studentno.

Select * from ztable into table itab where stduentno in s_student.

loop at itab.

write:/ itab-studentno, itab-name.

v_per = ( itab-physics + itab-chemistry + itab-maths ) / 3.

write : v_per.

endloop.

This will display the desired output.

<b>Reward points for useful Answers</b>

Regards

Anji

former_member189059
Active Contributor
0 Kudos

types: begin of itype,

id type i,

name(60),

subj1 type i,

subj2 type i,

subj3 type i,

subj4 type i,

subj5 type i,

avg type i,

end of itype.

data: itab type itype occurs 0 with header line.

  • populate all your data here

write:/ 'studno, name, percentage (3subjectsonly)'.

loop at itab.

itab-avg = (itab-subj1 + itab-subj2 + itab-subj3 ) / 3.

modify itab.

write:/ itab-id, itab-name, itab-avg.

endloop.

Former Member
0 Kudos

U will have all the data in internal table say itab.

loop at itab.

IF itab-mark1> itab-mark2 AND itab-mark1 > itab-mark3.

Clear l_mark

l_mark = itab-mark1.

ENDIF.

IF itab-mark2> itab-mark3 AND itab-mark2 > itab-mark.1

Clear l_mark

l_mark = itab-mark2.

ENDIF.

IF itab-mark3> itab-mark2 AND itab-mark3 > itab-mark1.

Clear l_mark

l_mark = itab-mark3.

ENDIF.

at e nd stud no.

itab1-studno = itab-stud_no.

itab1-name = itab-name.

itab1-mark = l_mark.

clear l-mark.

aoppend itab1.

clear itab1.

endat.

endloop.

Former Member
0 Kudos

hi,

once you check any tables related to your requirement, if not you can create ZTABLE with required fields and fill that table before developing the report program.

after creation of Ztable, in report program..you follow these steps...

1) tables: Ztable "provide tables work area

2) create internal table based on output fields data.

3) in START-OF-SELECTION event you write the select statement like

select <required fields> from ZTABLE into table <internal table>.

4) while processing the internal table you calculate percentage and display the highest percentage...

   LOOP AT <internal table>.
            ****here write the logic for calculating percentage
       
   ENDLOOP.

regards,

Ashok Reddy

Former Member
0 Kudos

Hi,

I am not getting u r exact requirement.

My quetion is , how many subjects totally are there.

1. in that table only 3 sub are there or

You want highest 3 sub marks in 5 sub marks?

Regards,

sarath

0 Kudos

hi sarath,

they are 5 subjects, english,telugu, maths,physics,chemistry

but i want only 3 subjects percentages(maths,physics,shemisrty.)

i want logic how to write.

sum of 3 subjects using at loop i think.

0 Kudos
types: begin of itype,
id type i,
name(60),
maths type i,
physics type i,
chemistry type i,
english  type i,
telugu type i,
avg type i,
end of itype.

data: itab type itype occurs 0 with header line.

* populate all your data here

write:/ 'studno, name, percentage (3subjectsonly)'.
loop at itab.
itab-avg = (itab-maths + itab-physics + itab-chemistry ) / 3.
modify itab.
write:/ itab-id, itab-name, itab-avg.
endloop.

Note: if the marks are out of 100 then this will suffice, else multiply the avergage by 100 and divide by the total marks in that subj

eg: if it is out of 50 then avg * 100 / 50

Former Member
0 Kudos

hi, priya my understanding is that u want to display the the highest percentage in 3 some subjects ....what iam unable to understand is that whether u want the details of al the student or a particular student with highest percventage in the 3 subs.