Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sort order

Former Member
0 Likes
501

Hi all,

i have to sort the date field which is in [eg MAR 15 2006]

the data is coming in this way , when i am sorting the ITAb it is not sorting

sending this data to EXCEL sheet.

could you please any one tell me the way how to sort the data when date comes in this manner.

regards

kiran

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
401

if you wnat perfect sort than you can convert this date to system formatted date and than sort it. I know, this is cumbersome but this is the only way .. I think so..

You can use this sort of code to make your in date to system date for all records and than use the SORT ITAB BY SY_DATE for sorting.

DATA: L_DATE(20) TYPE C.
DATA: L_SY_DATE TYPE D.


L_DATE = 'MAR 15 2006'.


SELECT SINGLE MNR
FROM T247
INTO L_SY_DATE+4(2)
WHERE KTX = L_DATE+0(3).

L_SY_DATE+0(4) = L_DATE+7(4).
L_SY_DATE+6(2) = L_DATE+4(2).

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
401

You should fix the date data...Convert MAR to 03 and concatenate the other values so you end with...


20060315

Use an internal table to get the range...


JAN --> 01
FEB --> 02
MAR --> 03

and so on...

That way, you could use SORT without any problems -:)

Greetings,

Blag.