‎2009 Feb 11 5:22 AM
Hi Experts,
I have this requirement:
Current Scenario: I have data like this now.
Service Centre State Code LOB Days Aged
03 19 A 91-100
03 19 A 31-60
03 19 A 61-90
01 15 F 61-90
01 15 F 91-100
01 15 F 31-60
After sorting in Ascending Order:
Service Centre State Code LOB Days Aged
01 15 F 31-60
01 15 F 61-90
01 15 F 91-100
03 19 A 31-60
03 19 A 61-90
03 19 A 91-100
Now, I need column Days Aged to be sorted in Descending Order, like this
Service Centre State Code LOB Days Aged
01 15 F 91-100
01 15 F 61-90
01 15 F 31-60
03 19 A 91-100
03 19 A 61-90
03 19 A 31-60
Please provide solution for this. Please look through the example carefully. I need only one column in descending order finally.
‎2009 Feb 11 5:32 AM
Hi,
sort itab by : ServiceCentre ascending
StateCode ascending
LOB ascending
DaysAged descending.
This works.
‎2009 Feb 11 5:24 AM
hi
sort the table with days aged descending
SORT itab by days aged descending
service center ascending
state code ascending.this will solve the problem
thanks
sarves
‎2009 Feb 11 5:28 AM
HI,
Sort ITAB by Service_Centre State_Code LOB Days_Aged descending.
U need to add addition descending for field days_aged.
Regards,
Dwaraka.S
‎2009 Feb 11 5:29 AM
Hi,
Have you tried like following hope will solve out your problem,
SORT itab by a ASCENDING b DESCENDING c ASCENDING.Kind Regards,
Faisal
‎2009 Feb 11 5:32 AM
Hi Experts,
I have this requirement:
Current Scenario: I have data like this now.
Service Centre State Code LOB Days Aged
03 19 A 91-100
03 19 A 31-60
03 19 A 61-90
01 15 F 61-90
01 15 F 91-100
01 15 F 31-60
After sorting in Ascending Order:
*Service Centre State Code LOB Days Aged*
01 15 F 31-60
01 15 F 61-90
01 15 F 91-100
03 19 A 31-60
03 19 A 61-90
03 19 A 91-100
Now, I need column Days Aged to be sorted in Descending Order, like this
*Service Centre State Code LOB Days Aged*
01 15 F 91-100
01 15 F 61-90
01 15 F 31-60
03 19 A 91-100
03 19 A 61-90
03 19 A 31-60Please provide solution for this. Please look through the example carefully. I need only one column in descending order finally.
‎2009 Feb 11 5:38 AM
Have you tried ORDER BY clause in Select statement.
i.e.
SELECT *
from DBTAB into ITAB
ORDER BY URFIELD descending.
Hope it helps.
Vikas
‎2009 Feb 11 5:38 AM
hi,
Run this code, this gives an output required in your format.
DATA:
BEGIN OF t_tab OCCURS 0,
var TYPE c,
int TYPE i,
END OF t_tab.
t_tab-var = 'A'.
t_tab-int = 1.
APPEND t_tab.
t_tab-var = 'B'.
t_tab-int = 1.
APPEND t_tab.
t_tab-var = 'C'.
t_tab-int = 1.
APPEND t_tab.
t_tab-var = 'A'.
t_tab-int = 2.
APPEND t_tab.
t_tab-var = 'B'.
t_tab-int = 2.
APPEND t_tab.
t_tab-var = 'C'.
t_tab-int = 2.
APPEND t_tab.
SORT t_tab BY var ASCENDING int DESCENDING.
LOOP AT t_tab.
WRITE:
/ t_tab-var, t_tab-int.
ENDLOOP.Thanks and regards
Sharath
‎2009 Feb 11 5:32 AM
Hi,
sort itab by : ServiceCentre ascending
StateCode ascending
LOB ascending
DaysAged descending.
This works.
‎2009 Feb 11 5:34 AM
hi
try this way....
Assume ur internal table itab
get another internal table itab2
1st sort itab by Service
itab[] = itab2[]
thn sort itab2 by Days Aged Descending Order
i = SY-TABIX.
loop at itab.
read itab2 index i.
itab-Days Aged = itab2-Days Aged
modify itab.
endloop.
regard
nawa