Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

A database table contains 3
fields(Student_no,Section,Total_marks).I want retrieve top 10
students from each section.Note:(Section contains data like
A,B,C.Each section contains more than 10 students).

Answer Posted / waseem

**Sorry guys for above wrong code which I posted, You can **use this code with 100 % result****

tables : ywt_student, ywt_result.
data : begin OF itab OCCURS 0, "structure from 2 tables
usn like ywt_student-usn,
name like ywt_student-name,
dob like ywt_student-dob,
cls like ywt_result-class,
marks like ywt_result-marks,
end of itab.

**"selecing values from 2 tables*****
select ywt_student~usn name dob class marks
INTO TABLE itab
from ywt_student INNER JOIN ywt_result on ywt_student~usn = ywt_result~usn.

**Sorting for testing Perpose*****

sort itab by cls ASCENDING marks DESCENDING.
LOOP AT itab.
on CHANGE OF itab-cls.
skip.
ENDon.
WRITE :/ itab-usn, itab-name, itab-dob, itab-cls, itab-marks.

ENDLOOP.



skip 2.
***Actual Logic of Requirement***
data : m LIKE ywt_result-marks.
data : count TYPE i value 0.
CLEAR itab.
sort itab by cls ASCENDING marks DESCENDING.
CLEAR itab.
LOOP AT itab.
m = itab-marks.
on CHANGE OF itab-cls.
skip 2.
count = 0.
ENDon.
AT NEW cls.
itab-marks = m.
count = count + 1.
IF count LE 10.
WRITE :/ itab-usn, itab-name, itab-dob, itab-cls, itab-marks.
CLEAR itab.
ENDIF.
ENDAT.
ENDLOOP.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the differences between interactive and drill down reports?

979


How can we create callable modules of program code within one abap/4 program?

1072


What is meant by hide area?

1095


hi experts,,, what is meant by documentation? test casr preparation? documentation and preparation and Tcode for this? quality and releasing? test case scenario?

2151


What is luw?

1196


Explain what is sap script? What is the purpose of sap script?

1067


When, how and how would you control changes to standard SAP objects.

1844


What are the 2 other types of views, which are not allowed in release 3.0?

1080


What are the different functions used in sap script? What are the parameters used in each function?

1124


Are you familiar with all steps for setting up a workflow?

2098


What are plan versions used for? : sap abap hr

1016


Explain about Recording Function?

1088


What are the two levels in defining a match code ?

1053


IN SCRIPTS IF WE HAVE EMPTY SECOND LAYOUT AND IF WE HAVE MENTIONED ABOUT IT IN NEXT PAGE ATTRIBUTE THEN IN OUTPUT HOW WE GET THE SECOND PAGE OUTPUT.

1899


What is a size category?

1080