Skip to Content
avatar image
Former Member

copy button in ALV cl_gui_alv_grid

I have a non editable alv created using OOps abap, now when i click on copy button a new line appears which is non editable,i want to make it editable, how to do that.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 18, 2017 at 11:20 AM

    Define the grid as editable, add a field of type lvc_t_styl to your internal table, fill it with values cl_gui_alv_grid=>mc_style_disabled or enabled to set the readiness for input.

    Add comment
    10|10000 characters needed characters exceeded

    • Inital setup in the method that create the grid (before the set_table_for_first_display) then handle the event before/after_user_command. Use before if you want to add the record yourself (use set_user_command to space to prevent standard function behavior), use after if you want to identify and update the added (last) record.

  • avatar image
    Former Member
    Apr 18, 2017 at 11:36 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 18, 2017 at 02:49 PM

    Thank you for your help.

    I have created an enter event using(write teh code after

    'set_table_for_first_display'

    CALL METHOD v_alv->register_edit_event
    EXPORTING
    * i_event_id = cl_gui_alv_grid=>mc_evt_modified
    i_event_id = cl_gui_alv_grid=>mc_evt_enter
    EXCEPTIONS
    error = 1
    OTHERS = 2.

    which triggers data_changed event of cl_gui_grid_display, and according to the entries in table er_data_changed, created ok codes using

    CALL METHOD cl_gui_cfw=>set_new_ok_code
    EXPORTING
    new_code = 'INS'.

    and coded for the ok codes in user command of the screen.

    Add comment
    10|10000 characters needed characters exceeded