08-27-2008 11:04 AM
hi,
I'm facing a problem to disable some checkbox in my ALV.
I have used ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
to disable somes (including the checkbox).
The cell is well disabled but I can always check the checkbox in the cell.
I used 'REUSE_ALV_LVC' for alv dispplay.
Anyone could help me?
Tks in advance
Yimin
08-27-2008 1:27 PM
Check this
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/disableorEnableInputfieldsConditionallyIn+ALV
08-27-2008 1:04 PM
Hi ,
try using CL_GUI_FRONTEND_SERVICES class, and TABLE_FOR_FIRST_DISPLAY method
Regards,
Chinna
08-27-2008 1:27 PM
Check this
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/disableorEnableInputfieldsConditionallyIn+ALV
08-27-2008 2:28 PM
I got this problem because the column is set to 'Hotspot'.
The cl_gui_alv_grid=>mc_style_disabled doesn't work in this case.
How can I disable the hotspot of a single cell?
rgds
Yimin
08-27-2008 6:04 PM
WHY are you using hotspot for checkbox, you can use directly without using hotspot.
08-28-2008 10:04 AM
Vijay,
If I disable the hotspot, then I need to double -click the checkbox in ordre to check it.
it's not what I wait...
08-28-2008 10:15 AM
I am not sure this is what you are looking for ..Just check this sample code..
REPORT zalv_edit.
TYPE-POOLS: slis.
*- Fieldcatalog
DATA: it_fieldcat TYPE lvc_t_fcat.
DATA: x_fieldcat TYPE lvc_s_fcat.
DATA: x_layout TYPE lvc_s_layo.
"{ FOR DISABLE
DATA: ls_edit TYPE lvc_s_styl,
lt_edit TYPE lvc_t_styl.
"} FOR DISABLE
DATA: BEGIN OF it_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
check(1),
style TYPE lvc_t_styl, "FOR DISABLE
END OF it_vbap.
DATA: ls_outtab LIKE LINE OF it_vbap.
SELECT vbeln
posnr
UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE it_vbap
FROM vbap.
DATA:l_pos TYPE i VALUE 1.
CLEAR: l_pos.
l_pos = l_pos + 1.
x_fieldcat-coltext = 'CHECK'.
x_fieldcat-fieldname = 'CHECK'.
x_fieldcat-tabname = 'IT_VBAP'.
x_fieldcat-col_pos = l_pos.
*x_fieldcat-edit = 'X'.
x_fieldcat-checkbox = 'X'.
x_fieldcat-outputlen = '10'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
l_pos = l_pos + 1.
x_fieldcat-coltext = 'VBELN'.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-tabname = 'IT_VBAP'.
x_fieldcat-col_pos = l_pos.
*x_fieldcat-edit = 'X'.
x_fieldcat-outputlen = '10'.
x_fieldcat-ref_field = 'VBELN'.
x_fieldcat-ref_table = 'VBAK'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
l_pos = l_pos + 1.
x_fieldcat-coltext = 'POSNR'.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-tabname = 'IT_VBAP'.
x_fieldcat-col_pos = l_pos.
*x_fieldcat-edit = 'X'.
x_fieldcat-outputlen = '5'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
l_pos = l_pos + 1.
"{FOR DISABLE HERE 6ROW IS DISABLED
LOOP AT it_vbap.
CLEAR : lt_edit, ls_edit.
IF sy-tabix NE 6.
ls_edit-style2 = cl_gui_alv_grid=>mc_style_enabled.
ls_edit-style = cl_gui_alv_grid=>mc_style_hotspot.
ELSE.
ls_edit-style2 = cl_gui_alv_grid=>mc_style_disabled.
ls_edit-style = cl_gui_alv_grid=>mc_style_hotspot_no.
ENDIF.
ls_edit-fieldname = 'CHECK'.
ls_edit-style3 = space.
ls_edit-style4 = space.
ls_edit-maxlen = 5.
INSERT ls_edit INTO TABLE lt_edit.
INSERT lines of lt_edit INTO TABLE ls_outtab-style.
MODIFY it_vbap INDEX sy-tabix FROM ls_outtab TRANSPORTING
style .
CLEAR ls_outtab.
ENDLOOP.
x_layout-stylefname = 'STYLE'.
x_layout-no_rowmark = 'X'.
"} UP TO HERE
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
is_layout_lvc = x_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat_lvc = it_fieldcat
TABLES
t_outtab = it_vbap[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UCOMM text
* -->SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
BREAK-POINT.
CASE ucomm.
WHEN'&IC1'.
ENDCASE.
ENDFORM. "user_command
This will Disable the Hotspot and Edit option also.
Check it once and get back if you have any issues
08-28-2008 1:44 PM
ls_edit-style = cl_gui_alv_grid=>mc_style_hotspot_no.
That's what I'm looking for...
Tks Vijay!
08-28-2008 8:09 AM
Hi yimin,
You can try the following
This will stop the editable cells of your alv from accepting the input.
call method g_grid->set_ready_for_input
exporting
i_ready_for_input = 0.
Regards,
Kaushik.