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: 

Making ALV Grid editable based on field value

vinay_pasalkar
Participant
0 Kudos

Hi,

I am using the below code,

field_style of type lvc_t_styl.

Data: ls_stylerow type lvc_s_styl.

loop at lt_output into wa_output.

     if wa_output-x = 'PQR'.

     v_index = sy-tabix.

     ls_stylerow-fieldname = 'XYZ'.

     ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

     append as_stylerow to wa_output-field_style.

     modify lt_output from wa_output transporting field_style index v_index.

     endif.

     clear: wa_output, ls_stylerow.

endloop.

ls_layout-styfname = 'FIELD_STYLE'.

Call method o_grid2-> set_table_first_display

Exporting

     is_layout = ls_layout

     it_toolbar_excluding = lt_ui_functions

importing

     it_outtab = lt_output1

     it_fieldcatalog = t_fcat1.

Still fields are not getting edited based on condition given.

I know we can modify the fieldcatalogue & make the field editable without any condition, COuld you please help how can I make field editable in specific cases

Thanks

Vinay

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Vinay,

1. use EDIT = 'X' in fieldcataloge for the field 'XYZ'.

2. Register the edit event.

  CALL METHOD O_GRID2->REGISTER_EDIT_EVENT

    EXPORTING

      I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.

Regards,

Mordhwaj

4 REPLIES 4

Former Member
0 Kudos

Hi Vinay,

1. use EDIT = 'X' in fieldcataloge for the field 'XYZ'.

2. Register the edit event.

  CALL METHOD O_GRID2->REGISTER_EDIT_EVENT

    EXPORTING

      I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.

Regards,

Mordhwaj

0 Kudos

Hi Mordhwaj,

Thanks a lot. It works perfectly.

0 Kudos

If possible, can you share the exact working piece of code for this issue - making alv field editable based on field-value?


Regards,

KS

0 Kudos

for anyone who wants the exact working abstract of code for this issue:

http://scn.sap.com/message/14475620#14475620