1.直接在节点上增加VALUE NODE。
2.写GET,SET,I,P的相关实现
method GET_ZH12. DATA: lr_current TYPE REF TO if_bol_bo_property_access, lr_coll TYPE REF TO if_bol_entity_col, lr_iter TYPE REF TO if_bol_bo_col_iterator, ls_text TYPE crmst_text_btil, ls_admin_h TYPE crmst_adminh_btil, lr_texth TYPE REF TO cl_crm_bol_entity, lr_text TYPE REF TO cl_crm_bol_entity, lr_entity TYPE REF TO cl_crm_bol_entity. *************************************************************************************************** IF iterator IS BOUND. lr_current = iterator->get_current( ). ELSE. lr_current = collection_wrapper->get_current( ). ENDIF. CALL METHOD lr_current->get_properties IMPORTING es_attributes = ls_admin_h. TRY. lr_entity ?= lr_current. lr_coll = lr_entity->get_related_entities( iv_relation_name = 'BTHeaderTextSet' ). "#EC NOTEXT lr_current = lr_coll->get_current( ). CHECK lr_current IS BOUND. lr_texth ?= lr_current. lr_coll = lr_texth->get_related_entities( iv_relation_name = 'BTTextHAll' ). "#EC NOTEXT IF lr_coll IS NOT BOUND OR lr_coll->size( ) = 0. ELSE. IF lr_coll->size( ) > 0. lr_iter = lr_coll->if_bol_bo_col~get_iterator( ). IF lr_iter IS BOUND. lr_text ?= lr_iter->find_by_property( EXPORTING iv_attr_name = 'TDID' iv_value = 'ZH12' ). ENDIF. ENDIF. ENDIF. IF lr_text IS BOUND. TRY. lr_text->get_property_as_value( EXPORTING iv_attr_name = 'CONC_LINES' IMPORTING ev_result = value ). "#EC NOTEXT CATCH cx_crm_cic_parameter_error. ENDTRY. ELSE. IF lr_texth->is_changeable( ) = abap_true. TRY. lr_text = lr_texth->create_related_entity( iv_relation_name = 'BTTextHAll' ). CALL METHOD lr_text->if_bol_bo_property_access~get_properties IMPORTING es_attributes = ls_text. ls_text-tdobject = 'CRM_ORDERH' . ls_text-tdname = ls_admin_h-guid . ls_text-tdid = 'ZH12'. ls_text-tdspras = 'E' . CALL METHOD lr_text->if_bol_bo_property_access~set_properties EXPORTING is_attributes = ls_text. lr_text->deactivate_sending( ). CATCH cx_crm_genil_model_error cx_crm_genil_duplicate_rel. RETURN. ENDTRY. ENDIF. ENDIF. CATCH cx_sy_ref_is_initial cx_sy_move_cast_error cx_crm_genil_model_error. RETURN. ENDTRY. endmethod.
method SET_ZH12. DATA: lr_current TYPE REF TO if_bol_bo_property_access, lr_texth TYPE REF TO cl_crm_bol_entity, lr_text TYPE REF TO cl_crm_bol_entity, lr_dref TYPE REF TO data, lr_copy TYPE REF TO data, lr_iter TYPE REF TO if_bol_bo_col_iterator, ls_text TYPE crmst_text_btil, ls_admin_h TYPE crmst_adminh_btil, lr_coll TYPE REF TO if_bol_entity_col, lr_entity TYPE REF TO cl_crm_bol_entity. DATA:ls_crmst_adminh_btil TYPE crmst_adminh_btil, ls_crmt_orgman_wrk TYPE crmt_orgman_wrk. FIELD-SYMBOLS: <nval> TYPE any, <oval> TYPE any. *************************************************************************************************** IF iterator IS BOUND. lr_current = iterator->get_current( ). ELSE. lr_current = collection_wrapper->get_current( ). ENDIF. CALL METHOD lr_current->get_properties IMPORTING es_attributes = ls_admin_h. TRY. lr_entity ?= lr_current. lr_coll = lr_entity->get_related_entities( iv_relation_name = 'BTHeaderTextSet' ). "#EC NOTEXT lr_current = lr_coll->get_current( ). CHECK lr_current IS BOUND. lr_texth ?= lr_current. lr_coll = lr_texth->get_related_entities( iv_relation_name = 'BTTextHAll' ). "#EC NOTEXT IF lr_coll->size( ) > 0. lr_iter = lr_coll->if_bol_bo_col~get_iterator( ). IF lr_iter IS BOUND. lr_text ?= lr_iter->find_by_property( EXPORTING iv_attr_name = 'TDID' iv_value = 'ZH12' ). ENDIF. ENDIF. ***********************************add by dq-yuw IF lr_text IS NOT BOUND. IF lr_texth->is_changeable( ) = abap_true. TRY. lr_text = lr_texth->create_related_entity( iv_relation_name = 'BTTextHAll' ). CALL METHOD lr_text->if_bol_bo_property_access~get_properties IMPORTING es_attributes = ls_text. ls_text-tdobject = 'CRM_ORDERH' . ls_text-tdname = ls_admin_h-guid . ls_text-tdid = 'ZH12'. ls_text-tdspras = 'E' . CALL METHOD lr_text->if_bol_bo_property_access~set_properties EXPORTING is_attributes = ls_text. lr_text->deactivate_sending( ). CATCH cx_crm_genil_model_error cx_crm_genil_duplicate_rel. RETURN. ENDTRY. ENDIF. ENDIF. ************************************************************** TRY. lr_dref = lr_text->get_property( 'CONC_LINES' ). "#EC NOTEXT CATCH cx_crm_cic_parameter_error. RETURN. ENDTRY. CATCH cx_sy_ref_is_initial cx_sy_move_cast_error cx_crm_genil_model_error. RETURN. ENDTRY. CHECK lr_dref IS BOUND. ASSIGN lr_dref->* TO <oval>. CREATE DATA lr_copy LIKE <oval>. ASSIGN lr_copy->* TO <nval>. TRY. CALL METHOD if_bsp_model_util~convert_from_string EXPORTING data_ref = lr_copy value = value. CATCH cx_sy_conversion_error. RAISE EXCEPTION TYPE cx_bsp_conv_failed EXPORTING name = 'TEXT'. "#EC NOTEXT ENDTRY. IF <nval> NE <oval>. lr_text->set_property( iv_attr_name = 'CONC_LINES' "#EC NOTEXT iv_value = <nval> ). ENDIF. endmethod.
METHOD GET_P_ZH12. CASE IV_PROPERTY. WHEN IF_BSP_WD_MODEL_SETTER_GETTER=>FP_FIELDTYPE. RV_VALUE = CL_BSP_DLC_VIEW_DESCRIPTOR=>FIELD_TYPE_TEXTAREA. WHEN IF_BSP_WD_MODEL_SETTER_GETTER=>FP_TEXTAREA_ROWS. RV_VALUE = 4. ENDCASE. ENDMETHOD.