2012 Mar 08 2:43 PM
Hi,
Is it possible to group sort on ALV?
it seems we are able to merge together several rows via sort but only on its field level. is it possible to be a group field level?
example if i sort PO number first and vendor second it will have individual PO and the vendor field is merge together if it is the same with a different PO. Can we make the PO number as the first priority sorting without changing the position of the fields?
Hi,
Is it possible to group sort on ALV?
it seems we are able to merge together several rows via sort but only on its field level. is it possible to be a group field level?
example if i sort PO number first and vendor second it will have individual PO and the vendor field is merge together if it is the same with a different PO. Can we make the PO number as the first priority sorting without changing the position of the fields?
2012 Mar 08 4:11 PM
It isn't a very tidy solution but I have achieved this by adding a sort field as the first field in the alv table. Concatenate the values into the sort field and sort using this. The field can then be hidden so it is not output.
Not very tidy I know, maybe someone has a better solution? I would be interested if so.
2012 Mar 08 5:48 PM
Hi,
>
> Is it possible to group sort on ALV?
>
> it seems we are able to merge together several rows via sort but only on its field level. is it possible to be a group field level?
>
> example if i sort PO number first and vendor second it will have individual PO and the vendor field is merge together if it is the same with a different PO. Can we make the PO number as the first priority sorting without changing the position of the fields?
If I have understood your requirement correctly, group sorting should be as simple as filling up the 'IT_SORT' parameter(REUSE_ALV_GRID_DISPLAY/REUSE_ALV_LIST_DISPLAY/CL_GUI_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY)
as shown below: (please let me know if I have misunderstood your requirement).
ls_sort-spos = '1'.
ls_sort-fieldname = 'FIELD1'.
ls_sort-up = 'X'.
APPEND ls_sort TO it_sort.
CLEAR ls_sort.
ls_sort-spos = '2'.
ls_sort-fieldname = 'FIELD2'.
ls_sort-up = 'X'.
APPEND ls_sort TO it_sort.
CLEAR ls_sort.Even after displaying the ALV, columns can be group sorted by selecting all of them together(by dragging the cursor over all the columns that need to be sorted)
-Rajesh.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |