‎2007 Mar 07 11:38 AM
‎2007 Mar 07 11:40 AM
If there is an internal table with some strings in it.
then you can simply use the sort statement
data: begin of itab occurs 0,
string(20) type c,
end of itab.
itab-string = 'hchgugjk'.
append itab.
clear itab.
itab-string = 'dhhgugjk'.
append itab.
clear itab.
itab-string = 'shhgugjk'.
append itab.
clear itab.
itab-string = 'ahhgugjk'.
append itab.
clear itab.
write:/ 'Before sorting'.
loop at itab.
write:/ itab-string.
endloop.
sort itab by string.
write:/ 'After sorting'.
loop at itab.
write:/ itab-string.
endloop.
Regards,
Ravi
‎2007 Mar 07 11:40 AM
If there is an internal table with some strings in it.
then you can simply use the sort statement
data: begin of itab occurs 0,
string(20) type c,
end of itab.
itab-string = 'hchgugjk'.
append itab.
clear itab.
itab-string = 'dhhgugjk'.
append itab.
clear itab.
itab-string = 'shhgugjk'.
append itab.
clear itab.
itab-string = 'ahhgugjk'.
append itab.
clear itab.
write:/ 'Before sorting'.
loop at itab.
write:/ itab-string.
endloop.
sort itab by string.
write:/ 'After sorting'.
loop at itab.
write:/ itab-string.
endloop.
Regards,
Ravi
‎2007 Mar 07 11:51 AM
Hi Ravi,
Plz chk this Code:
data: begin of i_tab occurs 0,
str type string,
end of i_tab.
i_tab-str = 'sap'.
append i_tab.
Regards,
Ramganesan K.
i_tab-str = 'abap'.
append i_tab.
i_tab-str = 'portal'.
append i_tab.
<b> sort</b> i_tab.
loop at i_tab.
write: i_tab-str.
endloop.