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: 

Transferring checkbox values on ALV to value in the internal table?

Former Member
0 Kudos

Hi,

I'm using an ALV grid (CL_GUI_ALV_GRID) to display an internal table. I want users to be able to select one or many rows and those checked lines to be marked as X in my internal table. I have a field, check(1), in my internal table displayed on the ALV, but when I tick one line on the ALV and debug, I don't see an X in the check field on that line in my internal table.

I've successfully written code to select and deselect all lines and those values copy back to my internal table so why don't the single lines?


CASE sy-ucomm.
    WHEN 'SELECT_ALL'.
*   select all lines
      LOOP AT tbl_data INTO wa_data.
        MOVE 'X' TO wa_data-check.
        MODIFY tbl_data FROM wa_data.
      ENDLOOP.
    WHEN 'DESELECT'.
*   deselect all lines
      LOOP AT tbl_data INTO wa_data.
        CLEAR wa_data-check.
        MODIFY tbl_data FROM wa_data.
      ENDLOOP.
ENDCASE.

Do I have to add some code in the PAI to transfer the values?

Any suggestions welcome,

Gill

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You have to call method CHECK_CHANGED_DATA of CL_GUI_ALV_GRID first.

Regards

André Witt

5 REPLIES 5

Former Member
0 Kudos

Hi,

Have you specified this checbox name in the layout ?

  • Checkbox

l_layout-box_fieldname = 'CHECK'.

Edited by: Christophe RICHON on May 26, 2010 4:15 PM

0 Kudos

Yes, I have.

The checkbox is appearing on the screen and is populated/cleared when I click the select/deselect buttons (this transfers the values in my internal table to the screen). But when I just tick one line and then debug that line isn't showing as having X in the check field in my internal table.

Somehow I need to transfer the tick values on screen to my internal table.

0 Kudos

I think you have a problem with refreshing.

Are you try " CALL METHOD sender->refresh_table_display. " ?

Former Member
0 Kudos

You have to call method CHECK_CHANGED_DATA of CL_GUI_ALV_GRID first.

Regards

André Witt

0 Kudos

Thanks Andre,

That fixed it!

Gill