02-11-2009 12:25 PM
Hi,
How to achieve sorting techinque without using sort statement in tables.
Also how to compare fields of 2 custom tables and check their compatability without using code ?
06-03-2009 2:23 PM
07-01-2009 12:41 PM
Hi,
Can you tell me any of these sorting techniqes..
I am stuk up at one point with sort statment with internal table.
-Maharshi
08-02-2014 9:53 AM
Hi,
Refer the below program, it will be helpful.
types: begin of t_int,
int type i,
end of t_int.
data: it_int type standard table of t_int,
wa_int type t_int,
wa_int1 type t_int.
wa_int-int = 70.
append wa_int to it_int.
clear wa_int.
wa_int-int = 50.
append wa_int to it_int.
clear wa_int.
wa_int-int = 20.
append wa_int to it_int.
clear wa_int.
wa_int-int = 30.
append wa_int to it_int.
clear wa_int.
wa_int-int = 23.
append wa_int to it_int.
clear wa_int.
wa_int-int = 23.
append wa_int to it_int.
clear wa_int.
wa_int-int = 32.
append wa_int to it_int.
clear wa_int.
wa_int-int = 77.
append wa_int to it_int.
clear wa_int.
wa_int-int = 99.
append wa_int to it_int.
clear wa_int.
wa_int-int = 1.
append wa_int to it_int.
clear wa_int.
wa_int-int = 11.
append wa_int to it_int.
clear wa_int.
wa_int-int = 90.
append wa_int to it_int.
clear wa_int.
wa_int-int = 40.
append wa_int to it_int.
clear wa_int.
data: wk_line type i.
data: cnt type i.
data: cnt1 type i.
describe table it_int lines wk_line.
clear: cnt,cnt1.
data wk_flag type c.
clear wk_flag.
while wk_line gt cnt1.
cnt = cnt + 1.
read table it_int into wa_int index cnt.
cnt1 = cnt + 1.
read table it_int into wa_int1 index cnt1.
if wa_int-int lt wa_int1-int.
modify it_int from wa_int index cnt1.
modify it_int from wa_int1 index cnt.
wk_flag = 'X'.
endif.
if cnt1 eq wk_line.
clear: cnt, cnt1.
if wk_flag eq 'X'.
clear wk_flag.
continue.
else.
exit.
endif.
endif.
endwhile.
loop at it_int into wa_int.
write: / wa_int-int.
endloop.