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

Disable column when in edit mode.

Former Member
0 Likes
1,902

Hallo,

I want the user to be able to input data in some columns of my ALV Grid, but not in all. How can I disable some columns for input, when the ALV Grid is in Input/Edit mode?

Thank you,

Manuel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,367

Hi,

Step 1.

Add this feild in ur Internal table.

field_style TYPE lvc_t_styl, "FOR DISABLE

FORM build_layout.

  • Set layout field for field attributes(i.e. input/output)

  • gd_layout-no_input = 'X'.

gd_layout-cwidth_opt = 'X'.

gd_layout-stylefname = 'FIELD_STYLE'.

gd_layout-zebra = 'X'.

gd_layout-info_fname = 'LINE_COL'.

ENDFORM. " BUILD_LAYOUT

*step-2 * Call this Subroutine before Fieldcatalog........

FORM set_specific_field_attributes .

DATA ls_stylerow TYPE lvc_s_styl .

DATA lt_styletab TYPE lvc_t_styl .

clear : ls_stylerow.

clear : wa_final-field_style.

refresh WA_FINAL-FIELD_STYLE[].

  • Populate style variable (FIELD_STYLE) with style properties

  • The following code sets it to be disabled(display only)

  • if child deal Ticket Number Approved or rejected.

LOOP AT it_final INTO wa_final.

IF wa_final-apprd = 'X' or wa_final-rejct = 'X'.

ls_stylerow-fieldname = 'APPRD' .

ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

APPEND ls_stylerow TO wa_final-field_style.

MODIFY it_final FROM wa_final. "my Internal table, Replace ur internal table.

ls_stylerow-fieldname = 'REJCT' . " ur field name

ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

APPEND ls_stylerow TO wa_final-field_style.

MODIFY it_final FROM wa_final.

endif.

  • like this u have to add for all colunms in ur report which u

  • want to disable.

  • Note the stylerow appending should be in Alphabetic order

ENDLOOP.

ENDFORM. " set_specific_field_attributes

Thanx

bgan.

Hallo,

I want the user to be able to input data in some columns of my ALV Grid, but not in all. How can I disable some columns for input, when the ALV Grid is in Input/Edit mode?

Thank you,

Manuel

3 REPLIES 3
Read only

Former Member
0 Likes
1,367

Hello,

In the fieldcatalog of the fields u want to the user to edit do like this.

IF u want to change field1 then in the field catalog of field1

IT_FIELDCAT-EDIT = 'X'

Cheers,

Vasanth

Read only

Former Member
0 Likes
1,367

HI ,

try like this

l_r_fieldcat-tabname = 'G_T_ITAB'.

l_r_fieldcat-edit = 'X'.

l_r_fieldcat-outputlen = 10.

l_r_fieldcat-col_pos = 1.

l_r_fieldcat-seltext_m = 'Sales Order'.

APPEND l_r_fieldcat TO g_t_fieldcat.

CLEAR l_r_fieldcat.

reward if usefull....

Read only

Former Member
0 Likes
1,368

Hi,

Step 1.

Add this feild in ur Internal table.

field_style TYPE lvc_t_styl, "FOR DISABLE

FORM build_layout.

  • Set layout field for field attributes(i.e. input/output)

  • gd_layout-no_input = 'X'.

gd_layout-cwidth_opt = 'X'.

gd_layout-stylefname = 'FIELD_STYLE'.

gd_layout-zebra = 'X'.

gd_layout-info_fname = 'LINE_COL'.

ENDFORM. " BUILD_LAYOUT

*step-2 * Call this Subroutine before Fieldcatalog........

FORM set_specific_field_attributes .

DATA ls_stylerow TYPE lvc_s_styl .

DATA lt_styletab TYPE lvc_t_styl .

clear : ls_stylerow.

clear : wa_final-field_style.

refresh WA_FINAL-FIELD_STYLE[].

  • Populate style variable (FIELD_STYLE) with style properties

  • The following code sets it to be disabled(display only)

  • if child deal Ticket Number Approved or rejected.

LOOP AT it_final INTO wa_final.

IF wa_final-apprd = 'X' or wa_final-rejct = 'X'.

ls_stylerow-fieldname = 'APPRD' .

ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

APPEND ls_stylerow TO wa_final-field_style.

MODIFY it_final FROM wa_final. "my Internal table, Replace ur internal table.

ls_stylerow-fieldname = 'REJCT' . " ur field name

ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

APPEND ls_stylerow TO wa_final-field_style.

MODIFY it_final FROM wa_final.

endif.

  • like this u have to add for all colunms in ur report which u

  • want to disable.

  • Note the stylerow appending should be in Alphabetic order

ENDLOOP.

ENDFORM. " set_specific_field_attributes

Thanx

bgan.