Sometimes we need to display the description based on the key value of a field. And the description is not in a text table but defined as value range in the domain definition. For example the domain XUDATFM lists all the types of dates possible
Using the class CL_ABAP_ELEMDESCR, one can retrieve these values in an internal table of type DDFIXVALUES. Here is an example:
DATA o_rtti_attr TYPE REF TO cl_abap_elemdescr.DATA t_fixed_values TYPE ddfixvalues.TRY.rtti_attr ?= cl_abap_typedescr=>describe_by_name( 'XUDATFM' ).CATCH cx_root. "#EC *
ENDTRY.* get the fixed valuesCALL METHOD rtti_attr->get_ddic_fixed_valuesRECEIVINGp_fixed_values = fixed_valuesEXCEPTIONSno_ddic_type = 1OTHERS = 2.
No comments:
Post a Comment