Skip to Content
0

Checkbox should be grayed out in alv once you select it and press save button

Feb 17, 2017 at 02:24 PM

98

avatar image
Former Member

Hi all,

I'm displaying a alv and once of the fields(chk) is a checkbox. I need to gray out the checkbox once i select it and press save. It should be editable again only if we execute the report all over.

I'm using REUSE_ALV_GRID_DISPLAY.

Thanks in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

omer sakar Feb 17, 2017 at 02:51 PM
0

Hi Sarayu,

There is standard demo report : BCALV_TEST_FULLSCREEN ,you can find how to do it.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Omer,

I wasn't able to figure out. Can you please share a sample code?

Thank you

0

You can add below codes :

Step 1 : Before first display alv, set fieldcat-edit = 'X'.

Step 2 : set parameter i_callback_user_command = 'USER_COMMAND' of REUSE_ALV_GRID_DISPLAY 

Step 3 : 
FORM user_command USING r_ucomm LIKE sy-ucomm

                        rs_selfield TYPE slis_selfield.
 DATA :ref_grid TYPE REF TO cl_gui_alv_grid.
 WHEN 'SAVE'.

      LOOP AT gt_fieldcat INTO gs_fieldcat.
        CASE gs_fieldcat-fieldname.
          WHEN 'CHK'.
           gs_fieldcat-edit = ''.
            MODIFY gt_fieldcat FROM gs_fieldcat.
        ENDCASE.
      ENDLOOP.
  ENDCASE.


CALL FUNCTION 'LVC_TRANSFER_FROM_SLIS'
  EXPORTING
    it_fieldcat_alv       = gt_fieldcat"first fieldcatalog CHK is editable
 IMPORTING
 ET_FIELDCAT_LVC       = gt_fieldcat2"second fieldcatalog CHK is noneditable
  tables
    it_data               = gt_report" internal table as displayed
* EXCEPTIONS
*   IT_DATA_MISSING       = 1
*   OTHERS                = 2
          .

  IF ref_grid IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        e_grid = ref_grid.
  ENDIF.

  IF NOT ref_grid IS INITIAL.
    CALL METHOD ref_grid->set_frontend_fieldcatalog
     EXPORTING
        it_fieldcatalog = gt_fieldcat2
       .

    CALL METHOD ref_grid->check_changed_data .
  ENDIF.

rs_selfield-refresh = 'X'.

endform.
0