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: 

Update an itab using ALV GRID

Former Member
0 Kudos
344

Hi,

I have to update an itab using an ALV GRID, having an editable field.

After having modified the editable field, when I give my user command to update the itab I can verify, in debug, that the field has not been changed (also if I press enter before giving the command).

Note:

1. I'm NOT using OO programming but the functions (REUSE_ALV_GRID_DISPLAY...)

2. I took a look for other posts on this argument but I cannot find a solution

Thanks in advance for every help or suggestion.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
198

Hi,

Please use the below code in User Command.It will work.

Iam using the same in Grid ALV.

Copy the same code in User Command.

DATA : lv_ref_grid TYPE REF TO cl_gui_alv_grid.

  • to reflect the data changed into internal table

IF lv_ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = lv_ref_grid.

ENDIF.

IF NOT lv_ref_grid IS INITIAL.

CALL METHOD lv_ref_grid->check_changed_data.

ENDIF.

Thanks,

Venkat.

Edited by: Venkatesh Kolluru on Mar 3, 2011 12:59 PM

Edited by: Venkatesh Kolluru on Mar 3, 2011 12:59 PM

4 REPLIES 4

Former Member
0 Kudos
199

Hi,

Please use the below code in User Command.It will work.

Iam using the same in Grid ALV.

Copy the same code in User Command.

DATA : lv_ref_grid TYPE REF TO cl_gui_alv_grid.

  • to reflect the data changed into internal table

IF lv_ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = lv_ref_grid.

ENDIF.

IF NOT lv_ref_grid IS INITIAL.

CALL METHOD lv_ref_grid->check_changed_data.

ENDIF.

Thanks,

Venkat.

Edited by: Venkatesh Kolluru on Mar 3, 2011 12:59 PM

Edited by: Venkatesh Kolluru on Mar 3, 2011 12:59 PM

0 Kudos
198

Yes! It works!

Thank you so much!

0 Kudos
198

Hi guys!!!

The code is perfect, I would like to contribute with one little thing, after the "MODIFY" it will be convinient to ask :

IF SY-SUBRC NE 0.

show some message that says that you couldn't update the table.

Endif.

Hugs,

Gaby

Former Member
0 Kudos
198

Hi,

Try this

form user_command using v_okcode like sy-ucomm
                        selfield type slis_selfield.
case v_okcode.
    when '&IC1'.

      loop at it_final into wa_final where cmspf is not initial.
*--->Update Internal Table
*--->validate and pass new values to wa_final
          modify it_final from wa_final transporting <Field>.
        endif.

      endloop.
      selfield-refresh = 'X'.
endcase.
endform.

Perfrom USER_COMMAND, will be the import parameter of UR ALV FM

Eg :

call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        i_callback_program          = sy-repid
        i_callback_user_command     = 'USER_COMMAND'