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 Sort problem

Former Member
0 Likes
645

Hi Experts,

I have encountered a peculiar situation with respect to ALV, using sort. The problem is as follows:

1. I have an internal table with 3 fields, upon which I am supposed to implement a sort criteria on the first two fields.

2. My data is something like this, for ex:

abc 1 a

abc 1 b

cde 1 a

cde 1 b

3. I have applied sort criteria, on the first two fields and passed to the fm "REUSE_ALV_GRID_DISPLAY'.

4. Now the output is as follows:

abc 1 a

-


-- b

cde -- a

--- -- b

Here ( -- ) dotted lines mean the identical entry from the previous row...

5. My requirement is I want the output as:

abc 1 a

--- -- b

cde 1 a

--- -- b

I mean the sort critetia of the second column should follow the first(adjacent column) sort criteria

I hope it is clearly explained, and kindly let me know how this can be solved..

Thank you,

Shashi

5 REPLIES 5
Read only

Former Member
0 Likes
617

Hi Shashi

Sort your output table by field1 and field2. Now sort the table by field1 alone by passing sort criteria to the FM.

Regards

Bala

Read only

0 Likes
617

Hi Bala,

The suggested solution is not giving the desired results..

This happens because, when i sort the entries i mentioned earlier, remains the same, even after the two explicit sort statements on the internal table.

Kindly check the same and let me know.

Regards,

Shashi

Read only

0 Likes
617

Hi Shashi,

In your sort criteria pass comp = 'X' for field1 and expa = 'X' for field2. This will solve your problem.

Regards

Bala

Read only

0 Likes
617

Hi Bala,

Still the problem persists.

Regards,

Shashikanth. D

Read only

0 Likes
617

Hi Shashi,

can you give the code snippet where you are appending sort criteria.

Regards

Bala