Application Development and Automation 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: 
Read only

Problem While Saving the editable ALV GRID

Former Member
0 Likes
1,677

Dear Experts,

I have a scenario in which i am display the ALV(using class) with some data in the custom container of module pool screen in the non-editable mode.Also i have save and edit buttons.If i click the edit button i have written the code to edit the some columns in the ALV grid, it is working fine.After editing it,when i click the save button then ALV has to refreshed with edited data and then it should go to non editable mode but it is not working.I have written the code for changing the editable ALv to non editable mode as follows :

call method c_alvgd->set_ready_for_input

exporting

i_ready_for_input = 0.

*****Row and column of the alv are refreshed after changing values

stable-row = 'X'.

stable-col = 'X'.

*REfreshed ALV display with the changed values

*This ALV is non editable and contains new values

call method c_alvgd->refresh_table_display

exporting

is_stable = stable

exceptions

finished = 1

others = 2.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

Could you Suggest me solution for this issue ?

Thanks & Regards,

R.Dhineshraj.

4 REPLIES 4
Read only

Former Member
0 Likes
916

Hi,

class CL_GUI_ALV_GRID has three flags M_EDIT, M_EDIT_COLS and M_EDIT_GLOBAL. Your call of method set_ready_for_input resets the M_EDIT_GLOBAL flag. But if there are any fields remaining in field catalogue with the marked EDIT flag, the other flags will not be resetted and the GRID is still editable.

Please change your fieldcatalogue and remove all marked EDIT flags before calling method set_ready_for_input.

I hope this will be enough to get a non-editable grid again.

Regards,

Klaus

Read only

Former Member
0 Likes
916

Dhinesh,

I suppose that you are able to get your changes values on screen but not able to get your field in DISPLAY mode from editable mode, let me know if this is not your problem.

When you press SAVE, after the PAI, again PBO will run and hence the editable code for that field will overwrite which will keep it editable.

So, do something like this.


data: gv_edit value 'X'.....  "global variable in TOP include
..............
PBO....

loop at ...

if gv_edit = 'X'.
 CALL METHOD lo_alv->set_ready_for_input
  EXPORTING
    i_ready_for_input = 1.
else.
CALL METHOD lo_alv->set_ready_for_input
  EXPORTING
    i_ready_for_input = 0.
endif.
endloop.
........
...........

PAI.

when 'SAVE'.

gv_edit =  space.

When 'EDIT'.

gv_edit = 'X'.

Regards,

Diwakar

Read only

0 Likes
916

Hi Diwakar,

Thanks for your reply.I have done all those things which you have mentioned still it is not going to non-editable mode and also i am not able to get the chnaged data after editing.

Thanks & Regards,

R.Dhineshraj.

Read only

0 Likes
916

Dhinesh,

Use method CHECK_CHANGED_DATA for new data to be visible in itab, search for avail info in SCN.

For display mode activate, did you debug and check that on SAVE, you could mark it as ready_for_input 0 .?

I believe you will have field name STYLE in your itab ?

Use,



 CALL METHOD lo_alv->set_ready_for_input
   EXPORTING
    i_ready_for_input = 0.

    gs_cstyle-fieldname = 'FNAME'.
    gs_cstyle-style     = cl_gui_alv_grid=>MC_STYLE_DISABLED.
    APPEND gs_cstyle TO Gs_itab-style.

   modify gt_itab from gs_itab.

Regards,

Diwakar