Object ALV Hücre açma kapama

Object Oriented ALV'de çok sık kullanılan basit iki subroutine;



*&---------------------------------------------------------------------*
*&      Form  ENABLE_CELL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_FIELD  text
*----------------------------------------------------------------------*
FORM enable_cell  USING    p_field.
  DATA ls_cellstyles TYPE lvc_s_styl .

  LOOP AT out_kalem-field_style INTO ls_cellstyles
                                  WHERE fieldname = p_field.
    ls_cellstyles-style = cl_gui_alv_grid=>mc_style_enabled.
    MODIFY out_kalem-field_style FROM ls_cellstyles.
  ENDLOOP.
  IF sy-subrc NE 0.
    ls_cellstyles-fieldname = p_field.
    ls_cellstyles-style = cl_gui_alv_grid=>mc_style_enabled.
    APPEND ls_cellstyles TO out_kalem-field_style.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  DISABLE_CELL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_FIELD  text
*----------------------------------------------------------------------*
FORM disable_cell  USING    p_field.

  DATA ls_cellstyles TYPE lvc_s_styl .

  LOOP AT out_kalem-field_style INTO ls_cellstyles
                                  WHERE fieldname = p_field.
    ls_cellstyles-style = cl_gui_alv_grid=>mc_style_disabled..
    MODIFY out_kalem-field_style FROM ls_cellstyles.
  ENDLOOP.
  IF sy-subrc NE 0.
    ls_cellstyles-fieldname = p_field.
    ls_cellstyles-style = cl_gui_alv_grid=>mc_style_disabled.
    APPEND ls_cellstyles TO out_kalem-field_style.
  ENDIF.

ENDFORM.

Hiç yorum yok:

Yorum Gönder