11-21-2007 5:56 AM
I have an ALV grid, where one field is Decision (Checkbox), i copied the standard PF-STATUS for my grid, no how can i incorporate the select all button functionality for my ALV grid.
points will be rewarded.
Sunil
11-21-2007 6:02 AM
HI,
you need to pass 'A' to gs_layout-sel_mode.And assign this gs_layout to layout of Method 'SET_TABLE_FOR_FIRST_DISPLAY' or Function module like 'REUSE_ALV_GRID_DISPLAY'.Then you will get the grid display in the formate like Table Control in the grid top left upper corner there is a button like select_all, if you select that button then all rows selected and again if you select then all rows deseletcted.
for your reference i will give the all 'sel_mode' options that sap had given
A Multiple columns, multiple rows with selection buttons.
B Simple selection, listbox, Single row/column
C Multiple rows without buttons
D Multiple rows with buttons and select all ICON
Regards,
Omkar.
11-21-2007 6:03 AM
11-21-2007 6:04 AM
Hi ,
U have to give the function code which u dont want in output in IT_EXCLUDING itab.
DATA:it_exclude TYPE slis_t_extab,
x_exclude TYPE slis_extab.
Clear:x_exclude, it_exclude.
x_exclude-fcode = '&ALL'. "Function code for Select ALL option
append x_exclude to it_exclude.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_top_of_page = 'TOP_F_PAGE1'
i_callback_program = sy-repid
IT_EXCLUDING = it_exclude
i_callback_pf_status_set = 'PF_STAT'
i_callback_user_command = 'USER_CMD'
i_structure_name = 'EKPO'
is_layout = layout1
it_fieldcat = fieldcat
TABLES
t_outtab = it_ekpo.
Note:this code will work only if you dont set your own PF status.It you customized the PF status,then you have to give that FCODE ,while setting up youe own PF Status.
Eg:
SET PF-STATUS 'GUI_ALV' Excluding '&ALL'.
Reward if helpful.
Regards,
Harini.S
11-21-2007 6:05 AM
Hi
In USER_COMMAND write the Performs for SELECT_ALL and DESELECT_ALL
like
----
At User-Command
----
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'SELA'.
PERFORM select_all.
WHEN 'DSEL'.
PERFORM deselect_all.
&----
*& Form select_all
&----
Select All objects
----
FORM select_all .
CLEAR v_lisel.
DO.
READ LINE sy-index FIELD VALUE v_chk.
IF sy-subrc NE 0.
EXIT.
ENDIF.
READ LINE sy-index FIELD VALUE sy-lisel INTO v_lisel.
IF v_lisel+2(1) = ' ' AND sy-index GT 5.
v_lisel+2(1) = 'X'.
MODIFY LINE sy-index FIELD VALUE sy-lisel FROM v_lisel.
ENDIF.
ENDDO.
ENDFORM. " select_all
&----
*& Form deselect_all
&----
Deselect All Objects
----
FORM deselect_all .
CLEAR v_lisel.
DO.
READ LINE sy-index FIELD VALUE v_chk.
IF sy-subrc NE 0.
EXIT.
ENDIF.
READ LINE sy-index FIELD VALUE sy-lisel INTO v_lisel.
IF v_lisel+2(1) = 'X'.
v_lisel+2(1) = ' '.
MODIFY LINE sy-index FIELD VALUE sy-lisel FROM v_lisel.
ENDIF.
ENDDO.
ENDFORM. " deselect_all
Regards
Anji