sap 只对form 的必填字段 红框显示,这里在列表编辑时,实现红框效果:
GC_BG_COLOR_MANDATORY Constant Public Type STRING
'#FFE8EA;border:1px solid #C40000;'
METHOD GET_P_ZZNAME.
DATA ls_AET_ATTR TYPE ztaet01_bol_attr .
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_picklist.
WHEN if_bsp_wd_model_setter_getter=>fp_bgcolor.
DATA(lr_ite) = collection_wrapper->get_iterator( ).
IF lr_ite IS BOUND.
DATA(lr_curr) = lr_ite->get_by_index( iv_index ).
IF lr_curr IS BOUND.
lr_curr->get_properties( IMPORTING es_attributes = ls_AET_ATTR ).
ENDIF.
ENDIF.
IF ls_AET_ATTR-ZZNAME is INITIAL . "
rv_value = GC_BG_COLOR_MANDATORY. "高亮 '#DC143C'. " 红色必填
ENDIF .
ENDCASE.
ENDMETHOD.
必填错误消息可以在badi 里检查报错:
IF_EX_AXT_RT_TABLES_API~CHECK