Skip to Content
author's profile photo Former Member
Former Member

Select all button functionality in ALV grid

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06:03 AM

    it automatically assinzn funcation code . no problem can raise

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.