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

sorting internal table by date

Former Member
0 Likes
6,972

Hello experts,

i wat to sort internal table in asscending order and am using the code as follows,

APPEND wa_final TO it_final.

sort it_final by edatu vbeln ASCENDING.

am getting output as 05.09.2008

10.09.2008

27.08.2008

but i want in 27.08.2008

05.09.208

10.09.2008

please help me ASAP.

Thanks,

vino....

1 ACCEPTED SOLUTION
Read only

Former Member
2,794

Hi,

sort only with date , not with VBELN.

U will get the correct answer.

Thanks and Regards

Ganesh Reddy

8 REPLIES 8
Read only

Former Member
0 Likes
2,794

Hi

I think you uploaded date field as your output format. If it is in ddmmyyyy format, when you sort it, automatically it will sort. Check your input entries.

Otherwise, what you had written is correct.

check your code

Regards,

Dhanunjaya Reddy.

Read only

Former Member
0 Likes
2,794

Is your edatu field TYPE CHAR10 or sy-datum.

It has to be type sy-datum to be sorted properly.

Read only

Former Member
0 Likes
2,794

Change your SORT statement as below

sort it_final by edatu ASCENDING vbeln ASCENDING.

Read only

Former Member
2,795

Hi,

sort only with date , not with VBELN.

U will get the correct answer.

Thanks and Regards

Ganesh Reddy

Read only

Former Member
0 Likes
2,794

hi vinoth,

if u make the format of the field edatu as YYYYMMDD and den put the sorting conditon on it.. then it will sort correctly.. rest vbeln is not a problem. beacuse if u have more than one similar date entry u have to sort it thru vbeln too..

so just try changing format..

regards

palak

Read only

Former Member
0 Likes
2,794

Write as sort it_final by vbeln edatu ASCENDING.

Regards

Sandipan

Read only

Former Member
0 Likes
2,794

Assigned the date fied to char and then sorted then it works fine.

Read only

MateuszAdamus
Active Contributor
0 Likes
2,794

Hi anindya12

I propose you create a new question for your issue, as this one has been already marked as answered.

regards,

Mateusz