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

ALV report : Sorting

jpsapabap21
Participant
0 Likes
266

Hi

I have developed one ALV report which is displayed as follows.

Field1 Field2 field3

______________________________________________

1392320 test notification for UKI1 20090212

1392323 test for limits & price freeze 20090223

1392324 ETG101 ontbreekt een bak. 20090224

Tijdens het controleren vande

bandverbinder in de ETG101 is

ergeconstateerd dat er een bak

mist.Tijdens een stop deze bak

monteren.

1392325 eddad 20090224

1392326 test for limits & price freeze 20090227

1392327 test for limits & price freeze 20090303

i.e. for field1 1392324, i have multiple data to display in Field2 which needs to be displayed one below the other.

All other fields in the next lines are blank.

Now when I try to sort, it all get messed up like following.

Field1 Field2 field3

______________________________________________

1392320 test notification for UKI1 20090212

1392323 test for limits & price freeze 20090223

1392324 ETG101 ontbreekt een bak. 20090224

1392325 eddad 20090224

1392326 test for limits & price freeze 20090227

1392327 test for limits & price freeze 20090303

Tijdens het controleren vande

bandverbinder in de ETG101 is

ergeconstateerd dat er een bak

mist.Tijdens een stop deze bak

monteren.

For trial basis, I tried to modify data in internal table in one of the event which sets the PF status.

And I could adjust the data. But after that the control goes to standard code which then again sorts it somehow and it again displays it incorrectly.

Is there any way to control or modify the sorting of the ALV display?

Can I use any events to solve this problem? If yes, how?

And is it possible to have proper sorting functionality for this requirement of displaying multiple lines for one field.

1 REPLY 1
Read only

Former Member
0 Likes
242

HI,

You need to fill the table like this ..

1392320 test notification for UKI1 20090212

1392323 test for limits & price freeze 20090223

1392324 ETG101 ontbreekt een bak. 20090224

1392324 Tijdens het controleren vande

1392324 bandverbinder in de ETG101 is

1392324 ergeconstateerd dat er een bak

1392324 mist.Tijdens een stop deze bak

1392324 monteren.

1392325 eddad 20090224

1392326 test for limits & price freeze 20090227

1392327 test for limits & price freeze 20090303

and use the sort on the first field..

g_sort-fieldname = 'FIELD1'.
    g_sort-SPOS = '1'.
    g_sort-up = 'X'. -- Ascending Order
    APPEND g_sort TO i_sort.

In the output 1392324 will be displayed once

Refer to this link..[SORT in ALV|https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/sortinALV]