‎2009 Jun 09 11:27 PM
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.
‎2009 Jun 09 11:36 PM
Key in a database view?
check SAP std database view: VIAUFKST
‎2009 Jun 10 1:03 AM
This view has copied primary key of table as a view key. Not correct one .
‎2009 Jun 10 4:00 AM
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
‎2009 Jun 17 7:38 PM
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
‎2010 Aug 20 2:28 AM
Hi,
You can just include the fields you need in your view. When you activate the view, all the fields will become keys.