09-04-2009 11:12 AM
Hi All,
I Created a view in which tables VBRK & VBRP are used. I took the key field as VBELN. Whereas while activating he Database View, it takes all the fields as key fields, which should not happen.
Could someone pls tell me in detil what needs to be done.
Regards
Jiten.
09-04-2009 11:24 AM
DB view provides inner join on two tables, Therefore it is required that all foreign keys have to be provided as view key fields.
The same is when you do inner join in select statements and want to get only these records where corresponding entry in primary table exists. That's why you need to provide all fields that tables are joined at.
For more info please refer [Database Views|http://help.sap.com/saphelp_nw04/helpdata/en/36/74c0358373003ee10000009b38f839/frameset.htm]
You may also look at standard DB view WB2_V_VBRK_VBRP to see the relationship.
Regards
Marcin
09-04-2009 11:32 AM
Hello
So must be.
If you do not include all key fields in all tables in your view, the system will automatically make every data field also as key field.
Also, the key fields in the table will also be marked as key in the view but other fields will not be marked.
09-04-2009 11:56 AM
As far as I understand it, this is not about the join conditions. All primary key fields of the joined tables must appear in the field list of the view, otherwise the system considers all fields as key fields to ensure uniqueness of the combined key.
In your case I suspect that you have not included VBRP-POSNR in the view fields.
Thomas