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: 

Make OO ALV grid editable for the checkbox selected and capture the row selected.

akegame
Discoverer
0 Kudos

Hi,

I have requirement in which I have to make an ALV grid with checkbox using dynamic table and when the user select a checkbox and click on the change button that row become editable and then the user can edit the values. Also the changed value should be stored in a separate workarea. Also the user can select only one checkbox at one time.

I am still working on it and I would really appreciate your help.

Thanks.

CLASS LCL_INT DEFINITION.

  PUBLIC SECTION.

    METHODS : ADD_BUTTON FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
      IMPORTING E_OBJECT.

    METHODS: FUNCTION_BUTTON FOR EVENT AFTER_USER_COMMAND OF CL_GUI_ALV_GRID IMPORTING E_UCOMM.
ENDCLASS.

CLASS LCL_INT IMPLEMENTATION.

  METHOD: ADD_BUTTON.

    data: ls_but TYPE stb_button.

    LS_BUT-FUNCTION = 'DISPLAY'.
    LS_BUT-TEXT = 'DISPLAY'.
    APPEND LS_BUT TO E_OBJECT->MT_TOOLBAR.
    CLEAR LS_BUT.

    LS_BUT-FUNCTION = 'CHANGE'.
    LS_BUT-TEXT = 'CHANGE'.
    APPEND LS_BUT TO E_OBJECT->MT_TOOLBAR.
    CLEAR LS_BUT.

  ENDMETHOD.

  METHOD: FUNCTION_BUTTON.

  IF E_UCOMM = 'DISPLAY'.

      LOOP AT <D_TABLE> ASSIGNING <D_WA>.


      ENDLOOP.

  ENDIF.

  ENDMETHOD.

ENDCLASS.
<br>
1 REPLY 1

mateuszadamus
Active Contributor

Hello akegame

Here is a blog about making fields editable in OO ALV based on a value: https://blogs.sap.com/2012/07/16/editable-and-non-editable-alv-based-on-entries-dynamically/

This could be a good start for your requirement.

Kind regards,
Mateusz