on 07-20-2007 9:54 AM
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?
t006 and not too6 is the table.
Units of measure table.
It is a basis table so I expect to see it on all platforms.
So I assume you mistyped it.
cheers
Phil.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use this T006A_INT table instead of T006 and change ur code from
DATA lv_fromunit TYPE too6-msehi.
DATA lv_tounit TYPE too6-msehi.
to
DATA lv_fromunit TYPE T006A_INT-UNIT_INT.
DATA lv_tounit TYPE T006A_INT-UNIT_INT.
It will solve ur problem.Give points if it solves.
Nirad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jerry,
Check in SE11 transaction for the table 'T006' and filed 'MESHI' i think it is not present in data dictonary
cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.