Application Development and Automation 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: 
Read only

Database view : defining key

Former Member
0 Likes
3,337

Hello,

I am creating database view from 2 tables and want to define a non-key field from table as a key in this view.

Please advice how it can be done.

Thanks.

Rupalee.

5 REPLIES 5
Read only

former_member156446
Active Contributor
0 Likes
1,397

Key in a database view?

check SAP std database view: VIAUFKST

Read only

0 Likes
1,397

This view has copied primary key of table as a view key. Not correct one .

Read only

0 Likes
1,397

Hi Rupali,

As far as I know We cannot create a Key field in Database View.

If you select a Key field from the table then it is used as the Key field aswell in View but we cannot create any Key field Views.

Thanks & regards,

Dileep .C

Read only

0 Likes
1,397

Hi,

I could able to create database view with keys for all fields. Instead of selecting from table, we have to put the fields manually.

Then while activating, it gives one warning as below.

" All fields are evaluated as key fields" ( Message MC 732).

Then we can see the Key checkbox ticked for all the fields which we selected.

I am pasting the long text for your information only.

Thanks.

italics

All fields are evaluated as key field

Message no. MC732

Diagnosis

In the view, not all of the mandatory fields were included as key fields. The key of the view therefore is not unique.

System response

All the fields are regarded as key fields in order to guarantee that the key lengths are unique.

Procedure

For views with a large number of fields, this could have a negative effect on the performance for the language construction described below. In this case, all the mandatory key fields should be included in the view.

Notes

The key information is relevant for the ABAP/4 language constructs SELECT SINGLE, SELECT ... ORDER BY PRIMARY KEY and SELECT ... FOR ALL ENTRIES.

In these cases, SELECT SINGLE is handled like a simple SELECT ... ENDSELECT, where the first (random) record found is returned.

ORDER BY PRIMARY KEY and (indirect) SELECT FOR ALL ENTRIES sort according to all fields in these cases.

italics

Read only

Former Member
0 Likes
1,397

Hi,

You can just include the fields you need in your view. When you activate the view, all the fields will become keys.