‎2008 Feb 25 11:51 AM
how to write a logic least marks and higest marks from internal table.
‎2008 Feb 25 11:57 AM
Hope it will help you.
<REMOVED BY MODERATOR>
Highest Marks:-
sort internal table by field ascending.
read internal table index 1.
Lowest Marks:-
sort internal table by field descending
read internal table index 1.
Edited by: Alvaro Tejada Galindo on Feb 25, 2008 5:03 PM
‎2008 Feb 25 11:56 AM
Sort the internal table by the marks. Read the first and last record of the table.
matt
‎2008 Feb 25 11:57 AM
Hope it will help you.
<REMOVED BY MODERATOR>
Highest Marks:-
sort internal table by field ascending.
read internal table index 1.
Lowest Marks:-
sort internal table by field descending
read internal table index 1.
Edited by: Alvaro Tejada Galindo on Feb 25, 2008 5:03 PM
‎2008 Feb 25 12:00 PM
sort itab by field descending.
read table i_sort index 1.
move i_sort-field to gv_field.
gv_field is the max value.
sort itab by field ascending.
read table i_sort index 1.
move i_sort-field to lv_field.
lv_field is the leas value.
Regards,
Ajay
‎2008 Feb 25 12:01 PM
Hi Krishna,
Say your internal table has MARKS field which holds marks.
data: low_marks type i,
high_marks type i,
v_lines type sy-tabix.
sort itab by marks.
*-- First record holds least marks
read table itab index 1.
if sy-subrc = 0.
low_marks = itab-marks.
endif.
*-- your last record holds highest marks
describe table itab lines v_lines.
read table itab index v_lines.
if sy-subrc = 0.
high_marks = itab-marks.
endif.
At this point low_marks holds least marks and high_marks holds highest marks
‎2008 Feb 25 12:02 PM
sort itab by field descending.
read table itab index 1.
move i_sort-field to gv_field.
**************************gv_field is the max value.
sort itab by field ascending.
read table itab index 1.
move i_sort-field to lv_field.
****************************lv_field is the leas value.
Regards,
Ajay
‎2008 Feb 25 12:04 PM
hi ,
if you sort the tabel by the marks field then first and last fields will be the lowest and highest values .
regards,
venkat.
‎2008 Feb 25 12:46 PM
By using min and max functions we can get the values.
or
By using sorting the internal table by using ascending or descending
or
If you want to write some logic then by using sorting techniques you can find
‎2008 Feb 25 12:51 PM
Hi,
You can do as below :
Sort itab by marks acsending.
read the table using index." First row will contain the lower value.
Again sort the itab by descending.
Sort itab by marks descending.
read the table using index." First row will contain the higher value.
Thanks,
Sriram Ponna.