Skip to Content
0
Former Member
Mar 05, 2009 at 12:01 PM

sorting in alv

46 Views

Hi all,

how to sort two alv fields by comparing with the first field..

field1 field2

1 a

1 a

1 b

2 c

3 c

i want to dispaly the output like the below

field1 field2

1 a

b

2 c

3 c

when i try the below code

wa_sort-spos = 1.

wa_sort-fieldname = 'FIELD1'.

append wa_sort to it_sort.

clear wa_sort.

wa_sort-spos = 2.

wa_sort-fieldname = 'FIELD2'.

append wa_sort to it_sort.

clear wa_sort.

the output is coming like this

field1 field2

1 a

b

2 c

3 -->c is merging for both 2 and 3

pls let me know how to rectify this..