2007 May 07 12:08 PM
Hi all,
Please tell me if it is possible to create foreign keys in Database View. If possible,
then how can I create?
Thanks and regards,
Ridhima
2007 May 07 12:20 PM
Thanks for your response.
Actually I have currency and quantity fields in my View and I need to create a BW data source with this view. I searched BW forum also and found some solution to refer to currency and quantity fields in base tables of the view. I tried doing this but still not able to solve the problem.
If you have any inputs, plz let me know.
Hi all,
Please tell me if it is possible to create foreign keys in Database View. If possible,
then how can I create?
Thanks and regards,
Ridhima
2007 May 07 12:10 PM
hi,
we can create foreign keys only in the database table and not in the views.
And more over database view is used to dipaly particular fields from LOGICALLY REALTED TABLES,
here LOGICALLY RELATED TABLE mean the tables which are related with foreign key only.
you cannot cretae foreign key realtiosnhip in the views.
Reward points if useful.
Regards
Naveen
2007 May 07 12:12 PM
Hi Ridhima Gupta,
Good check out the following documentation
To create DB view go to tcode SQ02 specify the view name .
Now u can create view by using the join or other options.
Remeber when u join there should be table with fields in common.
A foreign key links two tables T1 and T2 by assigning fields of table T1 to the primary key fields of table T2.
Table T1 is called the foreign key table (dependent table) and table T2 the check table (referenced table). The pair of fields for the two tables must have the same data type and length. One field of the foreign key table therefore corresponds to each key field of the check table. This field is called the foreign key field.
A foreign key permits you to assign data records in the foreign key table and check table. One record of the foreign key table uniquely identifies one record of the check table using the entries in the foreign key fields.
Have a look at below link for details.
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea77446011d189700000e8322d00/frameset.htm
I hope it helps.
Good luck and thanks
AK
2007 May 07 12:14 PM
hi,
we can create foreign keys only in the database table n not in view.....view is a virtual table where we can get the data either from a single table or multiple table as a single entity......n coming up to database view here can get the fields from more than one table without having any relationship.....
i suppose u must have got a clear idea m=now...if soo dont forget to reward with points.
with regards,
madhuri.
2007 May 07 12:14 PM
HI
you cant create foreign keys to Views.
Instead can create to DB taables..
Views does not contain data in it. It fetches data from the database only depending on the condition ...Views are join on some one/more tables.
rewards if useful
regards,
nazeer
2007 May 07 12:17 PM
Hi Ridhima,
yes, U can create foreign keys in data base view.
Go to se11.create view. as u provide join coditions .then u can provide foreign key for field of the view.
Reward points if helpful.
Regards,
Hemant
2007 May 07 12:20 PM
Thanks for your response.
Actually I have currency and quantity fields in my View and I need to create a BW data source with this view. I searched BW forum also and found some solution to refer to currency and quantity fields in base tables of the view. I tried doing this but still not able to solve the problem.
If you have any inputs, plz let me know.
2007 May 07 12:24 PM
Hi Hemant,
Thanks for ur reponse.
I gave joining conditions in the view but when I select the field and click on Foreign Key, it displays a message 'No foreign key defined for this field'.
Ridhima