Para
controlar el evento DATA_CHANGED en un ALV de función tenemos que registrar el
evento:
FORM gestionar_eventos .
DATA i_listevent TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_events.
READ TABLE i_events WITH KEY name = c_topofpage
INTO i_listevent.
IF sy-subrc = 0.
MOVE c_topofpage TO i_listevent-form.
MODIFY i_events FROM i_listevent TRANSPORTING form
WHERE name = c_topofpage.
CLEAR i_listevent.
i_listevent-name = 'DATA_CHANGED'.
i_listevent-form = 'DATA_CHANGED'.
APPEND i_listevent TO i_events.
ENDIF.
ENDFORM.
DATA i_listevent TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_events.
READ TABLE i_events WITH KEY name = c_topofpage
INTO i_listevent.
IF sy-subrc = 0.
MOVE c_topofpage TO i_listevent-form.
MODIFY i_events FROM i_listevent TRANSPORTING form
WHERE name = c_topofpage.
CLEAR i_listevent.
i_listevent-name = 'DATA_CHANGED'.
i_listevent-form = 'DATA_CHANGED'.
APPEND i_listevent TO i_events.
ENDIF.
ENDFORM.
Después el
evento se gestionara desde un FORM:
FORM data_changed USING rr_data TYPE REF TO cl_alv_changed_data_protocol.DATA : ls_mod_cell TYPE lvc_s_modi,
lv_value TYPE lvc_value .
DATA rs_selfield TYPE slis_selfield.
DATA: l_modif TYPE zverde_n_sac_bb.
SORT rr_data->mt_mod_cells BY row_id .
* Tratamos la linea modificada
LOOP AT rr_data->mt_mod_cells INTO ls_mod_cell.
IF ls_mod_cell-fieldname = 'NSC' OR ls_mod_cell-fieldname = 'NUM'.
ENDLOOP.
ENDFORM. "data_changed
No hay comentarios:
Publicar un comentario