cancel
Showing results for 
Search instead for 
Did you mean: 

a syntax mistake about too6 table.

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

yes, it is my careless mistake.

I have correct the table name,and the program goes well.

thanks for all firends,I will be more careful.

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Jerry,

Check in SE11 transaction for the table 'T006' and filed 'MESHI' i think it is not present in data dictonary

cheers

Former Member
0 Kudos

I have enter system to check too6 table.the table is ok, and MESHI property is displaied also.

I guess if I want to use tables in component's mothod,the table too6 must be specified beforehand ,but I don't know where can I configure the table as a object in the model component.

Former Member
0 Kudos

hi,

there is no need to declare a tables statemement for using the 'T006' table field in your method as you are just using a varaible declared of typer MESHI which is a part of Data Dictonary and It should be Acessible for the method in the Web dynpro Application Componenet

Cheers