‎2008 Mar 24 6:35 AM
Hi all,
I have a requirement in which i have to sort an internal table based on field value.
suppose i have 3 fields order number , line item ,order type .
there are 5 records
1 10 zabc
20 s1
30 d2
40 f5
50 zabc
I want to sort the records on the basis of zabc.Please let me know how can i do this.
Thanks in advance
Lalit
‎2008 Mar 24 6:37 AM
Hi,
Use the statement
SORT ITAB BY ORDERTYPE.
It will sort according to the ordertype.
Thanks and Best Regards,
Ruthra
‎2008 Mar 24 6:38 AM
SORT <itab> BY (otab).Otab is the field name.
This should satisfy your requirement.
‎2008 Mar 24 6:38 AM
Hi,
If u want to sort the internal order type based on irder number
SORt itab by orderno,order_type.
or esle if u want to sort the entire internal table by order type
Sort itab by ordertype.
regards
Sheeba
‎2008 Mar 24 6:39 AM
Hi Lalit,
Do like this.
SORT itab BY ordertype(Here give the actual field name of the internal table.
Thanks,
Vinod.
‎2008 Mar 24 6:40 AM
Hi,
SORT ITAB BY FIELDNAME.
Example :
SORT ITAB BY ORDERTYPE.
SORT ITAB BY ORDERTYPE ASCENDING.
If its useful reward points.
‎2008 Mar 24 6:40 AM
hI,
Data:begin of it_ord occurs o,
ord_typ,
ord_no,
ord_ln,
end of it_ord.
sort it_ord by ord_typ ord_no.
Ord_typ should be the first field of ur itab.
Reward if helpful.
Regards,
Kumar
‎2008 Mar 24 6:40 AM
I dont want to sort on order type..i want to sort on the value of order type.if i sort it by order type it will come as
d5
f3
s1
zabc
zabc
but i want all the records with value zabc at the top.
‎2008 Mar 24 6:44 AM
‎2008 Mar 24 6:46 AM
Hi,
You can try as below.
SORT lt_tab BY otype DESCENDING.
Regards,
Farheen
‎2008 Mar 24 6:43 AM
‎2008 Mar 24 6:47 AM
Hi,
You can use Sort like,
Sort It_vbrk by Vbeln erdat DESCENDING.
Regards,
Mehul Shah.
‎2008 Mar 24 6:56 AM
if i will sort it by descending it will come as
zabc
zbbc
zcbc
but i want records as
zdbc
zdbc
zabc
zabc
sort on a particular field value....
could you please help...
‎2008 Mar 24 7:04 AM