Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

Re: How to Sort Ascending by Multiple Fields?

$
0
0

Hi,

 

I simulate the issue and do find the solution as below.

 

TYPES: BEGIN OF ty_data,

  name TYPE string,

  date1 TYPE dats,

  tim1 TYPE tims,

  date2 TYPE dats,

  id TYPE char10,

END OF ty_data.

 

 

 

DATA lt_itab TYPE TABLE OF TY_DATA.

 

 

 

lt_itab = VALUE #(

                  ( name = 'A' DATE1 = '20140201' TIM1 = '121222' DATE2 = '20140201'  ID = '000008' )

                  ( name = 'A' DATE1 = '20140101' TIM1 = '121222'  DATE2 = '20140101' ID = '000000' )

                  ( name = 'A' DATE1 = '20140201' TIM1 = '111524'  DATE2 = '20140201' ID = '000003' )

                  ( name = 'A' DATE1 = '20140201' TIM1 = '121222'  DATE2 = '20140201' ID = '000005' )

).

 

 

 

 

 

SORT LT_ITAB BY NAME DATE1 DATE2 ID ASCENDING TIM1 DESCENDING.

 

**The outcome of the itab after sorting is :-

 

 

A2014010112122220140101000000
A2014020111152420140201000003
A2014020112122220140201000005
A2014020112122220140201000008

 

Hope this is what was expected.

 

Thanks,

 

Gupta


Viewing all articles
Browse latest Browse all 8372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>