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: 

Set ALV grid fiel to editable on row add

Former Member
0 Kudos

Folks: My ALV gird has 6 fields...1 field is edtiable. When a user adds a row to the grid i would like all fields to be editable...How do I do that? Thanks. Mat.

1 REPLY 1

Former Member
0 Kudos

Check demo program BCALV_EDIT_04 in your sap ssystem

Use LVC_T_STYLE.


"- IT for the grid
data: begin of gt_outtab occurs 0.     "with header line
        include structure sflight.
data: celltab type lvc_t_styl.
data: end of gt_outtab.

THEN...


form fill_celltab using value(p_mode)
                  changing pt_celltab type lvc_t_styl.
  data: ls_celltab type lvc_s_styl,
        l_mode type raw4.
* This forms sets the style of columns 'PRICE', FLDATE and PLANETYPE
* editable

  if p_mode eq 'RW'.
    l_mode = cl_gui_alv_grid=>mc_style_enabled.
  else.                                "p_mode eq 'RO'
    l_mode = cl_gui_alv_grid=>mc_style_disabled.
  endif.

  ls_celltab-fieldname = 'FLDATE'.
  ls_celltab-style = l_mode.
  insert ls_celltab into table pt_celltab.
  ls_celltab-fieldname = 'PRICE'.
  ls_celltab-style = l_mode.
  insert ls_celltab into table pt_celltab.
  ls_celltab-fieldname = 'PLANETYPE'.
  ls_celltab-style = l_mode.
  insert ls_celltab into table pt_celltab.

endform.  

hope it helps you