I_ATNAMTYPE API_VALI-ATNAM ->Characteristic Name
I_DATATYPE REF TO DATA-> our reference data
CT_VALUES TYPE TT_API_VALI-> Structure for characteristic screen
NO_DATA_TO_CHANGE
method move_ref_data_to_screen_val.
field-symbols: <ms> type any,
<any> type any,
<any2> type any,
<table> type any table,
<line> type any,
<p> type any,
<val> type api_vali.
data: m_p(16) type p.
data: mo_type type ref to cl_abap_elemdescr.
data: m_format type cabn-atfor.
data: m_currency type rctmv-waers.
data: m_atinn type api_vali-atinn.
if i_data is initial.
raise no_data_to_change.
endif.
"get characteristic ID
call function 'COC1_FEATURE_CHECK'
exporting
* feature_id = atinn
feature_neutral_name = i_atnam
importing
format = m_format
feature_id = m_atinn
* feature_neutral_name = atnam
* conversion_exit = l_atkon
* number_of_positions = l_anzst
* set_get_parameter = l_atpid
exceptions
invalid_class_type = 1
missing_feature_information = 2
no_feature_found = 3
no_feature_valid = 4
no_language = 5
others = 6.
if sy-subrc <> 0.
* Error
* raise characteristic_unknown.
endif.
refresh ct_values[].
assign i_data->* to <ms>.
if sy-subrc eq 0.
assign component i_atnam of structure <ms> to <table>.
if sy-subrc eq 0.
loop at <table> assigning <line>.
insert initial line into table ct_values assigning <val>.
if sy-subrc eq 0.
<val>-atnam = i_atnam.
<val>-atinn = m_atinn.
<val>-atzhl = '000'.
case m_format.
when 'NUM' or 'DATE' or 'TIME'.
assign component 'LOW' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-atflv = zcl_abapblog_com_classific=>convert_char_value(
i_atnam = i_atnam
i_value_new = <any>
).
endif.
assign component 'HIGH' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-atflb = zcl_abapblog_com_classific=>convert_char_value(
i_atnam = i_atnam
i_value_new = <any>
).
endif.
assign component 'UNIT_FROM' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-atawe = <any>.
endif.
assign component 'UNIT_TO' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-ataw1 = <any>.
endif.
when 'CURR'.
assign component 'LOW' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-atflv = zcl_abapblog_com_classific=>convert_char_value(
i_atnam = i_atnam
i_value_new = <any>
).
endif.
assign component 'HIGH' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-atflb = zcl_abapblog_com_classific=>convert_char_value(
i_atnam = i_atnam
i_value_new = <any>
).
endif.
assign component 'CURRENCY_FROM' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-atawe = <any>.
endif.
assign component 'CURRENCY_TO' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-ataw1 = <any>.
endif.
when 'CHAR'.
assign component 'LOW' of structure <line> to <any>.
if sy-subrc eq 0.
<val>-atwrt = <any>.
endif.
endcase.
unassign: <any>, <any2>.
assign component 'OPTLOW' of structure <line> to <any>.
if sy-subrc eq 0.
case <any>.
when 'EQ'.
<val>-atcod = 1.
when 'GE'.
assign component 'OPTHIGH' of structure <line> to <any2>.
if sy-subrc eq 0.
case <any2>.
when 'LT'.
<val>-atcod = 2.
when 'LE'.
<val>-atcod = 3.
when space.
<val>-atcod = 9.
endcase.
else.
<val>-atcod = 9.
endif.
when 'GT'.
assign component 'OPTHIGH' of structure <line> to <any2>.
if sy-subrc eq 0.
case <any2>.
when 'LT'.
<val>-atcod = 4.
when 'LE'.
<val>-atcod = 5.
when space.
<val>-atcod = 8.
endcase.
else.
<val>-atcod = 8.
endif.
when 'LT'.
<val>-atcod = 6.
when 'LE'.
<val>-atcod = 7.
endcase.
endif.
endif.
endloop.
endif.
endif.
endmethod. "move_ref_data_to_screen_val