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

Sort alv grid

Former Member
0 Likes
1,516

Hi SAP

I have a problem during the Sorting of the data displayed on my Alv grid.

In particular data are sorted but the rows with the same values are not merged, why?

this is my sort table:

wa_sort-spos = '01'.

wa_sort-fieldname = 'MATNR'.

wa_sort-up = 'X'.

wa_sort-group = 'X'.

APPEND wa_sort TO a_sort.

CLEAR wa_sort.

wa_sort-spos = '02'.

wa_sort-fieldname = 'WERKS'.

wa_sort-up = 'X'.

APPEND wa_sort TO a_sort.

CLEAR wa_sort.

wa_sort-spos = '03'.

wa_sort-fieldname = 'LGORT'.

wa_sort-up = 'X'.

APPEND wa_sort TO a_sort.

CLEAR wa_sort.

and the methos Set_table_for_first_display

CALL METHOD g_grid7->set_table_for_first_display

EXPORTING

  • i_structure_name = 'SFLIGHT'

is_layout = gs_layout

CHANGING

it_outtab = t_7[]

it_fieldcatalog = gt_fieldcat7

it_sort = a_sort.

thanks to all,

bella pe voi!

Hi SAP

I have a problem during the Sorting of the data displayed on my Alv grid.

In particular data are sorted but the rows with the same values are not merged, why?

this is my sort table:

wa_sort-spos = '01'.

wa_sort-fieldname = 'MATNR'.

wa_sort-up = 'X'.

wa_sort-group = 'X'.

APPEND wa_sort TO a_sort.

CLEAR wa_sort.

wa_sort-spos = '02'.

wa_sort-fieldname = 'WERKS'.

wa_sort-up = 'X'.

APPEND wa_sort TO a_sort.

CLEAR wa_sort.

wa_sort-spos = '03'.

wa_sort-fieldname = 'LGORT'.

wa_sort-up = 'X'.

APPEND wa_sort TO a_sort.

CLEAR wa_sort.

and the methos Set_table_for_first_display

CALL METHOD g_grid7->set_table_for_first_display

EXPORTING

  • i_structure_name = 'SFLIGHT'

is_layout = gs_layout

CHANGING

it_outtab = t_7[]

it_fieldcatalog = gt_fieldcat7

it_sort = a_sort.

thanks to all,

bella pe voi!

4 REPLIES 4
Read only

Former Member
Read only

Former Member
0 Likes
737

Hi,

Pass '*' in GROUP and not 'X'.

regards,

Ankur Parab

Read only

Former Member
0 Likes
737

alwais the same problem with the '*',

the olny differences with the example is the fieldcat build manually,

can be this the problem?

Read only

venkat_o
Active Contributor
0 Likes
737

Hi Ballante,

wa_sort-spos = '01'.
wa_sort-fieldname = 'MATNR'.
wa_sort-up = 'X'.
wa_sort-group = 'X'.
APPEND wa_sort TO a_sort.
CLEAR wa_sort.
<li>In your above code, you have set wa_sort-group = 'X'. But it is wrong. You need to set value either * (star) for Page feed (incl. underline) or UL for Underline. <li> Try to change the above one and execute. It should work now. Thanks Venkat.O