Hi All,
I am new to CRM and have done couple of enhancements. Now I am struck up with one of the Web UI enhancement. Using AET our functional consultant has created a check-box field in Service Request screen. The ZZ* field is there in the CRMD_SERVICE_H table as well.
Now this new field is found in the Component -> SRQM_INCIDENT_H, View ->IncidentHeaderEF under the context node BTADMINH. The new field is found as EXT.ZZ* field. I have implemented Setter & Getter methods as well.
The requirement is that this field should be Checked (its a check-box) by default based on some condition which I implemented in GET_ZZ* method which is working fine. But the value ('X') is not getting replicated back to the table when the Service Request is saved from WebUI.
When I checked the SET_ZZ* method, its the same standard code as below. When I debug it, its getting the exception cx_crm_cic_parameter_error at the statement "dref = current->get_property( 'ZZFLD000006' ). "#EC NOTEXT" and since the dref is not bound, exiting out of the method.
Before the methods are implemented, the value used to be updated back to SAP Data base. I checked on different posts in sdn but not sure how to fix it.
Any help on this is very much appreciated.
Thanks & Regards,
Raja Sekhar K
method SET_ZZFLD000006.
DATA:
current TYPE REF TO if_bol_bo_property_access,
dref TYPE REF TO data,
copy TYPE REF TO data.
FIELD-SYMBOLS:
<nval> TYPE ANY,
<oval> TYPE ANY.
* get current entity
if iterator is bound.
current = iterator->get_current( ).
else.
current = collection_wrapper->get_current( ).
endif.
* get old value and dataref to appropriate type
TRY.
TRY.
dref = current->get_property( 'ZZFLD000006' ). "#EC NOTEXT
CATCH cx_crm_cic_parameter_error.
ENDTRY.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.
* assure that attribue exists
CHECK dref IS BOUND.
* set <oval> to old value
ASSIGN dref->* TO <oval>.
* create a copy for new value
CREATE DATA copy LIKE <oval>.
* set <nval> to new value
ASSIGN copy->* TO <nval>.
* fill new value using the right conversion
TRY.
* TRY.
CALL METHOD if_bsp_model_util~convert_from_string
EXPORTING
data_ref = copy
value = value
attribute_path = attribute_path.
* CATCH cx_bsp_conv_illegal_ref.
* FIELD-SYMBOLS: <l_data> type DATA.
* assign copy->* to <l_data>.
* please implement here some BO specific handler coding
* conversion of currency/quantity field failed caused by missing
* unit relation
* Coding sample:
* provide currency for currency fields or decimals for quantity (select from T006).
* cl_bsp_utility=>instantiate_simple_data(
* value = value
* reference = c_currency
* num_decimals = decimals
* use_bsp_exceptions = abap_true
* data = <l_data> ).
* ENDTRY.
CATCH cx_sy_conversion_error.
RAISE EXCEPTION TYPE cx_bsp_conv_failed
EXPORTING
name = 'ZZFLD000006'."#EC NOTEXT
ENDTRY.
* only set new value if value has changed
IF <nval> <> <oval>.
current->set_property(
iv_attr_name = 'ZZFLD000006' "#EC NOTEXT
iv_value = <nval> ).
ENDIF.
endmethod.