Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Dictionary details

khagendra_padhy
Explorer
0 Kudos

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

1 ACCEPTED SOLUTION

engswee
Active Contributor
0 Kudos

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

2 REPLIES 2

engswee
Active Contributor
0 Kudos

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

0 Kudos

Hi Eng,

Thanks .