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.
时间: 2024-10-11 00:41:44