Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Get the data types of all fields in a table

$
0
0

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


Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>