Skip to Content

Hello everyone,

After some research I’ve managed to find an answer to my own question here:

http://scn.sap.com/thread/3412096

and I would like to share this with you.

Basically, in oder to find the types of all fields of a given table, just make the following query to table DD03L:

SELECT tabname fieldname rollname

     INTO TABLE some_table

     FROM DD03L

     WHERE tabname = some_name.

BUT, sometimes, fields might be either a structure, or a table as well (deep table\structure). In those cases, we need to select the field type from tables DD03M (if structure) or DD40L (if table). Here are examples:

SELECT typename rowtype

     INTO TABLE some_other_table

     FROM DD40L

     WHERE typename = some_row_from_some_table-rollname.

OR

SELECT tabname fieldname rollname domname

     INTO TABLE some_other_different_table

     FROM DD03M

     WHERE tabname = some_row_from_some_table-rollname.

Note the differences between the two queries.

Any additions, corrections, or maybe a name of an existing function that does all that faster and easier, will be appericiated!

Hope that helps someone 🙂

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. Anurag Chopra

    Hi Daniel,

    Great topic to highlight, there is one framework class CL_ABAP_TYPEDESCR for the same. and i would suggest that one could use Classes to read the meta data instead of using the tables directly.

    Regards

    Anurag Chopra

    (0) 
  2. Syed Ghulam Ali

    FM “DDIF_TABL_GET” can also be used to get the field name, domain name, data type and length. not only these fields it fetches more data about the given table.

    (0) 
    1. Daniel Yacouboff Post author

      Hi Syed,

      This does the first step of finding the types and domains of a table fields.

      Though, if a certain field is also a table, it doens’t show the types of its components…

      (0) 
        1. Daniel Yacouboff Post author

          That’s exactly the thing – that it doesn’t. I’ve tried with an example of my own table with tables in it…that’s why the need for a program like mine came up…

          (0) 

Leave a Reply