05-30-2016 10:50 AM
Hi all,
I try to make a cell editable according on the value selected from dropdown but she stay disabled.
I use event DATA_CHANGED like below :
METHOD handle_data_changed.
*-----------< Déclaration >----------------*
DATA:
* Structures
ls_good_cost TYPE lvc_s_modi
, ls_cellstyle TYPE lvc_s_styl
* Variables
.
* Pointeurs
FIELD-SYMBOLS:
<ls_data_changed> TYPE lvc_s_modi
.
*-----------< Début traitement >-----------*
*--- Lecture de la valeur modifiée
LOOP AT er_data_changed->mt_good_cells ASSIGNING <ls_data_changed>.
IF <ls_data_changed>-fieldname = 'PEC'.
CASE <ls_data_changed>-value.
WHEN 'N' "Non pertinant
OR 'E'. "Exception / Hors périmètre
*--- Ajout du paramètre editable de la cellule
READ TABLE gt_amo_error INDEX <ls_data_changed>-row_id
ASSIGNING <gs_amo_error>.
IF sy-subrc = 0.
ls_cellstyle-fieldname = 'COMMENTAIRE'.
ls_cellstyle-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_cellstyle TO <gs_amo_error>-cellstyles.
FREE ls_cellstyle.
ENDIF.
WHEN OTHERS.
"Ne rien faire
ENDCASE.
ENDIF.
ENDLOOP.
*-----------< Fin traitement >-----------*
ENDMETHOD.
Thanks for your help.
05-30-2016 11:14 AM
Did you call the method REFRESH for the grid at the end of event DATA_CHANGE_FINISHED?
05-30-2016 11:14 AM
Did you call the method REFRESH for the grid at the end of event DATA_CHANGE_FINISHED?
05-30-2016 2:35 PM
No, I didn't.
I just call the event DATA_CHANGED, but I tried that :
READ TABLE gt_amo_error INDEX <ls_data_changed>-row_id
ASSIGNING <gs_amo_error>.
IF sy-subrc = 0.
READ TABLE <gs_amo_error>-cellstyles INDEX 1
ASSIGNING <ls_cellstyles>.
IF sy-subrc = 0.
<ls_cellstyles>-style = cl_gui_alv_grid=>mc_style_enabled.
UNASSIGN <ls_cellstyles>.
ENDIF.
UNASSIGN <gs_amo_error>.
ENDIF.
And I wrote that in PBO :
READ TABLE gt_fcat WITH KEY fieldname = 'COMMENTAIRE'
ASSIGNING <gs_fcat>.
IF sy-subrc = 0.
<gs_fcat>-edit = abap_true.
UNASSIGN <gs_fcat>.
ENDIF.
DATA ls_cellstyle TYPE lvc_s_styl.
LOOP AT gt_amo_error ASSIGNING <gs_amo_error>.
ls_cellstyle-fieldname = 'COMMENTAIRE'.
ls_cellstyle-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_cellstyle TO <gs_amo_error>-cellstyles.
FREE ls_cellstyle.
ENDLOOP.
But, i don't have that I want because only the last modified line is taken into account : .
05-30-2016 5:35 PM
You have to call er_data_changed->MODIFY_STYLE during the event DATA_CHANGED. No need to call refresh_table_display.
05-30-2016 11:17 AM
You must make your ALV grid editable: either field EDIT = 'X' of the layout parameter (of SET_TABLE_FOR_FIRST_DISPLAY), or SET_READY_FOR_INPUT( 1 ). You may only make one column editable using field EDIT = 'X' of field catalog
Message was edited by: Sandra Rossi My answer was not relevant