Application Development 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: 

Sorting in ALV with multiple fields

Former Member
0 Kudos

Hi All,

I have a requirement to sort an ALV grid and get the  unique combination of keys.

for me output is coming like this i am using below coding.

            AUFNR      SERNR               EQUNR                                        banfn                        bnfpo          ebeln                         ebelp           LBLNI

Order Serial NoEquipment No   Purchase Reg    Item Purchasing Doc Item  Service Entry Service Da
4070408    14 M-CS-JUTO-BCM   15000151010151510

15M-CS-LTO-BCM
10
10


40 M-FS-SBM1000      
10
101000031274 12.04.2013




20
20100003127512.04.2013 

SORT it_all BY aufnr banfn bnfpo ebeln ebelp.

wa_sort-fieldname = 'AUFNR'.

   wa_sort-up = 'X'.

   APPEND wa_sort TO it_sort.

   CLEAR wa_sort.

*_Begin of modification mathumitha.T 10.06.2013

   wa_sort-fieldname = 'BANFN'.

   wa_sort-up = 'X'.

   APPEND wa_sort TO it_sort.

   CLEAR wa_sort.

   wa_sort-fieldname = 'BNFPO'.

   wa_sort-up = 'X'.

   APPEND wa_sort TO it_sort.

   CLEAR wa_sort.

   wa_sort-fieldname = 'EBELN'.

   wa_sort-up = 'X'.

   APPEND wa_sort TO it_sort.

   CLEAR wa_sort.

   wa_sort-fieldname = 'EBELP'.

   wa_sort-up = 'X'.

   APPEND wa_sort TO it_sort.

   CLEAR wa_sort.

   wa_sort-fieldname = 'LBLNI'.

   wa_sort-up = 'X'.

   APPEND wa_sort TO it_sort.

   CLEAR wa_sort.

BUt i want like this .........

            AUFNR      SERNR               EQUNR                                        banfn                        bnfpo          ebeln                         ebelp           LBLNI

Order Serial NoEquipment No   Purchase Reg    Item Purchasing Doc Item  Service Entry Service Da
4070408    14 M-CS-JUTO-BCM   150001510101515101000031274 12.04.2013

15M-CS-LTO-BCM
10
10


40 M-FS-SBM1000      
10
10





20
20100003127512.04.2013 
2 REPLIES 2

Former Member
0 Kudos

Hi,

Your question is not clear, if you want the data in second screen shot then

Service entry values come for serial number 14 whereas in first one it comes for  40. What do you need exactly ?

BR,

Ankit.

nikhil_bose
Active Contributor
0 Kudos

Hi,

Please see the post: http://scn.sap.com/thread/1008659