cancel
Showing results for 
Search instead for 
Did you mean: 

How sorting works in an internal table in given case??

ABAPer_1631
Explorer
0 Kudos
108

Hello,

I know this would be basic question, but I need this to figure-out issue. I have an internal table lt_result with four fields (field1, field2, field3, field4). I have fetched data from an Infotype into this internal table. Now, I have N no.of records in lt_result. Among these, I have two records with same value in field2 where field4 is varied.

EG: Before SORT

field1field2field3field4
1234501.01.201301.01.201301.04.2012
1234504.11.202004.11.202004.11.2020
1234520.12.202220.12.202201.04.2012
1234520.12.202220.12.202204.11.2020

I would like to sort with field1 ascending and field2 descending.

SORT lt_result BY <field1> ASCENDING <field2> DESCENDING.

In that case, what will happen if for the records in violet.

i) which record will come first either 01.04.2012 or 04.11.2020?

ii) usually how does sorting works for date comparison?

Thanks!!

Accepted Solutions (0)

Answers (0)