04-19-2006 1:43 PM
Hi Friends
I need a help in sorting the internal table by color_code.
I have an Internal Table with the field Color_code.
The Color_code Contains HTML Color values, like
1.'#FF0000' - Red
2.'#FFFF00' - Yellow
3.'#008000' - Green
I need to sort the color code by red,yellow than green
*Sort I_PARTS by color_code (red, yellow then green boxes)
Pls let me know how to do this.
Regards
karthik
04-19-2006 1:45 PM
hello,
Take one field sort in itab.
Modify itab like,
itab-sort = 1 where color = '#FF0000'
itab-sort = 2 where color = '#FFFF00'
itab-sort = 3 where color = '#008000'
Sort Itab.
Regards,
Naimesh
04-19-2006 1:45 PM
hello,
Take one field sort in itab.
Modify itab like,
itab-sort = 1 where color = '#FF0000'
itab-sort = 2 where color = '#FFFF00'
itab-sort = 3 where color = '#008000'
Sort Itab.
Regards,
Naimesh
04-19-2006 1:49 PM
You will need to use a special sort field here. Have a field in your internal to hold the sequence that you desire.
case itab-color .
when '#FF00000'.
itab-sortseq = 1.
when '#FFFF000'.
itab-sortseq = 2.
when '#008000'.
itab-sortseq = 3.
endcase.
modify itab.
.....
sort itab ascending by sortseq.
Regards,
RIch Heilman
04-19-2006 1:48 PM
As the color code values will NOT help you SORTING the way you want, have an additional field and assign appropriate values and SORT by that field.
Regards,
Ravi
Note : Please mark the helpful answers