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: 

Get the data types of all fields in a table

Former Member
0 Kudos

Hi,

I would like to develop a program which given a table name, returns all its fields and their types.

If a certain type is a structure, I need to get its elements, as well, and their types.

I'm aware of the function ddif_fieldinfo_get which returns the data types of all fields in a certain table, but it doesn't handle complex data types of structures like I need...

Does someone have any idea or reference for me?

Thanks in advance

1 ACCEPTED SOLUTION

arindam_m
Active Contributor

Hi,

May be this would help

DATA: gcl_abap_structdescr TYPE REF TO cl_abap_structdescr,
          gt_ddicinfo         TYPE ddfields,
          wa_dfies             TYPE dfies.

FIELD-SYMBOLS: <ddic_info> TYPE LINE OF ddfields.

gcl_abap_structdescr ?= cl_abap_structdescr=>describe_by_name( 'BKPF' ).

gt_ddicinfo = gcl_abap_structdescr->get_ddic_field_list( ).

LOOP AT gt_ddicinfo INTO wa_dfies.
   WRITE: wa_dfies-tabname, wa_dfies-fieldname, wa_dfies-position.
ENDLOOP..

Cheers,

Arindam

5 REPLIES 5

arindam_m
Active Contributor

Hi,

May be this would help

DATA: gcl_abap_structdescr TYPE REF TO cl_abap_structdescr,
          gt_ddicinfo         TYPE ddfields,
          wa_dfies             TYPE dfies.

FIELD-SYMBOLS: <ddic_info> TYPE LINE OF ddfields.

gcl_abap_structdescr ?= cl_abap_structdescr=>describe_by_name( 'BKPF' ).

gt_ddicinfo = gcl_abap_structdescr->get_ddic_field_list( ).

LOOP AT gt_ddicinfo INTO wa_dfies.
   WRITE: wa_dfies-tabname, wa_dfies-fieldname, wa_dfies-position.
ENDLOOP..

Cheers,

Arindam

Former Member
0 Kudos

Hi Arindam,

Thank you, but I've found an answer and wrote it down as a document

Former Member
0 Kudos

Hi Daniel,

Check out this link

http://scn.sap.com/docs/DOC-45661

Hope that helps

0 Kudos

Hello Kiran,

That's my own document I wrote after doing some research

You're more than welcome to learn from it and show your appericiation (reply, like or rate)

former_member188886
Participant
0 Kudos

Daniel,

Not sure if you are still following this.

Did you upload your document someplace that you can share it?

I don't see it in your post. Also the link Kiran gave below, says access restricted. Thanks jay