Skip to Content

Checkbox to select a bunch of records in ALV grid display ..

Hello Experts ,

I have a requirement where in an alv grid display the user should be able to CHECK a block of records having the same value .

Please refer the sketch of the proposed screen below:

Scenario :

All the data will be displayed initially with blank Reference No. field ;

When the user clicks on a certain button a reference no is generated on the screen for a bunch of records;

Multiple records can have the same reference no.

So, when the reference no. is generated the user must be able to CHECK one reference no. rather than checking every record with same reference no.

Is this possible?

If yes then kindly answer ....

ORDER DETAILS Mark Reference No. Brand Code Dealer Code Dealer Name Dealer Location Zone LSP Total R0001 SCROLL BAR √ R0002 R0003 R0004 R0005 R0006 R0007 R0008 R0009 R0010 SCROLL BAR

Regards,

Jay Kamdar.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    Posted on Sep 02, 2013 at 04:38 AM

    Hi Jay,

    U can try the below logic.

    When a Mark field is checked for one reference no. entry on the ALV grid display, write a user command event handler.

    in that handler form the logic could be : loop at the internal table used to display in the grid where the MARK field is checked, if so store the reference no. of the row. then LOOP again the same table with same reference no. but for which MARK field is not checked, inside the loop , move 'X' to MARK field.

    EX: Below is the snippet

    FORM user_command USING r_ucomm LIKE sy-ucomm

    REFRESH : it_data1.

    CASE r_ucomm.

    WHEN 'CHECK'.

    IF alv_list IS NOT INITIAL.

    LOOP AT it_data INTO wa_data WHERE mark = 'X'.

    r_refno = wa_data-refno.

    LOOP AT it_data INTO wa_data2 WHERE refno = r_refno and MARK NE 'X'.

    wa_data2-mark = 'X'.

    MODIFY it_data INDEX sy-tabix FROM wa_data2.

    ENDLOOP.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 02, 2013 at 06:40 AM

    First to handle event with checkbox, set hotspot in the field catalog for checkbox field.

    CLEAR gs_fcat.

    gs_fcat-fieldname = 'CHECKBOX'.

    gs_fcat-seltext_m = 'Select'.

    gs_fcat-checkbox = 'X'.

    gs_fcat-hotspot = 'X'.

    APPEND gs_fcat TO gt_fcat.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = gv_repid

    i_callback_user_command = 'USER_COMMAND'

    is_layout = gs_layout

    it_fieldcat = gt_fcat

    TABLES

    t_outtab = gt_scarr.

    FORM user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    case r_ucomm.

    when '&IC1'.

    DATA: lr_grid TYPE REF TO cl_gui_alv_grid.

    "Reference to the ALV grid object

    DATA: lr_grid TYPE REF TO cl_gui_alv_grid.

    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

    IMPORTING

    e_grid = lr_grid.

    CALL METHOD lr_grid->check_changed_data.

    * Write the code to set checkbox = 'X' for all the records with same ref no. You can use the logic Shruti suggested.

    * loop at the alv data table, if check box = 'X', set the checkbox of all records with same reference number to 'X'

    "Calling method to refresh the data in the ALV

    CALL METHOD lr_grid->refresh_table_display.

    endcase.

    ENDFORM. "user_command

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2013 at 05:41 AM

    First add a row selector or row selection button into your ALV.

    You can process the selected rows in the callback user command subroutine.

    In that loop through the table to find the matching reference of the selected row and then mark the matching ones as selected.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 02, 2013 at 08:09 AM

    Hi Jay,

    Display the reference-id as hotspot ,Define a handler for hot spot link in such a way that all the check box with the same reference-id will get automatically get selected.

    I hope this will resolve your issue.

    Thanks & Regards,

    Krishna N

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2013 at 06:25 AM

    Hi,

    if suppose your having one ref.no three time (R0001,R0001,R0001) so if you selected one ref.no then inside system has to be consider has 3 line times.

    Means these 3 line items data should be present in the ALV Table(means which table your display as a final)

    so then after use AT User command command like this.

    FORM user_command USING r_ucomm LIKE sy-ucomm

    sel_field like slis_selfield.

    slis_selfield -- this one contains the fields data based on this you can mark the remaining 2 line items .

    loop it_final into wa_final where field = sel_field-value. "field.

    if wa_final-mark ne 'X'.

    wa_final-mark = 'X'.

    modify it_final from wa_final transporting mark.

    endloop.

    pls check.

    thanks in advance,

    krishna



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2013 at 07:32 AM

    Hi jay ,

    To achieve the above requirement three simple steps :

    1 ) To achieve the check all option place buttons in application toolbar using menu painter and name it accordingly like select all / deselect all .

    2 ) For selecting particular reference number you can use filter option .By default it would available in the normal ALV Grid display application tool bar .

    3 ) use this function module to get the value in the grid display after filtering process REUSE_ALV_GRID_LAYOUT_INFO_GET.

    Steps to use the report after development .

    1 ) Normal alv grid list display with all refernece numbers . (ie inital output screen).

    2 )Use the filter option in the application toolbar to filter particular reference document alone .

    By the required reference document alone selected .

    3 ) The using the REUSE_ALV_GRID_LAYOUT_INFO_GET function module you could get the values in the grid list display after filtering .

    4) Then you can use the select all option to select all / select particular records based on the user requirement .

    attached a simple screen shot for reference

    Feel free to contact for any clarifications.

    Regards,

    Sanjith N


    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.