‎2009 May 12 10:50 AM
HI ,
SORTING issue in ALV GRID,i kept code for sorting on material so material displays only once for all that particular line items, now the plant also should display only once for that materail.
I AM getting the output as below
MATERIAL PLANT TEXT
1231245 1000 # OF RINGS
56784901 1000 CENTERS (
1000 BLACK MAT'L.
1000 EXPOSED RIVETS: NO
1000 BACK
1000 SHEET
but the output should as below
MATERIAL PLANT TEXT
1231245 1000 # OF RINGS
56784901 1000 CENTERS (
BLACK MAT'L.
EXPOSED RIVETS: NO
BACK
SHEET
the code i have written for sorting but its not working.
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'lt_data'.
wa_sort-spos = '1'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO gt_sort .
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'lt_data'.
wa_sort-spos = '2'.
wa_sort-down = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO gt_sort .
please help.
thanks i advance
‎2009 May 12 10:56 AM
Hi,
Check the below code. It is working fine.
CLEAR x_sort.
x_sort-fieldname = 'CARRID'.
x_sort-tabname = 'IT_DATE'.
x_sort-up = 'X'.
APPEND x_sort TO t_sort.
CLEAR x_sort.
x_sort-fieldname = 'CONNID'.
x_sort-tabname = 'IT_DATE'.
x_sort-up = 'X'.
APPEND x_sort TO t_sort.
I gave positions in catalog filling.
Thanks,
Jyothi
Edited by: Jyothi on May 12, 2009 12:11 PM
‎2009 May 12 12:05 PM
Hi,
I think the code that you have written for sorting the Alv 1st by Material and then by Plant is code. The only thing is try passing the internal table name is CAPS.
Sort on Sequence.
CLEAR s_sortinfo.
s_sortinfo-spos = c_1.
s_sortinfo-fieldname = 'SEQ'(026).
s_sortinfo-tabname = 'T_FINAL_ITEM'(028).
s_sortinfo-up = c_x.
APPEND s_sortinfo TO rt_sortinfo.
Sort on BOM Material.
CLEAR s_sortinfo.
s_sortinfo-spos = c_2.
s_sortinfo-fieldname = 'MATNR'(030).
s_sortinfo-tabname = 'T_FINAL_ITEM'(028).
s_sortinfo-up = c_x.
s_sortinfo-subtot = c_x.
APPEND s_sortinfo TO rt_sortinfo.
CLEAR s_sortinfo.
s_sortinfo-spos = c_7.
s_sortinfo-fieldname = 'LSTAR'(039).
s_sortinfo-tabname = 'T_FINAL_ITEM'(028).
s_sortinfo-up = c_x.
s_sortinfo-subtot = c_x.
APPEND s_sortinfo TO rt_sortinfo.
Regards,
Nikhil