on 06-01-2011 12:38 PM
Hi,
I am having a problem with an attribute on a bespoke view. The attribute itself was added to the model via EEWB.
It is defined as a 32 byte character field.
On the view there is a table defined as follows ;
<crmic:gridLayoutCell colSpan = "6"
columnIndex = "3"
horizontalAlignment = "LEFT"
rowIndex = "8" >
<crmic:dropdownListBox id = "TYP_COMP"
width = "100%"
table = "<%= dd_typ_cmpl %>"
nameOfKeyColumn = "DROPDWN"
nameOfValueColumn = "DROPDWN"
selection = "//BTCustomerH/ZZCUSTOMER_H0602"
disabled = "<%= disable_ddlb %>" />
</crmic:gridLayoutCell>
The values for the table are read from a Z table and populated in the method DO_PREPARE_OUTPUT ;
IF gt_typ_cmpl IS INITIAL.
SELECT * FROM zcrm_typcompl INTO TABLE gt_typ_cmpl.
ENDIF.
There are also several other attributes defined in exactly the same way , displayed on the same view , which all work as expected.
This view attribute is selectable from the dropdown list (works ok).
The issue is that everytime the view is refreshed (after saving transaction , error message display ec the selected value is lost and the whole table contents is reloaded , hence why the selected value is lost ?
I have checked all the code in the view and also the context node and it all looks the same as the other (working) fields..
Hi,
with only that part of the code it is not possible to help much. You declared the selected value like this:
selection = "//BTCustomerH/ZZCUSTOMER_H0602"
so, see what you do with the field and/or structure. Perhaps you erase with CLEAR somewhere the information or the structure and field have nothing to do in your code and that´s why you lose the value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's the rest of the code, taken from the view controller and the context node.
Where used in view controller
Method set_models.
view->set_attribute( name = 'dd_typ_cmpl' value = gt_typ_cmpl ).
Method: do_prepare_output.
IF gt_typ_cmpl IS INITIAL.
SELECT * FROM zcrm_typcompl INTO TABLE gt_typ_cmpl.
ENDIF.
Public setion.
data GT_TYP_CMPL type ZCRM_COMPT_TB
Where used in view context node
method GET_I_ZZCUSTOMER_H0602.
DATA: current TYPE REF TO if_bol_bo_property_access.
rv_disabled = 'TRUE'.
if iterator is bound.
current = iterator->get_current( ).
else.
current = collection_wrapper->get_current( ).
endif.
TRY.
IF current->is_property_readonly(
'ZZCUSTOMER_H0602' ) = abap_false. "#EC NOTEXT
rv_disabled = 'FALSE'.
ENDIF.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.
method GET_M_ZZCUSTOMER_H0602.
DATA: attr TYPE ZEEW_DATAELEMENT0602.
DATA: dref TYPE REF TO data.
GET REFERENCE OF attr INTO dref.
metadata ?= if_bsp_model_binding~get_attribute_metadata(
attribute_ref = dref
attribute_path = attribute_path
name = 'ZZCUSTOMER_H0602' "#EC NOTEXT
COMPONENT =
no_getter = 1 ).
method GET_ZZCUSTOMER_H0602
DATA: current TYPE REF TO if_bol_bo_property_access.
DATA: dref TYPE REF TO data.
value =
'BTCustomerH not bound'."#EC NOTEXT
if iterator is bound.
current = iterator->get_current( ).
else.
current = collection_wrapper->get_current( ).
endif.
TRY.
TRY.
dref = current->get_property( 'ZZCUSTOMER_H0602' ). "#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.
IF dref IS NOT BOUND.
value = 'BTCustomerH/ZZCUSTOMER_H0602 not bound'."#EC NOTEXT
RETURN.
ENDIF.
TRY.
value = if_bsp_model_util~convert_to_string( data_ref = dref
attribute_path = attribute_path ).
CATCH cx_bsp_conv_illegal_ref.
FIELD-SYMBOLS: <l_data> type DATA.
assign dref->* to <l_data>.
CONCATENATE <l_data> '-CURR/QUANT CONV FAILED-' INTO value
SEPARATED BY space. "#EC NOTEXT
CATCH cx_root.
value = '-CONVERSION FAILED-'. "#EC NOTEXT
ENDTRY.
method SET_ZZCUSTOMER_H0602_ 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( 'ZZCUSTOMER_H0602' ). "#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.
CALL METHOD if_bsp_model_util~convert_from_string
EXPORTING
data_ref = copy
value = value.
CATCH cx_sy_conversion_error.
RAISE EXCEPTION TYPE cx_bsp_conv_failed
EXPORTING
name = 'avoidable'."#EC NOTEXT
ENDTRY.
only set new value if value has changed
IF <nval> <> <oval>.
current->set_property(
iv_attr_name = 'ZZCUSTOMER_H0602' "#EC NOTEXT
iv_value = <nval> ).
ENDIF.
public section.
method SET_ZZCUSTOMER_H0602
importing
!ATTRIBUTE_PATH type STRING
!ITERATOR type ref to IF_BOL_BO_COL_ITERATOR optional
!VALUE type STRING .
method GET_ZZCUSTOMER_H0602
importing
!ATTRIBUTE_PATH type STRING
!ITERATOR type ref to IF_BOL_BO_COL_ITERATOR optional
returning
value(VALUE) type STRING .
method GET_M_ZZCUSTOMER_H0602
importing
!ATTRIBUTE_PATH type STRING
returning
value(METADATA) type ref to IF_BSP_METADATA_SIMPLE .
method GET_I_ZZCUSTOMER_H0602
importing
!ITERATOR type ref to IF_BOL_BO_COL_ITERATOR optional
returning
value(RV_DISABLED) type STRING .
Thanks
Chris
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.