<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: foreign key creation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979740#M703514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi rambabu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For creating Primary and foreign key relations both the table fields should be declared with same data element. It is the must.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Nov 2007 05:11:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-05T05:11:14Z</dc:date>
    <item>
      <title>foreign key creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979738#M703512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) can i set foreign key for  if ihave data element in one table and direct type&lt;/P&gt;&lt;P&gt;2) can i set foreign key for  if ihave data element of float and intiger in other table&lt;/P&gt;&lt;P&gt;3)can i create Primary key If i have Domain of one table with other table field has direct type &amp;lt;b&amp;gt;ie&amp;lt;/b&amp;gt; (not doinan created directly)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2007 02:24:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979738#M703512</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-05T02:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: foreign key creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979739#M703513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just try creating all these. It will be a good learning exp for you and you will get the answers to your query &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Atish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2007 02:31:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979739#M703513</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-05T02:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: foreign key creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979740#M703514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi rambabu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For creating Primary and foreign key relations both the table fields should be declared with same data element. It is the must.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2007 05:11:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979740#M703514</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-05T05:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: foreign key creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979741#M703515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Foreign Key Definition&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;A foreign key creates a link between two tables T1 and T2. Every primary key field from T2 (check table) is assigned a field from table T1 (foreign key field). The fields from T1 assigned to primary key fields are marked as foreign key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most important function of the foreign key is the support of data integrity. The foreign key fields can only accept values which appear in the primary key of the check table. During input the values of the foreign key fields can thus be checked against the entries of the assigned key fields of the check table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ABAP Dictionary, such relationships between two tables are called foreign keys and they must be defined explicitly for the fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Foreign keys are used to ensure that the data is consistent. Data that has been entered is checked against existing data to ensure that it is consistent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Foreign Key concept with an Example&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Example:                                                                                In this example, the foreign key table is table SBOOK. The purpose of the foreign key is to ensure that only valid counters of carriers can be assigned to a booking. Check table SCOUNTER contains exactly this information. Each counter is identified with three key fields in this table: MANDT, CARRID, and COUNTNUM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to define the foreign key, these three fields are assigned to fields of the foreign key table (foreign key fields) with which the input to be checked is entered on the screen. In table SBOOK these are the fields: MANDT, CARRID, COUNTER. The entry is accepted if it represents a valid counter; otherwise the system will reject it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The foreign key is defined for field SBOOK-COUNTER (check field), which means that the entry in this field is checked. Field COUNTER is therefore called the check field for this foreign key. &lt;/P&gt;&lt;P&gt;                &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Example foreign key&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;A foreign key is defined for field COUNTER, table SBOOK, resulting in the following field assignment: 	Check table			Foreign key table 	SCOUNTER-MANDT		SBOOK-MANDT 	SCOUNTER-CARRID 	          SBOOK-CARRID 	SCOUNTER-COUNTNUM		SBOOK-COUNTER &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Violation of Foreign Key check&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The flight cannot be booked because American Airlines (AA) does not have a counter 8. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No data record is selected in table SCOUNTER for the entries in the example. The entry for table SBOOK is rejected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Advantage of Foreign Key with an Example&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The check table is the table whose key fields are checked. This table is also called the referenced table.&lt;/P&gt;&lt;P&gt;An entry is to be written in the foreign key table. This entry must be consistent with the key fields of the check table. &lt;/P&gt;&lt;P&gt;The field of the foreign key table to be checked is called the check field.&lt;/P&gt;&lt;P&gt;Foreign keys can only be used in screens. Data records can be written to the table without being checked using an ABAP program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: A new entry is to be written in table SPFLI (flight schedule). There is a check whether the airline carrier entered is stored in table SCARR (carrier) for field SPFLI-CARRID. The record is only copied to table SPFLI (foreign key table) if this is the case. A foreign key is defined for field SPFLI-CARRID (check field), i.e. the checks are on this field. The corresponding check table is table SCARR with the primary key fields MANDT and CARRID.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2007 06:11:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/foreign-key-creation/m-p/2979741#M703515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-05T06:11:23Z</dc:date>
    </item>
  </channel>
</rss>

