2007 Sep 07 6:25 PM
Hi Experts,
Am getting sorting as per my requirement [i.e.
1.Material # (ascending)...2.Last Price Change Date (most recent first)..3. Plant (ascending)] in my_ITAB, with the following code,
<i><b>sort i_out ascending
by matnr ascending
laepr descending
werks ascending .</b></i>
But, wanna to get it the same in ALV, so I hv written the code as follows, but NOT working??? particularly, the Last change date of the price, is not sorting(its displaying defaultly/just ascending)
So, how to get it done? Is it some wht related with WA_SORT-GROUP field populating?
<i><b>* wa_sort-spos = 1.
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
APPEND wa_sort TO alv_sort.
*
wa_sort-spos = 2.
wa_sort-fieldname = 'LAEPR'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
wa_sort-down = 'X'.
APPEND wa_sort TO alv_sort.
wa_sort-spos = 3.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
APPEND wa_sort TO alv_sort.</b></i>
thanq.
2007 Sep 07 6:38 PM
Well, for one, the sort logic is commented out. Once you have uncommented it, I would think that this would work, and that you are passing the ALV_SORT to the actually FM call.
* UP
wa_sort-spos = 1.
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
APPEND wa_sort TO alv_sort.
* DOWN
wa_sort-spos = 2.
wa_sort-fieldname = 'LAEPR'.
wa_sort-tabname = 'I_OUT'.
* wa_sort-up = 'X'.
wa_sort-down = 'X'.
APPEND wa_sort TO alv_sort.
* UP
wa_sort-spos = 3.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
APPEND wa_sort TO alv_sort.Regards,
RIch Heilman
2007 Sep 07 6:38 PM
Well, for one, the sort logic is commented out. Once you have uncommented it, I would think that this would work, and that you are passing the ALV_SORT to the actually FM call.
* UP
wa_sort-spos = 1.
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
APPEND wa_sort TO alv_sort.
* DOWN
wa_sort-spos = 2.
wa_sort-fieldname = 'LAEPR'.
wa_sort-tabname = 'I_OUT'.
* wa_sort-up = 'X'.
wa_sort-down = 'X'.
APPEND wa_sort TO alv_sort.
* UP
wa_sort-spos = 3.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
APPEND wa_sort TO alv_sort.Regards,
RIch Heilman
2007 Sep 07 7:10 PM
2007 Sep 07 7:15 PM
Hi,
Can you change this way
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = alv_repid
it_events = gt_events[]
is_layout = gs_layout
it_fieldcat = alv_fieldcat[]
it_sort = alv_sort[] "<<<<<<<
TABLES
t_outtab = i_out[] "<<<<<<
EXCEPTIONS
OTHERS = 1.
aRs
2007 Sep 07 7:21 PM
thanq,
yes, its working. and get the same , if i do sorting in itab level also!
but, thing is that, in that case, U can NOT see actual ALV sorting look, I mean, here we get every horizontal line, for every record!
so, do u think, that, bcoz of COLUMN # in fld catlg causing this?
thanq.
Message was edited by:
Srikhar
2007 Sep 07 6:39 PM
The double '*' suggests that the 'sort-down' parameter is just a comment, could this be the cause?
wa_sort-spos = 2.
wa_sort-fieldname = 'LAEPR'.
wa_sort-tabname = 'I_OUT'.
wa_sort-up = 'X'.
wa_sort-down = 'X'.
APPEND wa_sort TO alv_sort.
2007 Sep 07 6:42 PM
Hi,
SORT-GROUP is having only two values accepted ie
* Page feed (incl. underline) " Need a page break for group
UL Underline " Need an underline
wa_sort-spos = 2.
wa_sort-fieldname = 'LAEPR'.
wa_sort-tabname = 'I_OUT'.
wa_sort-down = 'X'.
APPEND wa_sort TO alv_sort
aRs