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: 

ALV juts some cell editable

Former Member
0 Kudos

Hi Gurus,

My problem the follow:

I create an alv grid(with REUSE_ALV_GRID_DISPLAY FM)  which not all cell is filled. I'd like that the user will be modify ONLY the empty cells.

Do you have any idea?

Header 1Header 2Header 3
110The user like to modify this

220

The user like to modify this32The user like to modify this
1054

So I able to the user modify the all or any cell. But I need that the user should be the red one.


Really thanks,

Mark

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mark

Maybe you need modify your report a little:

1,To add this field 'field_style  TYPE lvc_t_styl' to your output internal table, this field can control the cell editable or not.

DATA ls_stylerow TYPE lvc_s_styl .

DATA lt_styletab TYPE lvc_t_styl .

2, Looping the output itab, modify this field if the cell is empty,

IF wa_itab-x IS NOT INITIAL.

   ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

ELSE.

   ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled.

ENDIF.

APPEND ls_stylerow  TO wa_itab-field_style.

MODIFY itab.

3, To set the layout 'gd_layout-stylefname = 'FIELD_STYLE'.'

4, Using this FM 'REUSE_ALV_GRID_DISPLAY_LVC' to call ALV, set the fieldcat and layout.

regards,

Archer

3 REPLIES 3

Former Member
0 Kudos

Hi Mark

Maybe you need modify your report a little:

1,To add this field 'field_style  TYPE lvc_t_styl' to your output internal table, this field can control the cell editable or not.

DATA ls_stylerow TYPE lvc_s_styl .

DATA lt_styletab TYPE lvc_t_styl .

2, Looping the output itab, modify this field if the cell is empty,

IF wa_itab-x IS NOT INITIAL.

   ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

ELSE.

   ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled.

ENDIF.

APPEND ls_stylerow  TO wa_itab-field_style.

MODIFY itab.

3, To set the layout 'gd_layout-stylefname = 'FIELD_STYLE'.'

4, Using this FM 'REUSE_ALV_GRID_DISPLAY_LVC' to call ALV, set the fieldcat and layout.

regards,

Archer

0 Kudos

Hi Mark,

Dengyong answer is correct, maybe its just missing one little thing as shown below in bold...

1. Add field 'field_style  TYPE lvc_t_styl' to your output internal table. This field will set the cell to editable or not.

DATA ls_stylerow TYPE lvc_s_styl .

DATA lt_styletab TYPE lvc_t_styl .

2, Looping at the output itab, modify this field if the cell is empty.

ls_stylerow-fieldname = '[itab fieldname]'.

IF wa_itab-x IS NOT INITIAL.

   ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

ELSE.

   ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled.

ENDIF.

APPEND ls_stylerow  TO wa_itab-field_style.

MODIFY itab.

3, To set the layout 'gd_layout-stylefname = 'FIELD_STYLE'.'

4, Using this FM 'REUSE_ALV_GRID_DISPLAY_LVC' to call ALV, set the fieldcat and layout.

0 Kudos

thanks for correct me.