06-02-2010 1:21 PM
I had created an editable alv where I am having a blank field where the user will enter the data.And when hitting SAVE I want to capture this data in the alv grid back into the program for further processing.
form list1 using r_ucomm like sy-ucomm rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
if rs_selfield-fieldname = 'MATNR'.
read table it_final index rs_selfield-tabindex.
set parameter id 'MAT' field it_final-matnr.
call transaction 'MM03' and skip first screen.
endif.
when '&SAVE'.
rs_SELFIELD-REFRESH = 'X'.
loop at it_final.
if it_final-chk = 'X'.
modify it_final index sy-tabix transporting chk incident.
endif.
endloop.
endform
I am getting the CHK as X but not the value that I am entering in the incident (field name) at ALV gird.
Thanks,
Kiran.
06-02-2010 1:24 PM
call the method check_changed_data of class cl_gui_alv_grid.
The changes done on the editable alv will be copied in the internal table.
data : obj1 type ref to cl_gui_alv_grid.
create object obj1.
for e.g. call method obj1->check_changed_data
06-02-2010 1:28 PM
Ibrahim,
New to OOPS.Do you have a sample cade which I can go thorugh.
Can't we do without using OOPS ?
Thanks,
Kiran.
06-02-2010 1:30 PM
Hi ,
try this
when '&SAVE'.
loop at it_final where chk = 'X'.
modify it_final index sy-tabix transporting chk incident.
endloop.
rs_SELFIELD-REFRESH = 'X'.
06-02-2010 1:34 PM
Hi,
I think the problem is with the modify it_final sy-tabic.
if you want to modify only one line which is slected then
loop at it_final where chk = 'X'.
modify it_final transporting where chk = 'X'.
endloop.
if multipul lines is selected then:
loop at it_final where chk = 'X'.
modify it_final transporting where chk = 'X' and
field1 = it_final-feild1 and
field2 = it_final-feild2.
endloop.
I had the same problem, but resolved.
Hope this will be helpfull
06-02-2010 2:52 PM
06-03-2010 3:21 PM
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
The above set of code met my requirement of capturing the data that is changed by the user in the alv gird and using it for further processing within the program.Thanks to SDN wiki.
Thanks,
Kiran.