06-15-2010 2:50 PM
Dear All,
I would like to have unique rows for each user in a table only. The table has 3 columns:
1) userid
2) date
3) lastname
Therefore I changed my SELECT statement from
SELECT *
INTO TABLE showtable
FROM anytable.
to
SELECT min( date ) lastname
INTO TABLE showtable
FROM anytable
GROUP BY lastname
SORT BY lastname.
The complete code goes
DATA: showtable TYPE TABLE OF anytable.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_functions TYPE REF TO cl_salv_functions.
DATA: gr_sorts TYPE REF TO cl_salv_sorts.
DATA: gr_columns TYPE REF TO cl_salv_columns_table.
DATA: gr_column TYPE REF TO cl_salv_column_table.
*Implementation
START-OF-SELECTION.
SELECT min( date) lastname
INTO TABLE showtable
FROM anytable
GROUP BY lastname
SORT BY lastname.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING r_salv_table = gr_table
CHANGING t_table = showtable.
CATCH cx_salv_msg.
ENDTRY.
gr_table->display( ).
Any hints are very much appreciated.
Best wishes
Andi
06-16-2010 1:56 PM
If you want to show only the distinct records in ALV o/p , you can use DELETE ADJACENT DUPLICATE command on the internal table you are passing to Factory method..
But before that sort ur internal table with USERID in your case ....
Thanx..
06-16-2010 1:56 PM
If you want to show only the distinct records in ALV o/p , you can use DELETE ADJACENT DUPLICATE command on the internal table you are passing to Factory method..
But before that sort ur internal table with USERID in your case ....
Thanx..