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: 

Handle Check Boxes on ALV using OOPS

ricky_shaw
Contributor
0 Kudos

Hello ,

I have developed an ALV grid report using OOPS.

I have placed some check boxes in my output display. After the report is displayed for 1st time, the user will check some check boxes and continue further proceesing.

Can some one tell me how do i trap the value of which check boxes have been checked(or unchecked). Which event do i need

to use?

Thanks

Ricky

9 REPLIES 9

Former Member
0 Kudos

Hi

The event is the same event to get all fields having the value changed: DATA_CHANGED

Max

0 Kudos

Hi Max,

I am using that event. For some reason my event is not getting triggered.

I am clicking oin the check box but the value is not getting updated in the internal table for the check box.

Can you please tell me where i may be wrong.

My code:

it_final : is the internal table displayed on ALV with 1st field for check box values. Its showing empty.

CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
    METHODS:
   refresh_changed_data for event data_changed of cl_gui_alv_grid importing er_data_changed
                                                                           e_ucomm sender,
ENDCLASS.             

CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD refresh_changed_data.
 data : ls_modified type lvc_s_modi,
            ls_stable type lvc_s_stbl,
           lv_field(10) type c.

    clear:      ls_stable-row, ls_stable-col.
    loop at er_data_changed->mt_mod_cells into ls_modified.
      clear wa_final.
      read table it_final into wa_final index ls_modified-row_id.
      if sy-subrc eq 0.
        wa_final-process = ls_modified-value.
        modify it_final from wa_final index ls_modified-row_id.
      endif.
      ls_stable-row = 'X'.
      ls_stable-col = 'X'.

      grid->refresh_table_display( exporting is_stable = ls_stable  ).

    endloop.
endmethod.

<Added code tags>

Moderator Message: Please use "code" tags when pasting a code snippet

Edited by: Suhas Saha on Aug 18, 2011 9:28 AM

0 Kudos

Hi

Have you set the event?

Max

0 Kudos

Yes Max,

I am using it before at the time user clicks on the button my user command as below:

set handler g_handler->refresh_changed_data for grid.

      ls_stable-row = 'X'.
      ls_stable-col = 'X'.
      grid->refresh_table_display( exporting is_stable = ls_stable  ).
      call method grid->check_changed_data.

Am i triigering it in the right place . Pls correct.

<Added Code tags>

Edited by: Suhas Saha on Aug 18, 2011 9:29 AM

0 Kudos

Hi

The event should be triggered only if you do something, press a button

Max

0 Kudos

Max, I forgot to mention that the button is NOT part of the ALVE grid tool bar.

Its placed on the screen outside of ALV grid.

Is that why ist not triggering my event?

Pls suggest.

Thanks

Ricky

0 Kudos

Try to call the methd CHECK_CHANGED_DATA in tha user_command of you pai

Max

0 Kudos

Max,

The events data_changed..etc are working only if i place my button inside ALV tool bar.

Any clues??

Thanks

ricky_shaw
Contributor
0 Kudos

For some reason if i try placing the button in ALV toolbar the its working. But this is not a perfect answer