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 some checkbox based on condition using alv function module approach

Former Member
0 Likes
2,902

hi,

    i need to disable some of the checkboxes based on some condition in alv using FM approach.i have tried s_layout-box_fieldname = '-'.but, check box is going off completely.i want to grey it out.i dont want to completely remove the check box

4 REPLIES 4
Read only

alessandroieva
Active Participant
0 Likes
1,980

Hi,

1) add field celltab TYPE lvc_t_styl in your internal table.

2) add below code after define ALV container:

  CALL METHOD ref_alv->register_edit_event
EXPORTING
i_event_id
= cl_gui_alv_grid=>mc_evt_enter


3)fill layout field like this: p_layout-stylefname = 'CELLTAB’.

4)add below code before call first_display:


CALL METHOD ref_alv ->register_edit_event
EXPORTING
i_event_id
= cl_gui_alv_grid=>mc_evt_modified.

5) add below code after call first_display:

* Set editable cells to ready for input initially
CALL METHOD alv->set_ready_for_input
EXPORTING
i_ready_for_input
= 1.


6) when you want disabled checkbox field, fill celltab field like this:


ls_celltab-fieldname = <field_name>.
ls_celltab
-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_celltab INTO TABLE lt_celltab.


Let me know,

AI

Read only

0 Likes
1,980

Just to supplement the given answer: there are some demo reports created by SAP that present the features of ALV. Editing only selected cells within ALV is presented in report BCALV_EDIT_02.

Approach used there is OO but I believe the general idea should be the same.

Read only

Former Member
0 Likes
1,980

i found that there is no way ,to disable some checkboxes using reuse_alv_grid_display.we have to use either reuse_alv_grid_display_lvc or oop alv..using custom container..

Read only

0 Likes
1,980

You use ALV OO because my code is just for this typologi of ALV.

AI