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: 

How to make ALV cell editable

Former Member
0 Kudos

Hi ,

I am using cl_gui_alv_grid .

please let me know how to make a particular cell is editable

eg: cell corresponding to first row second column should be editabel but remaining all are non editable

5 REPLIES 5

I355602
Advisor
Advisor
0 Kudos

Hi,

Refer the field catalog. There is an attribute as EDIT, pass the value of this attribute while creating field catalog to X.

Regards,

Tarun

Former Member
0 Kudos

That makes whole column editable ....but i want one cell in the column as editable remaining shouuld be

non editabel

Former Member
0 Kudos

Hi,

Loop at your internal table.

Eg: i have total 5 fields in my internal table itab_zqmeinz. in that 3 fields are editable as below.

declare DATA: lt_celltab TYPE lvc_t_styl.

  • internal table with celltab as one of the column

DATA: BEGIN OF itab_zqmeinz OCCURS 0. "TYPE STANDARD TABLE OF zqmseqkopf

INCLUDE STRUCTURE zqmseqeinz.

DATA: celltab TYPE lvc_t_styl.

DATA: END OF itab_zqmeinz.

LOOP AT itab_zqmeinz INTO wa_zqmeinz.
      l_index = sy-tabix.
      REFRESH lt_celltab.
      CLEAR wa_zqmeinz-celltab.
      PERFORM fill_celltab1 USING 'RW'
                              CHANGING lt_celltab.
      INSERT LINES OF lt_celltab INTO TABLE wa_zqmeinz-celltab.
      MODIFY  itab_zqmeinz FROM wa_zqmeinz INDEX l_index.
    ENDLOOP.


FORM fill_celltab1 USING value(p_mode)
                  CHANGING pt_celltab TYPE lvc_t_styl.
 Refresh pt_celltab.
  clear ls_celltab.

  IF p_mode EQ 'RW'.
    l_mode = cl_gui_alv_grid=>mc_style_enabled.    "to enable the required fields
  ELSE.                                "p_mode eq 'RO'
    l_mode = cl_gui_alv_grid=>mc_style_disabled.
  ENDIF.

  ls_celltab-fieldname = 'NEBENSEQUEN'.   " field1
  ls_celltab-style = l_mode.
  INSERT ls_celltab INTO TABLE pt_celltab.
  ls_celltab-fieldname = 'BEZEICHNUNG'.     "field2
  ls_celltab-style = l_mode.
  INSERT ls_celltab INTO TABLE pt_celltab.
  ls_celltab-fieldname = 'SORTIERUNG'.         "field3
  ls_celltab-style = l_mode. 
  INSERT ls_celltab INTO TABLE pt_celltab.

Endform.

It works. I have done it in my program.

Thanks,

Former Member
0 Kudos

Hi,

In the field catalog,

p_it_fcat-edit = ' '.

Thanks,

Former Member
0 Kudos

standard report BCALV_TEST_GRID_EDITABLE