‎2007 Apr 11 5:18 PM
Hello Experts,
I am good and expect the same from you guys..
<b>Kindly let me know the tables in sap which are using composite primary key..</b>
Thanks and Regards
Santosh
‎2007 Apr 11 5:21 PM
Can you explain a bit further?
There is no concept called composite primary key sap afaik.
REgards,
Ravi
‎2007 Apr 11 5:43 PM
Hi Ravi,
To day i have attended an interview..
Interviewer asked me what the composite primary key.. I replied if a key is consists more than one field then it is called as composite primary key..
Then he asked me can u giv me some examples of tables which are having composite primary keys??
<b>I would like to know the tables which are using composite primary keys</b>
Thanks and Regards
‎2007 Apr 11 5:56 PM
Hi there. If that is what you consider a composite primary key, then the infotype tables (PA0001, etc.) would be a good example of tables with this type of key. Their keys include the fields of PERNR, BEGDA, and ENDDA, among other fields. I hope this helps.
- April King
‎2007 Apr 11 11:04 PM
well, there are lots...EKPO, VBAP, LFB1, KNB1, STKO, STPO, etc...
‎2007 Apr 12 10:38 AM
Hai,
There are many tables in SAP with composite key as below.
SPFLI,SFLIGHT,SBOOK,KNA1,VBAK,VBAP etc...
If you want all the tables:
You can follow the below logic:
DATA:
BEGIN OF FS_TABLES,
TABNAME TYPE DD02L-TABNAME,
END OF FS_TABLES.
DATA:
T_TABLES LIKE STANDARD TABLE OF FS_TABLES,
T_FINAL LIKE STANDARD TABLE OF FS_TABLES.
SELECT TABNAME
FROM DD02L
INTO TABLE T_TABLES.
LOOP AT T_TABLES INTO FS_TABLES.
FOR EACH TABLE COUNT THE NO OF KEYS.
(DD03L CONTAINS THE FIELD NAME,TABLE NAME,KEYFLAG = 'X'X IF IT IS A KEY FLAG)
IF KEYS GT 1.
IT IS A TABLE WITH COMPOSITE PRIMARY KEY(STORE IN FINAL ITAB->T_FINAL )
T_FINAL-TABNAME = TABNAME.
APPEND FS_FINAL TO T_FINAL.
ENDIF.
ENDLOOP.
All the tables that you want will be in T_FINAL internal table.
Hope you grt all the tables.
<b>Reward points if it helps you.</b>
Regds,
Rama chary.Pammi
‎2007 Apr 12 11:33 AM
Hi,
Actually composite primary key comes in to the picture when one key is not able to serve as a primary key for the table. In that case 2 key fields clubt to gether act as a primary key for the table..
like EKPO, VBAP, LFB1, KNB1
Do reward points if it helps .
Thx,
sofia
‎2007 Apr 12 11:44 AM
Hi Santosh....
In SAP almost all the tables are having the composite primary key. Because in a client dependent table the primary key a combination of MANDT and Other fields..
I will give you some examples..
tables with out composite primary key : T000.
tables with composite primary key : MARA, MARC, VBAK, VBAP.........
Let me know if u have any more doubt....
Reward points if useful......
Suresh......