Register Login

How can we find Primary Key?

Updated May 18, 2018

Suppose there is a data field: XYZ in the table TAB. XYZ is a primary key and besides being primary key for the table TAB, this happens to be primary key for other tables as well. Now, is there any method or t-code in ABAP wherein I can find for which tables XYZ is the primary key?
For example, I need to find that MATNR is the primary key is which tables?
Can anyone help me out?


  • 29 Apr 2009 3:08 pm Shalesh Singh Visen
    select * from DD03L WHERE fieldname = 'MATNR' and keyflag = 'X'.
    Hope that can help you out.....
  • 29 Apr 2009 3:08 pm Shalesh Singh Visen
    if you want to find out all tables which have MATNR as a key field, you can use the code below:

    SELECT *
    FROM DD03L
    AND KEYFLAG = 'X'.

    wish it is the answer you need.
  • 15 Oct 2010 12:13 pm Guest
    Hi Shailesh,
    thanks for the code its very useful for me
    thanks a lot.