Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to trigger the event for check box status in oo alv grid

Former Member
0 Kudos

hi experts,

i m a beginer, i have check boxes on each row of the ALV, My requirement is like when i check on a particular row of an ALV the color of that row should change, Is there any events to handle checkbox??i have done with till the check boxes in the list , but i m not able make the changes with the check box status,if i am using hotspot_click event for the column , i cant check on the checkbox,

please help me out....

thanks....

Edited by: vsbharathkrishna on Aug 3, 2011 1:59 PM

1 ACCEPTED SOLUTION

former_member201275
Active Contributor
0 Kudos

Have a look at program BCALV_EDIT_05.

Also this [link|http://www.abapprograming.com/2008/05/check-box-in-alv-program.html] may help:

8 REPLIES 8

former_member201275
Active Contributor
0 Kudos

Have a look at program BCALV_EDIT_05.

Also this [link|http://www.abapprograming.com/2008/05/check-box-in-alv-program.html] may help:

0 Kudos

can't access the url

former_member209703
Active Contributor
0 Kudos

Hi.

You may have to use the HOTSPOT_CLICK event combined with the DATA_CHANGED event to change the asocciated internal table accordingly.

0 Kudos

hi,

i tried with the hotspot_click but when i change the fieldcatalog hotspot = X i am not bale to make the tick on checkboxes....

thanks...

Former Member

Hi Bharath,

Please find the sample code as below:

DATA: l_valid type c,
CALL METHOD ref_grid->check_changed_data
IMPORTING
e_valid = l_valid.

wa_fieldcat-col_pos = '1'.
wa_fieldcat-tabname = 'IT_OUTPUT'.
wa_fieldcat-fieldname = 'CHECKBOX'.
wa_fieldcat-checkbox = 'X'.


Where user click on the check box in report the above method(ref_grid->check_changed_data) will set it in internal table(IT_OUTPUT)

LOOP AT IT_OUTPUT WHERE CHECKBOX = 'X'.
" write your logic for the COLOR here"
ENDLOOP.

The above call method handles the checkbox user interaction.

Something similar is there in the following link:

Revert for further clarification.

Thanks

Sri

0 Kudos

hi sri,

i tried the similiar code but the color change should happen as soon as i tick the check box..ie events should trigger..,

and please let me know why u r using ' i_valid' in 'CHECK_CHANGED_DATA'

thank you...

Edited by: vsbharathkrishna on Aug 3, 2011 2:58 PM

0 Kudos

Hi Krishna,

The i_valid internal table gets populated when there is a check-box interaction happened.

U check the internal table contents to capture the check box event and then loop your final internal table and then write the color code inside the loop.

Revert for further clarification

There was similar thread

Thanks

Sri

Edited by: SRIKANTH P on Aug 3, 2011 7:11 PM

0 Kudos

hi ,

this is my code when the sy-ucomm value come to SEL it will excute,and its working fine,what i want is as soon as i tick the checkbox the the checked row's color should change ie should trigger the event ...is there any event for sigle click in ALV????

MODULE chnage_color INPUT.
  CASE sy-ucomm.
    WHEN 'SEL'.  "select button

      CALL METHOD alvgrid->check_changed_data  "method for save the changes in internaltable.
*      IMPORTING
*        e_valid   =                                                  " as u wrote i  havent use any any variable  for 'e_valid'
*      CHANGING
*        c_refresh = 'X'.
*          .
.

      IF c_check = 'X'.   "check box status

        LOOP AT it_ekpo INTO wa_ekpo WHERE flag = 'X'.    "flag is the column name for check box


          READ TABLE it_ekpo INTO wa_ekpo INDEX sy-tabix.
          wa_ekpo-line_color = 'C601'.
          MODIFY it_ekpo FROM wa_ekpo.

        ENDLOOP.
        gs_layout-info_fname = 'LINE_COLOR' . "change the layout color
*else.
*  it_ekpo-line_color = 0.
      ENDIF.

perform refersh_table.

PERFORM display_alv_display.

*

*

  • WHEN 'DSEL'.

*

  • PERFORM refersh_table.

*

  • PERFORM display_alv_display.

*

ENDCASE.

Edited by: vsbharathkrishna on Aug 3, 2011 4:14 PM