‎2009 Nov 18 10:27 AM
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
‎2009 Nov 18 10:34 AM
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
‎2009 Nov 18 10:44 AM
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
‎2009 Nov 18 11:44 AM
Hi Shashi,
In your sort criteria pass comp = 'X' for field1 and expa = 'X' for field2. This will solve your problem.
Regards
Bala
‎2009 Nov 18 12:16 PM
‎2009 Nov 18 12:56 PM
Hi Shashi,
can you give the code snippet where you are appending sort criteria.
Regards
Bala