2008 Oct 08 6:45 AM
Hello All,
I have an Internal with a Character field and i need to sort that table.
Can I SORT the internal table irrespective of their ASCII value.
For example: if the internal table contains value ABD and ABc.
on Sorting the table i wanted it to be in the order of ABc, ABD and not ABD, Abc.
Is it possible to do so ?
Thanks in advance.
Best Regards,
Kasi Raaman.R
2008 Oct 08 6:52 AM
Hello All,
I have an Internal with a Character field and i need to sort that table.
Can I SORT the internal table irrespective of their ASCII value.
For example: if the internal table contains value ABD and ABc.
on Sorting the table i wanted it to be in the order of ABc, ABD and not ABD, Abc.
Is it possible to do so ?
Thanks in advance.
Best Regards,
Kasi Raaman.R
2008 Oct 08 6:49 AM
2008 Oct 08 6:50 AM
Hi Sandeep,
Thanks for the information.
Bt how do i do that ?
Thanks,
Kasi
2008 Oct 08 6:57 AM
Hi ,
There is no additional effort needed here .
For example:
DATA : lt_mara TYPE TABLE OF makt.
SELECT * FROM makt INTO TABLE lt_mara UP TO 10 ROWS WHERE maktx LIKE '%A%'.
SORT lt_mara BY maktx.
It works fine,
Regards,
Sandeep
2008 Oct 08 6:50 AM
hi,
check this.
DATA:BEGIN OF it_kna1 OCCURS 0,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
END OF it_kna1.
it_kna1-kunnr = '123'.
it_kna1-name1 = 'ABD'.
append it_kna1.
it_kna1-kunnr = '125'.
it_kna1-name1 = 'ABC'.
append it_kna1.
sort it_kna1 by name1.
loop at it_kna1.
write : / it_kna1-kunnr,it_kna1-name1.
endloop.
2008 Oct 08 6:53 AM
Hello chakraverthi,
Thanks for the reply.
But in your case both the values for name1 are in UPPER case, bt the issue comes when u have a upper and lower case as in my example.
Thanks,
Kasi
2008 Oct 08 6:56 AM
hi,
In general sort statement wil pick the values based on order,
i.e first preference goes to upper case and then later,anyhow we will not be having data in that way in which you have mentioned.
2008 Oct 08 6:52 AM
Hi Kasi,
See the below code.
TYPES : BEGIN OF TY_TAB,
NAME(10) TYPE C,
END OF TY_TAB.
DATA : IT_TAB TYPE TABLE OF TY_TAB WITH HEADER LINE.
IT_TAB-NAME = 'ABC'.
APPEND IT_TAB.
IT_TAB-NAME = 'ABc'.
APPEND IT_TAB.
IT_TAB-NAME = 'ABD'.
APPEND IT_TAB.
SORT IT_TAB BY NAME AS TEXT.
you can use the extenstion in SORT with AS TEXT
2008 Oct 08 6:52 AM
2008 Oct 08 6:52 AM
Hi ,
Try this..
sort filed1 field2 descending...
regards,
Madan..
2008 Oct 08 7:00 AM
Hi,
I did this.. and its working fine...
data: begin of itab occurs 0,
f1(10) type c,
end of itab.
itab-f1 = 'ABC'.
append itab.
itab-f1 = 'ABc'.
append itab.
sort itab descending.
loop at itab.
write:/ itab-f1.
endloop.
Regards,
Madan,,,
2008 Oct 08 7:04 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |