2009 Apr 13 5:49 AM
I have an internal tab that I need to sort by comparing it to another itab.
For eg:
ITAB1 has values aaa,bbb,ccc,ddd.
ITAB2 will have a subset or the complete valueset of ITAB1 and has to be sorted by values in ITAB1. How can I achieve this?
Thanks,
Nisha
I have an internal tab that I need to sort by comparing it to another itab.
For eg:
ITAB1 has values aaa,bbb,ccc,ddd.
ITAB2 will have a subset or the complete valueset of ITAB1 and has to be sorted by values in ITAB1. How can I achieve this?
Thanks,
Nisha
2009 Apr 13 5:57 AM
2009 Apr 13 5:58 AM
Hi friend,
Just use
SORT itab2 BY F1. (Where 'F1' is common field present in ITAB1and ITAB2)
Edited by: Sap Fan on Apr 13, 2009 6:58 AM
2009 Apr 13 6:00 AM
ITAB1 and ITAB2 do not have any field/fieldnames in common. Only the values are same.
2009 Apr 13 6:07 AM
Hi,
In that case you should sort by the columns which refer to these values.
e.g:
Itab1-col1 = 'aaa'
Itab2-col2 = 'aaa'
sort itab1 by col1.
sort itab2 by col2.
2009 Apr 13 6:26 AM
hi,,
PLs explain ur requirement with example pls.....
Thanks and Regards
Suraj S Nair
2009 Apr 13 6:18 AM
Hi NIsha,
Internal table are sorted for the fields based on the scenarions not for the values.
if you want to sort the INT2 for the common values of the INT1..so why don't you take the fields common fields of INT1 in the INT2. and do the sort.
Thanks!
2009 Apr 13 6:20 AM
Hi,
code:
sort itab1.
select <fields> from <tablename>
into table itab2
for all entries in itab1
order by <fieldname> [desc ] " Asc by default
where <fieldname> = itab1-fieldname.or
try using some common fields between the two tables
thanks
ravi