
METHOD get_empty_mandatory_fields.
CALL METHOD super->get_empty_mandatory_fields
RECEIVING
rt_result = rt_result.
DATA: lv_cnode_name TYPE string,
lv_last_cnode_name TYPE string,
lv_attr_path TYPE string,
lv_attr_name TYPE string,
lv_attr_value TYPE string,
lv_attr_meta TYPE REF TO if_bsp_metadata,
lv_exception TYPE REF TO cx_bol_exception,
lv_dynamic_mandatory_field TYPE bsp_dlc_binding_string.
lv_dynamic_mandatory_field = '//HEADER/STRUCT.FIRSTNAME'.
* split binding expression
SPLIT lv_dynamic_mandatory_field+2(*) AT '/' INTO lv_cnode_name lv_attr_path.
TRANSLATE lv_cnode_name TO LOWER CASE. "#EC SYNTCHAR
IF lv_cnode_name NE lv_last_cnode_name.
* get cnode instance
FIELD-SYMBOLS: <cnode> TYPE lbsp_model_item.
READ TABLE me->m_models WITH KEY model_id = lv_cnode_name
ASSIGNING <cnode>.
ENDIF.
IF <cnode> IS ASSIGNED.
* was the field input ready?
DATA: lv_cnode TYPE REF TO cl_bsp_wd_context_node,
lv_component TYPE string,
lv_type TYPE i.
TRY.
TRY.
lv_cnode ?= <cnode>-instance.
DATA: lv_title TYPE string.
lv_title = <cnode>-instance->if_bsp_model_binding~get_attribute( attribute_path = 'STRUCT.TITLE_ACA1' ).
CATCH cx_sy_move_cast_error.
* unexpected context node type -> consider field to be input ready!
ENDTRY.
READ TABLE rt_result INTO DATA(ls_firstname_mandatory) WITH KEY table_line = lv_dynamic_mandatory_field.
IF lv_title <> '0002' AND ls_firstname_mandatory IS NOT INITIAL.
DELETE rt_result WHERE table_line = lv_dynamic_mandatory_field.
ELSEIF lv_title = '0002' AND ls_firstname_mandatory IS INITIAL.
TRY.
lv_cnode->if_bsp_model_util~disassemble_path( EXPORTING path = lv_attr_path
IMPORTING name = lv_attr_name
component = lv_component
type = lv_type ).
DATA: lv_disabled TYPE string.
CASE lv_type.
WHEN if_bsp_model_binding=>co_type_struct.
IF lv_attr_name = 'EXT'.
lv_disabled = lv_cnode->get_i_s_ext( component = lv_component ).
ELSE.
lv_disabled = lv_cnode->get_i_s_struct( component = lv_component ).
ENDIF.
WHEN if_bsp_model_binding=>co_type_simple.
lv_disabled = lv_cnode->get_i_s_struct( component = lv_attr_name ).
ENDCASE.
CHECK lv_disabled IS INITIAL OR lv_disabled(1) CS 'F'. "means 'f', 'F', 'false' or 'FALSE'
CATCH cx_sy_move_cast_error.
* unexpected context node type -> consider field to be input ready!
ENDTRY.
lv_attr_value = <cnode>-instance->if_bsp_model_binding~get_attribute( attribute_path = lv_attr_path ).
IF lv_attr_value IS INITIAL.
* mandatory field is still initial
APPEND lv_dynamic_mandatory_field TO rt_result.
ELSE.
* string is not initial -> field might still be initial depending on type
lv_attr_meta = <cnode>-instance->if_bsp_model_binding~get_attribute_metadata( attribute_path = lv_attr_path ).
IF lv_attr_meta IS BOUND AND lv_attr_meta->get_abap_type( ) CA 'DTIPFNbs'.
* field type is Date, Time, Integer, Packed, or Float -> number passed
IF lv_attr_value NA '123456789'.
* mandatory field is still initial
APPEND lv_dynamic_mandatory_field TO rt_result.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CATCH cx_bol_exception INTO lv_exception.
IF lv_exception->textid = cx_bol_exception=>entity_already_freed.
DATA: lv_pattern TYPE string.
CONCATENATE '//' lv_cnode_name '/*' INTO lv_pattern.
* delete LT_MANDATORY_FIELDS where TABLE_LINE cp LV_PATTERN.
ELSE.
RAISE EXCEPTION lv_exception.
ENDIF.
ENDTRY.
ENDIF.
lv_last_cnode_name = lv_cnode_name.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |