Skip to Content
0
Mar 02, 2021 at 07:49 AM

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

43 Views

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>