Some time the requirement comes from customer that I don't want to see the message "Required entry field not filled. Click here to continue anyway" as it allows to navigate away from the view even there are some empty mandatory fields.
This requirement can be addressed by redefining the DO_FINISH_INPUT() method for that particular view. We just need to change the condition, from '#empty_mand_field' to 'EMPTYMANDTFIELD' OR something else , of mandatory error messages.
DATA : lt_mandatory_fields TYPEbsp_dlct_fieldname, lv_element_id TYPEbsp_dlc_element_id, lv_cnode_name TYPE string, lv_attr TYPE string, lv_label TYPE string, lv_event TYPE string, lr_cnode TYPE REF TOcl_bsp_wd_context_node, lr_view_descriptor TYPE REF TOif_bsp_dlc_view_descriptor. lt_mandatory_fields = get_empty_mandatory_fields( ). IFme->configuration_descr ISBOUND . global_messages->delete_message( condition = cl_bsp_wd_view_controller=>co_mandatory_field_empty ). lr_view_descriptor = me->configuration_descr->get_property_descriptor( ). LOOPATlt_mandatory_fields INTOlv_element_id. CLEAR: lv_cnode_name, lv_attr, lv_label. SPLITlv_element_id+2(*) AT'/'INTOlv_cnode_name lv_attr. lr_cnode ?= me->get_model( lv_cnode_name ). lv_label = lr_view_descriptor->get_field_label( iv_element_id = lv_element_id iv_context_node = lr_cnode ). IF global_messages ISBOUND. global_messages->add_message( condition = 'EMPTYMANDTFIELD' message = text-010 severity = cl_bsp_messages=>co_severity_error p1 = lv_label dummy = me->component_id ). ENDIF. ENDLOOP. ENDIF. ENDIF. ENDMETHOD.
Text-10 = 'Make an entry in field '%1''
Comments