09-03-2010 1:15 PM
Hi,
If you open the Sorting Screen of an ALV Grid, you can select Columns you want to see and you can rearange them by clicking this Up and Down Buttons. Are these up and down buttons Standard or are they only available in this Sorting Screen? Because i also want to allow the user to sort entries in an own ALV Grid by rearranging the entries with Up and Down buttons. Do i have to add them by my own or is there a standard feature. I saw that there is an Move Row Function, but i did not found any documentation on that.
Thanks,
09-14-2010 6:17 PM
Jonhy:
This is a little example with ALV, you can see basically are tree things:
1.- Create fieldcat
2.- Have internal table with informacion
3.- CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
All buttons into ALV Tool Bar are standar, and you can hide/show them, or in some case changed a lot of behavior.
Documentation?
TAW10_3 ALV Grid control Unit, is a excelent chapter to start.
TYPE-POOLS: slis.
TABLES: SPFLI.
data: IT_SPFLI like spfli occurs 0 with header line.
data: t_fieldcat TYPE slis_t_fieldcat_alv,
fs_fieldcat LIKE LINE OF t_fieldcat.
select-options: s_carrid for spfli-carrid,
s_connid for spfli-connid.
SELECT * FROM SPFLI INTO TABLE it_spfli
where CARRID in s_carrid and
CONNID in s_connid .
fs_fieldcat-fieldname = 'CARRID'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 1.
fs_fieldcat-key = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat .
fs_fieldcat-fieldname = 'CONNID'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 2.
fs_fieldcat-key = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat .
fs_fieldcat-fieldname = 'DISTANCE'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 3.
fs_fieldcat-key = ' '.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat.
fs_fieldcat-fieldname = 'CITYFROM'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 4.
fs_fieldcat-key = ' '.
APPEND fs_fieldcat TO t_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = t_fieldcat
TABLES
t_outtab = it_spfli.
Enjoy the example.
Regards
José Luis