‎2013 Sep 11 1:01 PM
Hi
I know that the INSERT statement allows me to enter the record directly in the database table without checking the foreign key
restrictions .
But what happens when the table entries are sent to the database system as the database(oracle) will not allow records without the foreign key check
‎2013 Sep 11 1:47 PM
Hello Hema,
if u r trying to update the standard tables using Insert query, and if the data is inconsistent then system will not allow you. This is because the while creating standard tables SAP has taken care that if and only if the corresponding record exists in the check table, then only allow the insertion.
this check is applied at application level using foreign key relationship. Checks at Database level is the second thing. See the figure.
But If you are maintaining inconsistent data in your own customized tables (Z-tables) and if you have not maintained the foreign key checks then system will allow you to insert the data. You can make this check required for system to check before inserting the data into the table.
Also see the Value Table field. for reference MAKT table is handful.
Regards,
Nikhil G.
‎2013 Sep 11 1:06 PM
‎2013 Sep 11 1:08 PM
What is the error you are facing and what you want to implement..?
‎2013 Sep 11 1:10 PM
SAP's OPEN SQL takes care of the interaction with the database and in case of any errors sets value of SY-SUBRC to 4. So by checking the value of SY-SUBRC you can know if the record got inserted successfully or not.
‎2013 Sep 11 1:14 PM
The foreign key check are not actually created as constraints in the database when SAP ddic generate the tables/views, they are only checked programmatically in SAP.
So nothing should happened, provided you did not create such constraints in native SQL or directly in the database, in this caise an error will be raised, and if you don't catch it, dump will be generated.
Regards,
Raymond
‎2013 Sep 11 1:29 PM
Can you please read SAP Help....
It gives detailed info as to what will happen.
Inserting Lines into Tables (SAP Library - ABAP Programming (BC-ABA))
Read
If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
Regards
‎2013 Sep 11 1:47 PM
Hello Hema,
if u r trying to update the standard tables using Insert query, and if the data is inconsistent then system will not allow you. This is because the while creating standard tables SAP has taken care that if and only if the corresponding record exists in the check table, then only allow the insertion.
this check is applied at application level using foreign key relationship. Checks at Database level is the second thing. See the figure.
But If you are maintaining inconsistent data in your own customized tables (Z-tables) and if you have not maintained the foreign key checks then system will allow you to insert the data. You can make this check required for system to check before inserting the data into the table.
Also see the Value Table field. for reference MAKT table is handful.
Regards,
Nikhil G.