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 2

Former Member
0 Likes
1,590

Hello experts,

some time ago I posted the thread: in order to disable an ALV grid column for user input.

How can I disable the column even if the user adds a new row to the editable ALV Grid control?

and

How can I show in the disabled column information that is read from the database during user input? For instance, if the user presses ENTER?

Thanks for your help! Obviously, points will be rewarded.

Manuel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
948

Hi

U need to go for styles in alv grid. U can define a style for each cell in which u can manage editable or disable in that.

This u can handle in PBO each time conditionally. See the below code.

Add one field in your output internal table as below for populating the style.

CELLTAB TYPE LVC_T_STYL, " for input enabling the cell.

This is a table type. U need to populate this field in each row with its type to enabled or disabled as below and style for which field in your internal table. Here it is WERKS.

CELLTAB-FIELDNAME = 'WERKS'.

CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

or

CELLTAB-FIELDNAME = 'WERKS'.

CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED

insert this table in the field CELLTAB of your internal table.

in each row.

And populate the layout with style field name. Here our field is CELLTAB.

GS_LAYOUT-STYLEFNAME = 'CELLTAB'.

GS_LAYOUT-EDIT = GC_X.

This can solve ur problem

Venkat.

2 REPLIES 2
Read only

Former Member
0 Likes
949

Hi

U need to go for styles in alv grid. U can define a style for each cell in which u can manage editable or disable in that.

This u can handle in PBO each time conditionally. See the below code.

Add one field in your output internal table as below for populating the style.

CELLTAB TYPE LVC_T_STYL, " for input enabling the cell.

This is a table type. U need to populate this field in each row with its type to enabled or disabled as below and style for which field in your internal table. Here it is WERKS.

CELLTAB-FIELDNAME = 'WERKS'.

CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

or

CELLTAB-FIELDNAME = 'WERKS'.

CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED

insert this table in the field CELLTAB of your internal table.

in each row.

And populate the layout with style field name. Here our field is CELLTAB.

GS_LAYOUT-STYLEFNAME = 'CELLTAB'.

GS_LAYOUT-EDIT = GC_X.

This can solve ur problem

Venkat.

Read only

Former Member
0 Likes
948

hi,

will you please elaborate your query .

so that at what scenario you need to disable the column.

Regards,

Madhavi