Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Database View

Former Member
0 Kudos

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.

3 REPLIES 3

MarcinPciak
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

ThomasZloch
Active Contributor
0 Kudos

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