Maintenance View for custom table with foreign key relationship
Hi Folks,
I have created a custom table with foreign key relationship with other check tables. I want to create a maintenance view / tablemaintenance generator. What all things I need to take care for the foreign keys related fields while creating the maintenance view / tablemaintenance generator.
Regards,
santosh
Hi,
You do not have to do anything explicitely for the foreign key relationships in the table maintainance generator.
Create the table maintainance generator via SE11 and it will take care of all teh foreign key checks by itself.
Regards,
Ankur Parab
Similar Messages
-
How to insert record in child table with foreign key
Hi,
I am using Jdeveloper 11.1.2.0. I have two master table one child table.
How to insert and update a record in child table with foreign key ?
I have created VO based on three EO(one eo is updatable other two eo are references) by using joined query.
Thanks in Advance
Edited by: 890233 on Dec 24, 2011 10:40 PM... And here is the example to insert using sequenceimpl by getting the primary key of the master record and insert master and detail together.
Re: Unable to insert a new row with a sequence generated column id
-Arun -
Add Table maintenance program for custom table to an existing func group
Hi Guys,
Can I add Table maintenance program for custom table to an existing function group or I need to create a new
function group for each custom table.
Thanks,
miniYou can add to an existing function group, there's nothing technically to stop you doing this. However, consider that this is creating generated function modules in this function group and you would be wise to avoid using a function group containing manually created modules.
I personally always create a new function group, using the name of the table as the name of the function group.
Regards,
Nick -
Problem with Foreign Key relationships in SAP R/3 4.7
Hi Experts,
I am trying to create a foreign key relationship between 2 transparent tables in SAP R/3 4.7
Table 1:ZAAVNDR (MANDT (pk), VENDORNO (pk), NAME, REGION, COUNTRY (fk)) Foreign Key Table
Table 2: ZAAVNDRREF(MANDT(pk), COUNTRY (pk)) ---Check table
I have added few valid countries in check table but when I am adding some records in foreign key table with invalid countries these records are not being restricted and are still successfully going into the table.
Could any one please help in this.
Thanks in anticipation.
-AmitHi Sandra,
Many thanks for your response and providing time of yours.
Now, I have done exactly the same thing, but still it is the same.
I have created two new tables as below:
ZAAVREF (Check table)
MANDT (PK)
COUNTRY (PK) Domain:ZAACOUNT (CHAR 10)
ZAAV1 (Foreign key table)
MANDT (PK)
COUNTRY (PK) Domain:ZAACOUNT (CHAR 10)
Then I have created FK on country of foreign key table ZAAV1 and then SE16 (for table ZAAVREF)->Create Entries-> Entered values for Country only->Save....Records entered with valid Country values.
After that SE16 (for table ZAAV1)->Create Entries-->Entered an Invalid country->Save->Still the record entered to the Database successfully....
Could you please let me know where I am going wrong.
I am using SAP R/3 4.7 and creating tables using Tools->ABAP Workbench->Development->ABAP dictionary -
How to find T-CODES for maintenance view of custom tables?
Hi,
I have a list of custom tables for which maintenance view is generated. Also, many of them might have a T-Codes assigned to them.
I need to know how to find out these T-codes?
Is there some table which maintains these or a function module which can give the t-code name?
Help will be appreciated.
Thanks.
ShreyasHi shreyas,
1. one way is
2. goto se93
3. Press Ctrl F
4. Expand the search criteria (from button on toolbar)
5. In program name enter SAPMSVMA (This program is for sm30)
6. In transaction code enter Z* or Y*
regards,
amit m. -
This Custom Table is create in Custom Schema and Refers to Seeded Table in APPS schema
1 create table test_dff (test_id number(15) primary key,
2* invoice_id number(15) constraint ap_test_fk REFERENCES ap_invoices_all(invoice_id) ON DELETE CASCADE)
SQL> /
invoice_id number(15) constraint ap_test_fk REFERENCES ap_invoices_all(invoice_id) ON DELETE CASCADE
ERROR at line 2:
ORA-02270: no matching unique or primary key for this column-list
How to create this Custom Table on Custom Schema
thanks in advancehi prashant
sorry for replying late, i have checked your query and it gives me no rows, but if i check for user_cons_columns it gives me no rows either in APPS Schema, but in AP schema it gives me
SQL> SELECT * FROM user_cons_columns WHERE table_name = 'AP_INVOICES_ALL';
OWNER CONSTRAINT_NAME TABLE_NAME
COLUMN_NAME
POSITION
AP SYS_C008177 AP_INVOICES_ALL
INVOICE_ID
SQL> SELECT constraint_name, constraint_type FROM user_constraints WHERE table_name = 'AP_INVOICES_A
LL';
CONSTRAINT_NAME C
SYS_C008177 C
SYS_C008178 C
SYS_C008179 C
SYS_C008180 C
SYS_C008181 C
SYS_C008182 C
SYS_C008183 C
SYS_C008184 C
SYS_C008185 C
SYS_C008187 C
SYS_C008189 C
SYS_C008191 C
and since this is a combination of Unique and Not Null Constraints , i am getting the same issue. do u have any solution to make the Detail table records to delete without using Alerts/DB Triggers?
thanks for your time .
abdul rahman -
Maintenance view for standerd table
hi . i want to update a field in standerd table. i try &sap_edit.but i dont know why people suggest that...its not working...any alternate to update standerd table .
Hi ,
First talk to your Function Consultant , why the standard table needs tobe updated .
if there is a purpose or a reason , then see the table attribute whether it is Masterdata/Customdata /Transcation data.
Masterdata table
Becuase for all Master data there will be define Transcationcode with screen program .
Ex: for creating Vendor Master/Customer Master/Hr Master,etc so for all Master data ,there is Change Transcation code also ,so the Functional Consultant can change it , if it is bulk then just record that screen using LSMW or BDC so that you can modify the data in the Screen which will update the corresponding tabels.
Customdata table
If it is Customizing table then there will be a define Table Maintainance directly or a View with Table maintaintance View. so Again Function Consultant can change the data. one thing here if that data field is Primary Key ,then in the table maintaince view he or you cannot change the data directly ,so either way is to delete the entry and create new entry with the changes you/he want .
Transcationdata table
If it is Transcation data then you should not do the change's for the transcaction data , if still it is required then there will be reversable entry process (Ex: In Finance if posting with incorrect entries of Currency or GL, then that record should be reversed .)likewise in SD ,HCM also they can reverse .
Final OPTION is already you are trying already with SAP_EDIT and also Our Community friends told how to play with editing table data.
Regards, -
How to insert a new record to table with foreign key
I have 3 tables like this :
CREATE TABLE PERSON (
PK INTEGER NOT NULL,
NAME VARCHAR(10),
SSNUM INTEGER,
MGR INTEGER);
ALTER TABLE PERSON ADD CONSTRAINT PK_PERSON PRIMARY KEY (PK);
ALTER TABLE PERSON ADD CONSTRAINT FK_PERSON FOREIGN KEY (MGR) REFERENCES
PERSON (PK);
/* Tables
CREATE TABLE PROJECT (
PK INTEGER NOT NULL,
CODE_NAME INTEGER);
ALTER TABLE PROJECT ADD CONSTRAINT PK_PROJECT PRIMARY KEY (PK);
/* Tables
CREATE TABLE XREF (
PERSON INTEGER NOT NULL,
PROJECT INTEGER NOT NULL);
ALTER TABLE XREF ADD CONSTRAINT PK_XREF PRIMARY KEY (PERSON, PROJECT);
ALTER TABLE XREF ADD CONSTRAINT FK_XREF1 FOREIGN KEY (PERSON) REFERENCES
PERSON (PK);
ALTER TABLE XREF ADD CONSTRAINT FK_XREF2 FOREIGN KEY (PROJECT) REFERENCES
PROJECT (PK);
I do like the way of "ReverseTutoral" and the file .jdo here :
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="reversetutorial">
<class name="Person" objectid-class="PersonId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="PERSON"/>
<field name="name">
<extension vendor-name="kodo" key="data-column"
value="NAME"/>
</field>
<field name="person">
<extension vendor-name="kodo" key="pk-data-column"
value="MGR"/>
</field>
<field name="persons">
<collection element-type="Person"/>
<extension vendor-name="kodo" key="inverse"
value="person"/>
<extension vendor-name="kodo" key="inverse-owner"
value="person"/>
</field>
<field name="pk" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PK"/>
</field>
<field name="ssnum">
<extension vendor-name="kodo" key="data-column"
value="SSNUM"/>
</field>
<field name="xrefs">
<collection element-type="Xref"/>
<extension vendor-name="kodo" key="inverse"
value="person"/>
<extension vendor-name="kodo" key="inverse-owner"
value="person"/>
</field>
</class>
<class name="Project" objectid-class="ProjectId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="PROJECT"/>
<field name="codeName">
<extension vendor-name="kodo" key="data-column"
value="CODE_NAME"/>
</field>
<field name="pk" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PK"/>
</field>
<field name="xrefs">
<collection element-type="Xref"/>
<extension vendor-name="kodo" key="inverse"
value="project"/>
<extension vendor-name="kodo" key="inverse-owner"
value="project"/>
</field>
</class>
<class name="Xref" objectid-class="XrefId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="XREF"/>
<field name="person">
<extension vendor-name="kodo" key="pk-data-column"
value="PERSON"/>
</field>
<field name="person2" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PERSON"/>
</field>
<field name="project">
<extension vendor-name="kodo" key="pk-data-column"
value="PROJECT"/>
</field>
<field name="project2" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PROJECT"/>
</field>
</class>
</package>
</jdo>
Data of those tables are :
PERSON :
| PK | NAME | SSNUM | MGR |
| 1 | ABC | 1 | 1 |
| 2 | DEF | 5 | 1 |
PROJECT
| PK | CODE_NAME |
| 1 | 12 |
| 2 | 13 |
And now I want to add a new record into table XREF : insert into XREF
values (1,1);
public void createData() {
Xref xref = new Xref();
Person person = new Person(1);
Project project = new Project(1);
xref.setPerson(person);
xref.setProject(project);
person.getXrefs().add(xref);
person.getXrefs().add(xref);
pm.currentTransaction().begin();
pm.makePersistent(xref);
pm.currentTransaction().commit();
I don't know why Kodo automatically insert new record to table PERSON ->
confilct Primary Key. The errors are :
0 [main] INFO kodo.Runtime - Starting Kodo JDO version 2.4.1
(kodojdo-2.4.1-20030126-1556) with capabilities: [Enterprise Edition
Features, Standard Edition Features, Lite Edition Features, Evaluation
License, Query Extensions, Datacache Plug-in, Statement Batching, Global
Transactions, Developer Tools, Custom Database Dictionaries, Enterprise
Databases, Custom ClassMappings, Custom ResultObjectProviders]
41 [main] WARN kodo.Runtime - WARNING: Kodo JDO Evaluation expires in 29
days. Please contact [email protected] for information on extending
your evaluation period or purchasing a license.
1627 [main] INFO kodo.MetaData -
com.solarmetric.kodo.meta.JDOMetaDataParser@e28b9: parsing source:
file:/D:/AN/Test/classes/reversetutorial/reversetutorial.jdo
3092 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] open:
jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
3325 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ]
close:
com.solarmetric.datasource.PoolConnection@164dbd5[[requests=0;size=0;max=70;hits=0;created=0;redundant=0;overflow=0;new=0;leaked=0;unavailable=0]]
3335 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] close
connection
3648 [main] INFO jdbc.JDBC - Using dictionary class
"com.solarmetric.kodo.impl.jdbc.schema.dict.InterbaseDictionary" to
connect to "Firebird" (version "__WI-V6.2.972 Firebird 1.0.3)WI-V6.2.972
Firebird 1.0.3/tcp (annm)/P10") with JDBC driver "firebirdsql jca/jdbc
resource adapter" (version "0.1")
4032 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] open:
jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
4143 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
preparing statement <3098834>: INSERT INTO XREF(PERSON, PROJECT) VALUES
4224 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
executing statement <3098834>: [reused=1;params={(int)1,(int)1}]
4244 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
preparing statement <9090824>: INSERT INTO PERSON(MGR, NAME, PK, SSNUM)
VALUES (?, ?, ?, ?)
4315 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
executing statement <9090824>: [reused=1;params={null,null,(int)1,(int)0}]
4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
resultSetType or resultSetConcurrency changed
4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
resultSetType or resultSetConcurrency changed
4598 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] begin
rollback
4608 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] end
rollback 10ms
4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ]
close:
com.solarmetric.datasource.PoolConnection@1878144[[requests=2;size=2;max=70;hits=0;created=2;redundant=0;overflow=0;new=2;leaked=0;unavailable=0]]
4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] close
connection
javax.jdo.JDOFatalDataStoreException:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
[PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
on table "PERSON" [code=335544665;state=null]
NestedThrowables:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
[PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
on table "PERSON"
at
com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLExceptions.java:17)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:416)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
NestedThrowablesStackTrace:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. violation of PRIMARY
or UNIQUE KEY constraint "PK_PERSON" on table "PERSON"
at
org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:425)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
at
com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
at org.firebirdsql.gds.GDSException: violation of PRIMARY or UNIQUE KEY
constraint "PK_PERSON" on table "PERSON
at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1683)
at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1636)
at org.firebirdsql.jgds.GDS_Impl.isc_dsql_execute2(GDS_Impl.java:865)
at
org.firebirdsql.jca.FBManagedConnection.executeStatement(FBManagedConnection.java:782)
at
org.firebirdsql.jdbc.FBConnection.executeStatement(FBConnection.java:1072)
at
org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:420)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
at
com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
Exception in thread "main"First off, use the '-primaryKeyOnJoin true' flag when running the reverse
mapping tool so that you can get rid of that useless Xref class and have
a direct relation between Person and Project. See the documentation on
reverse mapping tool options here:
http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_reverse.html
But your real problem is that you are creating new objects, assigning
primary key values, and expecting them to represent existing objects.
That's not the way JDO works. If you want to set relations to existing
objects in JDO, you use the PM to look up those objects. If you try to
create new objects, JDO will assume you want to insert new records into
the DB, and you'll get PK conflicts like you see here.
There are several good books out on JDO; if you're just starting out with
it, they might save you a lot of time and help you master JDO quickly. -
Binding for table produces list for other tables using foreign key and crea
Using
software Jdev 11G, WLS 11G, Oracle DB 11G, Windows Vista platform
technology EJB 3.0, jspx, backing beans, session bean
I cannot create a namedquery on my secondary table. The method for the column uses the entity object rather than the name and value of the column.
For instance,
(Coketruck) table has inventory records(Products) table
Coketruck has one to many to the Products table
Products has a many to one to the Coketruck
I need to return the products from the product table based on the CokeTruck but I cannot create a namedQuery because the method in the Product table is an entity object type instead of a long that I can use to look up all the products based off the column truck_id.
This is what I was expecting…
Private Long truckId;
public Long getTruckId() {
return truckId;
public void setTruckId (Long truckId) {
this. truckId = truckId;
Instead this is what I have…
@ManyToOne
@JoinColumn(name = "TRUCK_ID")
private Coketruck coketruck;
this. coketruck = coketruck
public Coketruck getCoketruck() {
return coketruck;
public void set Coketruck (Coketruck coketruck) {
this. coketruck = coketruck;
How do I do a query on the Product table to return all the products that are in the coketruck?
If I do the following it expects for me to pass the Entity Object which I cannot use as search criteria for my find method.
@NamedQuery(name = "Products.findById", query = "select o from Products o where o.truckId = :truckId")
On a different note but the same song…
I noticed that when I look at my Session Bean Data Contols that the coketruck already has a list of the products. I have created a jsp page with a backing bean and have been able to use the namedquery on the coketruck entity to retrieve the productList. Unfortunately I need to sort the products by type and was also not able to find where to perform the work to be able to iterate through the productList to get my desired display. Therefore I started looking at doing another namedquery that would only retrieve the product_type ordering by the truckId.
Seems I have come full circle… I don’t care what method I have to use to get the info back.
Any help is greatly appreciated!user9005175 wrote:
Hi!
I work on an application wich uses a shopping cart stored in a database. The shopping cart uses two tables:
CART: Holds information common for one shopping cart: the user it is connected to etc.
- Primary key: CART_ID
CART_ROW: One row in the cart, e.g. one new product to buy.
- Primary key: ROW_ID
- Foreign key: CART_ROW.CART_ID references CART.CART_ID
From the code the rows in the cart are collected per cart, as is modelled by the foreign key. There exists one more relationship, which we use in the code, but which is not modelled by a foreign key in the database. One row can be dependent on another row, which makes the other row a parent.
CART_ROW has a column PARENT_ID which references CART_ROW.ROW_ID.
Should we add a foreign key for PARENT_ID? Or are there any questions to consider when it is a foreign key to the same table?
I suggest to add foreign key it wont harm the performance (except while on insert when there would be validation for the foreign key). But it would prevent users to insert wrong/corrupt data either through code or directly by loggin in the database.
A while ago we added indexes, both on ROW_ID and on PARENT_ID. Could the index on PARENT_ID have been harmful, since there is no foreign key?
Index on parent_id would only be harmful if you do not make use of index after creating it (i.e. there is no query which make use of this index).
And if you decide to have a foreign key on parent_id then I suggest to have index too on parent_id as it would be helpful atleast when you delete any record in this table.
Best regards! -
How to regenerate a table maintenance view for a table.
A new customer defined field(y_status) was added to the table(ykxrdarea). But the field is not reflected in the view maintenance.busiess adviced me to regenerate the table view maintenance.
Can any one help me how to regenerate the table view maintenance.Go to transaction SE11.Enter the table name and choose utilities from the menu and click on table maintenence generator.You will get the table maintenance dialog.Choose generated objects from the menu and click on change.You will get the change generation elements screen.Enter the reason for regeneration.In your case it is new field/sec.table in structure.hit enter and the table maintenance will be regenerated.If you go back and see the maintenance view now you should see your field.
cheers
Nishanth -
Problem creating table with foreign key in SQL Workshop
Application Express version 2.2.1.00.04
Get error message "Number of referencing columns/data types must match referenced columns"
Master table SLS_SUPPLIERS has primary key SLS_ID NUMBER(8,0) and when creating table SLS_PRODUCTS with FK SLS_SLP_ID NUMBER(8,0) using the create table wizard I get the above error.
The name of the FK is SLP_SLS_FK, key column is SLP_SLS_ID, referenced table is SLS_SUPPLIERS and referenced column is SLS_ID.
Any help is much appreciated.
James Edey
I should add that if I create the table without the foreign key constraint and then create the constraint separately in SQL Workshop then it creates OK. It only fails in the create table wizard dialog.
Message was edited by:
edeyje
Obviously no-one interested in this - just thought it may be a bug in v2.2 that the development team would find useful.
James
Message was edited by:
edeyjeI replied to the other thread on this too -
there is a bug on that page when you click Next. If you define more than one fk but then navigate using the links on the process chart on the left (Constraints, Confirm, etc), the page works fine. We do have a bug on this now and I just added the notes I will need to get this fixed in 3.1 (I have already assigned it to me - must have some rogue validation that fires on next).
Sorry it took so long for this to get noticed - I am glad I checked the forum this morning -
-- Sharon -
How oracle locks child table with foreign keys?
I have 3 tables. tab1 , tab2,tab3.
tab2 has FK on tab1.
tab3 has FK on tab2.All the FKs are indexed.
One transaction in my code changes tab3.
One transaction in my code changes tab1,tab2 and tab3.
I am facing deadlock issues on tab3 when both transactions work concurrently.
If I lock tab1 with "for update nowait " at the start of both transaction,will the problem be solved?Let me elaborate on my problem
TAB1
=====
a1 b1 c1
a2 b2 c2
a3 b3 c3
TAB2
=====
x1 y1 z1 a1
x2 y2 z2 a2
x3 y3 z3 a3
(FK indexed)
TAB3
=====
p1 q1 r1 y1
p2 q2 r2 y2
p3 q3 r3 y3
(FK indexed)
Transaction 1 for session1
select * from TAB1 where col1 = a1 for update nowait;
doing activities on tab2 and tab3 depending on the foreign key joins in loop.
Transaction 2 for session 2
select * from TAB1 where col1 = a2 for update nowait;
doing activities on tab2 and tab3 depending on the foreign key joins in loop.
1) Please let me know whether these sessions can head towards deadlock.
2) If some session try to update TAB3 row of y1 when session 1 is still working , how will system behave?
will it go for blocked session or go for dead lock or get an exception message?
Edited by: user9974355 on Dec 17, 2008 11:58 PM
Edited by: user9974355 on Dec 18, 2008 12:00 AM -
Creating View for a table with parent child relation in table
I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs
of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data
and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.
Base Table
PARENT_OBJ
PAREBT_OBJ_TYPE
DESCEN_OBJ
DESCEN_OBJ_TYPE
JOB_A
JOB
WF_1
WORKFLOW
JOB_A
JOB
DF_1
DATAFLOW
WF_1
WORKFLOW
DF_2
DATAFLOW
DF_1
DATAFLOW
ADF_1
ADF
JOB_B
JOB
WF_2
WORKFLOW
JOB_B
JOB
WF_3
WORKFLOW
WF_2
WORKFLOW
DF_3
DATAFLOW
WF_3
WORKFLOW
DF_4
DATAFLOW
DF_4
DATAFLOW
ADF_2
ADF
View
Job_Name
Flow_Name
Flow_Type
Job_A
WF_1
WORKFLOW
Job_A
DF_1
DATAFLOW
Job_A
DF_2
DATAFLOW
Job_A
ADF_1
ADF
Job_B
WF_2
WORKFLOW
Job_B
WF_3
WORKFLOW
Job_B
DF_3
DATAFLOW
Job_B
DF_4
DATAFLOW
Job_B
ADF_2
ADF
I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.
Regards,
MeghaI think what you need is recursive CTE
Consider your table below
create table basetable
(PARENT_OBJ varchar(10),
PAREBT_OBJ_TYPE varchar(10),
DESCEN_OBJ varchar(10),DESCEN_OBJ_TYPE varchar(10))
INSERT basetable(PARENT_OBJ,PAREBT_OBJ_TYPE,DESCEN_OBJ,DESCEN_OBJ_TYPE)
VALUES('JOB_A','JOB','WF_1','WORKFLOW'),
('JOB_A','JOB','DF_1','DATAFLOW'),
('WF_1','WORKFLOW','DF_2','DATAFLOW'),
('DF_1','DATAFLOW','ADF_1','ADF'),
('JOB_B','JOB','WF_2','WORKFLOW'),
('JOB_B','JOB','WF_3','WORKFLOW'),
('WF_2','WORKFLOW','DF_3','DATAFLOW'),
('WF_3','WORKFLOW','DF_4','DATAFLOW'),
('DF_4','DATAFLOW','ADF_2','ADF')
ie first create a UDF like below to get hierarchy recursively
CREATE FUNCTION GetHierarchy
@Object varchar(10)
RETURNS @RESULTS table
PARENT_OBJ varchar(10),
DESCEN_OBJ varchar(10),
DESCEN_OBJ_TYPE varchar(10)
AS
BEGIN
;With CTE
AS
SELECT PARENT_OBJ,DESCEN_OBJ,DESCEN_OBJ_TYPE
FROM basetable
WHERE PARENT_OBJ = @Object
UNION ALL
SELECT b.PARENT_OBJ,b.DESCEN_OBJ,b.DESCEN_OBJ_TYPE
FROM CTE c
JOIN basetable b
ON b.PARENT_OBJ = c.DESCEN_OBJ
INSERT @RESULTS
SELECT @Object,DESCEN_OBJ,DESCEN_OBJ_TYPE
FROM CTE
OPTION (MAXRECURSION 0)
RETURN
END
Then you can invoke it as below
SELECT * FROM dbo.GetHierarchy('JOB_A')
Now you need to use this for every parent obj (start obj) in view
for that create view as below
CREATE VIEW vw_Table
AS
SELECT f.*
FROM (SELECT DISTINCT PARENT_OBJ FROM basetable r
WHERE NOT EXISTS (SELECT 1
FROM basetable WHERE DESCEN_OBJ = r.PARENT_OBJ)
)b
CROSS APPLY dbo.GetHierarchy(b.PARENT_OBJ) f
GO
This will make sure it will give full hieraracy for each start object
Now just call view as below and see the output
SELECT * FROM vw_table
Output
PARENT_OBJ DESCEN_OBJ DESCEN_OBJ_TYPE
JOB_A WF_1 WORKFLOW
JOB_A DF_1 DATAFLOW
JOB_A ADF_1 ADF
JOB_A DF_2 DATAFLOW
JOB_B WF_2 WORKFLOW
JOB_B WF_3 WORKFLOW
JOB_B DF_4 DATAFLOW
JOB_B ADF_2 ADF
JOB_B DF_3 DATAFLOW
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Database adjustment for custom table with 200 entries
Hi,
We have a custom table which as 3 fields as composite primary key. we want to drop the last field from composite primiary key. Would it be required to do a manual database adjustment or would it automatically adjust the database if I make this change and trasport it.
Please advise.
Regards
KasiHi,
you have to adjust database manually using
se11-utilities-database utiity-> click on
activate and adjust database button .
if you have table mainitainence defined delete
existing table mainitainence and create a
new mainitainence and assign this to request.
so that when request is transported
correction to databse are made in quality
and production as well.
select standrad recording routine radio in table
table mainitainence generator to move table
contents to quality and production by assigning
to request.
Regards
Amole -
Creating Tcode for Custom Table
Hi all,
I have created a custom table ZSALESMANAGER, I have created a Maintenance view for this table ZSALESMANAGER_MV. I have to create a custom Tcode for this maintenance. so that when the i enter this tcode i should get the maintenance view scree of the table.
Please help me, how to do this.
Thanks & Regards,
Poorna.please go throught below link ..... it was given with screen shots of the T.code Creating for the table after the maintaince view had been created ......
<a href="http://">http://www.sapdevelopment.co.uk/tips/tips_tabmaint_tcode.htm</a>
<a href="http://">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/how%20to%20implement%20events%20in%20table%20maintenance.doc</a>
reward points if it is usefull ...
Girish
Maybe you are looking for
-
Not able to View data in .CSV file
Hi, I am using some java script to display data conditionall, for color coding purpose but when i try to download the data to an spread sheet i am not able to do that please suggest me how to export fix this bug select case TRUNC(( ( (NVL(Z."AEWP",0)
-
How to use task flow's transaction options with session's user data
Hi. I have custom extension of ApplicationModuleImpl class: package test.model imports... public class CustomAppModuleImpl extends ApplicationModuleImpl { public static final String SESSION_VAR = "MySessionVar"; public CustomAppModuleImpl() {
-
Alternative for RFC_READ_TABLE FM
Hello All, SAP has asked not to use RFC_READ_TABLE function module (not to be used by SAPu2019s customers) directly or indirectly. Can anybody please suggest me what will be the alternative for this FM. Or what is the replacement for RFC_READ_TABLE F
-
Find my friends lost contact?
My wife has an iPhone 5 iOS 7.1.1 Find My Friends - she can no longer "see" my iPhone 5s (I can see her). It has worked well for 2 plus years. Have tried uninstalling and reinstalling. Send Friend requests to my phone from hers that never come. What
-
How to inject external configuration into web dynpro application
Hi colleagues, I've a web dynpro application, which has some hard coded hostnames in the source code. All hard coded hostnames should be moved to some else place, either engine parameters or external configuration file. Searching over the project, ha