Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9285

How to Set Checkbox of ALV Grid Dark on Display Mode

$
0
0

    ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.

 

    Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.

   alv_grid_checkbox_display.png

 

    I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.

 

    Help me solve this problem, please.

 

    Part of my codes are as follows.

 

    Part 1:

IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.

       set_enable( iv_flag = 1 ).

       LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.

         CLEAR ls_celltab.

         IF <lfs_acct_group_item>-celltab IS INITIAL.

           CLEAR ls_celltab.

           ls_celltab-fieldname = 'CHECK_BOX'.

           ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

           APPEND ls_celltab TO <lfs_acct_group_item>-celltab.

           CLEAR ls_celltab.

           ls_celltab-fieldname = 'XPORE'.

           ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

           APPEND ls_celltab TO <lfs_acct_group_item>-celltab.

         ELSE.

           LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.

             <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.

           ENDLOOP.

         ENDIF.

       ENDLOOP.

 

     ELSE.

       set_enable( iv_flag = 0 ).

       LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.

         IF <lfs_acct_group_item>-celltab IS INITIAL.

           CLEAR ls_celltab.

           ls_celltab-fieldname = 'CHECK_BOX'.

           ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.

           APPEND ls_celltab TO <lfs_acct_group_item>-celltab.

           CLEAR ls_celltab.

           ls_celltab-fieldname = 'XPORE'.

           ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.

           APPEND ls_celltab TO <lfs_acct_group_item>-celltab.

         ELSE.

           LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.

             <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.

           ENDLOOP.

         ENDIF.

       ENDLOOP.

 

     ENDIF.

 

     CALL METHOD gr_grid->refresh_table_display

*      EXPORTING

*        is_stable      =

*        i_soft_refresh =

       EXCEPTIONS

         finished       = 1

         OTHERS         = 2

             .

 

     IF sy-subrc <> 0.

*     Implement suitable error handling here

     ENDIF.


    Part 2:

METHOD set_enable.

 

     gr_grid->set_ready_for_input(

         i_ready_for_input = iv_flag

     ).

 

ENDMETHOD.


Viewing all articles
Browse latest Browse all 9285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>