hi,everyone.
I'm studying WD4A recently,and do an exercise imitating the example in chapter 4,but I meet a problem when coding a method named convert_values(), this method belongs to the model component ZEXP_CONVERSION_MODEL.
the source is below:
method CONVERT_VALUES .
DATA ls_conv TYPE if_componentcontroller=>element_conversion.
DATA lr_input_node TYPE REF TO if_wd_context_node.
DATA lr_sub_node TYPE REF TO if_wd_context_node.
DATA lv_fromunit TYPE too6-msehi.
DATA lv_tounit TYPE too6-msehi.
DATA lv_value TYPE string.
DATA lv_denominator TYPE f.
DATA lv_numerator TYPE f.
DATA lv_nomout TYPE dzaehl.
DATA lv_denomout TYPE nennr.
DATA lr_node TYPE REF TO if_wd_context_node.
lr_input_node = wd_context->get_child_node( 'UNITS' ).
lr_input_node->get_attribute( EXPORTING name = 'IVALUE'
IMPORTING value = lv_value ).
lr_sub_node = lr_input_node->get_child_node( 'FROMUNIT' ).
lr_sub_node->get_attribute( EXPORTING name = 'UNIT_INT'
IMPORTING value = lv_fromunit ).
lr_sub_node = lr_input_node->get_child_node( 'TOUNTIT' ).
lr_sub_node->get_attribute( EXPORTING name = 'UNIT_INT'
IMPORTING value = lv_tounit ).
CALL FUNCTION 'CONVERSION_FACTOR_GET'
EXPORTING
no_type_check = 'X'
unit_in = lv_fromunit
unit_out = lv_tounit
IMPORTING
denominator = lv_denominator
numerator = lv_numerator
EXCEPTIONS
conversion_not_found = 1
overflow = 2
type_invalid = 3
units_missing = 4
unit_in_not_found = 5
unit_out_not_found = 6
OTHERS = 7
IF sy-subrc <> 0.
RETURN.
ELSE.
CALL FUNCTION 'CONVERT_TO_FRACT10'
EXPORTING
nomin = lv_numerator
denomin = lv_denominator
IMPORTING
nomout = lv_nomout
denomout = lv_denomout
EXCEPTIONS
conversion_overflow = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.
ELSE.
ls_conv-cvalue = lv_value * ( lv_nomout / lv_denomout ).
ENDIF.
*---- Supply node with data
lr_node = wd_context->get_child_node( 'CONVERSION' ).
lr_node->bind_structure( new_item = ls_conv
set_initial_elements = abap_true ).
ENDIF.
endmethod.
and the mistake is:
Method CONVERT_VALUES Field "TOO6-MSEHI" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement
can anyone settle my problem?
how to specify tables in dynpro component?