04-10-2014 1:17 PM
Hi There,
Is there any way to take the filed name from SAP data dictionary during run-time . I mean if i will execute a TA the field name , program name (like what shows pressing F1) all the details.
Any help is appreciated.
Regards,
Khagendra
04-11-2014 4:14 AM
Hi Khagendra
Are you trying to dynamically determine the attributes of a field during runtime?
Have you tried using RTTS services? You can try using class CL_ABAP_TYPEDESCR. Check out the class documentation for more details.
I've just pasted the sample coding from the class documentation.
REPORT typedescr_test.
TYPES:
my_type TYPE i.
DATA:
my_data TYPE my_type,
descr_ref TYPE ref to cl_abap_typedescr.
START-OF-SELECTION.
descr_ref = cl_abap_typedescr=>describe_by_data( my_data ).
WRITE: / 'Typename:', descr_ref->absolute_name.
WRITE: / 'Kind :', descr_ref->type_kind.
WRITE: / 'Length :', descr_ref->length.
WRITE: / 'Decimals:', descr_ref->decimals.
Rgds
Eng Swee
04-11-2014 4:14 AM
Hi Khagendra
Are you trying to dynamically determine the attributes of a field during runtime?
Have you tried using RTTS services? You can try using class CL_ABAP_TYPEDESCR. Check out the class documentation for more details.
I've just pasted the sample coding from the class documentation.
REPORT typedescr_test.
TYPES:
my_type TYPE i.
DATA:
my_data TYPE my_type,
descr_ref TYPE ref to cl_abap_typedescr.
START-OF-SELECTION.
descr_ref = cl_abap_typedescr=>describe_by_data( my_data ).
WRITE: / 'Typename:', descr_ref->absolute_name.
WRITE: / 'Kind :', descr_ref->type_kind.
WRITE: / 'Length :', descr_ref->length.
WRITE: / 'Decimals:', descr_ref->decimals.
Rgds
Eng Swee
04-11-2014 11:27 AM