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: 

editable alv.

kiran_k8
Active Contributor
0 Kudos

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.

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

Ibrahim,

New to OOPS.Do you have a sample cade which I can go thorugh.

Can't we do without using OOPS ?

Thanks,

Kiran.

Former Member
0 Kudos

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'.

s_nnoorie
Active Participant
0 Kudos

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

kiran_k8
Active Contributor
0 Kudos

Is it not possible without OOPS ?

Thanks

kiran_k8
Active Contributor
0 Kudos

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.