Some time ago I presented how I get data from classifications to reference data variable ( or table). If you feel comfortable with my method then we can go further. I had a task to update some characteristic values from ALV grid, this would be not a problem at all if the characteristics would be defined from the begriming, but they weren't. In that case I couldn't just add needed fields to fieldcatalog and call FM to update characteristics when save button was pressed. I realized I need dynamic structure for ALV which will call standard screen for characteristic update. If this could be done then I could omit carrying about type of characteristics (date, number, char ) and if it is single o multiple type. So I started to dig in SAP, debug standard functions and I was finally able to prepare all needed functions.
- method to copy data from my reference data structure to screen values
I_ATNAM Type API_VALUE-ATNAM -> Characteristic Name
I_VALUE_NEW Type ANY -> Characteristic Value
R_VALUE_FLOAT Type -> Internal floating point from
method convert_char_value.
data: m_value_new type atwtb.
write i_value_new to m_value_new.
call function 'CHAR_VALUE_CHANGE2'
exporting
* atinn = ft_values-atinn
atnam = i_atnam
new_value = m_value_new
* FLAG_NO_DIALOG = FLAG_NO_DIALOG
importing
* atwrt = r_value_float
atflv = r_value_float
exceptions
characteristic_unknown = 1
conversion_error = 2
value_set_error = 3
others = 4.
if sy-subrc eq 0.
return.
endif.
endmethod. "convert_char_value