FORM set_style  USING   fieldname
                        style TYPE string
                CHANGING   it_styles TYPE lvc_t_styl.

  DATA: ls_style TYPE lvc_s_styl.
  CLEAR ls_style.

  ls_style-fieldname = fieldname.
  IF style EQ 'ENABLE'.
    ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
  ELSE.
    ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
  ENDIF.
  READ TABLE it_styles TRANSPORTING NO FIELDS WITH KEY fieldname = fieldname.
  IF sy-subrc EQ 0.
    MODIFY it_styles FROM ls_style INDEX sy-tabix.
  ELSE.
    INSERT ls_style INTO TABLE it_styles.
  ENDIF.

  FREE: ls_style.

ENDFORM.                    " SET_STYLE

 

例如:PERFORM set_style  USING 'ZYY' 'DISABLE' CHANGING <data>-style.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-12-20
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2021-04-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-01-28
  • 2022-12-23
相关资源
相似解决方案