Make relation between 2 table programilly
how can I make a relation between 2 tables ( one to many) through code
and also broke this relation through code
You just need these commands:
https://msdn.microsoft.com/en-US/library/zkyz3407%28v=vs.80%29.aspx
https://msdn.microsoft.com/en-US/library/sdwsys0z(v=vs.80).aspx
Bye, Olaf.
Olaf Doschke - TMN Systemberatung GmbH http://www.tmn-systemberatung.de
Similar Messages
-
How to make relation between gl_je_lines and wip_transaction_accounts
I try to write script to make relation between GL and WIP, wip_transaction_accounts and mtl_material_transactions
1.
SELECT
(SELECT meaning
FROM mfg_lookups
WHERE lookup_type = 'WIP_TRANSACTION_TYPE'
AND lookup_code =
(SELECT TRANSACTION_TYPE
FROM wip_transactions
WHERE transaction_id = wta.transaction_id
) "Transaction Type" ,
gjb.NAME "Journal Batch Name" ,
gjh.NAME "Journal Name" ,
gjh.je_source "JE Source" ,
gjh.je_category "JE Category" ,
glp.period_num "GL Month" ,
glp.period_year "GL Year" ,
gjh.default_effective_date "GL Date" ,
NVL(gje.accounted_dr,0) -NVL( gje.accounted_cr,0) "GL Line Amount" ,
gje.description "GL Line Description" ,
(SELECT organization_code
FROM mtl_parameters
WHERE organization_id = wta.organization_id
) "ORG Name" ,
NULL "Vendor/Customer Name" ,
NULL "SO/PO Number" ,
NULL "Reference Number" ,
NULL "AP/AR Invoice Number" ,
NULL "Doc Sequence Value" ,
NULL "Invoice Type Lookup Code" ,
NULL "Check Number" ,
NULL "Line Type" ,
NULL "Category" ,
NVL (wta.base_transaction_value, 0) "Transaction Amt" ,
NULL "AR/PO Receipt Number" ,
NULL "Applied Invoice Number" ,
(SELECT a.segment1
FROM mtl_system_items_b a ,
wip_discrete_jobs b
WHERE a.inventory_item_id = b.primary_item_id
AND a.organization_id = b.organization_id
AND b.wip_entity_id = wta.wip_entity_id
AND b.organization_id = wta.organization_id
) "Item Name" ,
gcc.segment1 "Company" ,
gcc.segment2 "Department" ,
gcc.segment3 "Account" ,
(SELECT description
FROM fnd_flex_values_vl fnd
WHERE flex_value_set_id = 1009707
AND TO_CHAR (fnd.flex_value) = gcc.segment3
) "Account Description" ,
gcc.segment4 "Intercompany" ,
NULL "JE Category Description" ,
NULL "AP Invoice Line Description"
TRUNC (wta.transaction_date) "JE Creation/Inv Trans Date" ,
NULL "JE Created By" ,
NULL "Reversal Flag" ,
NULL "Reason Code" ,
NULL "Subinventory Name" ,
wta.primary_quantity "Quantity" ,
NVL (wta.base_transaction_value, 0) "Value" ,
gje.context ,
gje.attribute1 ,
gje.attribute2 ,
gje.attribute3 ,
gje.attribute4 ,
gje.attribute5 ,
DECODE(gjh.status,'P','Posted','U','Unposted','Error') "Post Status"
FROM gl_je_lines gje ,
gl_je_headers gjh ,
gl_je_batches gjb ,
wip_transaction_accounts wta ,
gl_code_combinations gcc ,
gl_periods glp
WHERE 1 =1
AND gje.je_header_id = gjh.je_header_id
AND gjh.je_batch_id = gjb.je_batch_id
AND UPPER (gjh.je_source) = 'INVENTORY'
AND gcc.code_combination_id = gje.code_combination_id
AND wta.reference_account = gje.code_combination_id
AND TRUNC(wta.transaction_date) BETWEEN glp.START_DATE AND glp.END_DATE
AND gje.reference_1 = wta.gl_batch_id
AND gje.gl_sl_link_table = 'WTA'
AND glp.period_name = gjh.period_name
AND glp.period_set_name = 'OVT_US_CAL'
==
2.
SELECT mtt.transaction_type_name "Transaction Type" ,to_char(mmt.transaction_date,'mm/dd/yyyy hh:mi:ss') as teas, mta.transaction_id,mta.organization_id, mmt.organization_id,
gjb.NAME "Journal Batch Name" ,
gjh.NAME "Journal Name" ,
gjh.je_source "JE Source" ,
gjh.je_category "JE Category" ,
glp.period_num "GL Month" ,
glp.period_year "GL Year" ,
gjh.default_effective_date "GL Date" ,
NVL(gje.accounted_dr,0) - NVL(gje.accounted_cr,0) "GL Line Amount" ,
gje.description "GL Line Description" ,
(SELECT organization_code
FROM mtl_parameters
WHERE organization_id = mta.organization_id
) "ORG Name" ,
NULL "Vendor/Customer Name" ,
NULL "SO/PO Number" ,
mmt.TRANSACTION_REFERENCE "Reference Number" ,
NULL "AP/AR Invoice Number" ,
NULL "Doc Sequence Value" ,
NULL "Invoice Type Lookup Code" ,
NULL "Check Number" ,
NULL "Line Type" ,
NULL "Category" ,
NVL (mta.base_transaction_value, 0) "Transaction Amt" ,
NULL "AR/PO Receipt Number" ,
NULL "Applied Invoice Number" ,
(SELECT segment1
FROM mtl_system_items_b
WHERE inventory_item_id = mmt.inventory_item_id
AND organization_id = mmt.organization_id
) "Item Name" ,
gcc.segment1 "Company" ,
gcc.segment2 "Department" ,
gcc.segment3 "Account" ,
(SELECT description
FROM fnd_flex_values_vl fnd
WHERE flex_value_set_id = 1009707
AND TO_CHAR (fnd.flex_value) = gcc.segment3
) "Account Description" ,
gcc.segment4 "Intercompany" ,
NULL "JE Category Description" ,
NULL "AP Invoice Line Description"
TRUNC (mta.transaction_date) "JE Creation/Inv Trans Date" ,
NULL "JE Created By" ,
NULL "Reversal Flag" ,
(SELECT MGD.SEGMENT1
FROM MTL_GENERIC_DISPOSITIONS MGD,
MTL_MATERIAL_TRANSACTIONS MMTT
WHERE MGD.DISPOSITION_ID = MMTT.TRANSACTION_SOURCE_ID
AND MMTT.TRANSACTION_SOURCE_TYPE_ID = 6
AND MGD.ORGANIZATION_ID = MMTT.ORGANIZATION_ID
AND MMTT.TRANSACTION_ID = MMT.TRANSACTION_ID
) "Reason Code" ,
mmt.SUBINVENTORY_CODE "Subinventory Name" ,
mta.primary_quantity "Quantity" ,
NVL (mta.base_transaction_value, 0) "Value" ,
gje.context ,
gje.attribute1 ,
gje.attribute2 ,
gje.attribute3 ,
gje.attribute4 ,
gje.attribute5 ,
DECODE(gjh.status,'P','Posted','U','Unposted','Error') "Post Status" -
FROM gl_je_lines gje ,
gl_je_headers gjh ,
gl_je_batches gjb ,
mtl_transaction_accounts mta ,
mtl_material_transactions mmt ,
mtl_transaction_types mtt ,
gl_code_combinations gcc ,
gl_periods glp
WHERE 1 =1
AND mta.transaction_id = mmt.transaction_id
AND gje.je_header_id = gjh.je_header_id
AND gjh.je_batch_id = gjb.je_batch_id
AND UPPER (gjh.je_source) = 'INVENTORY'
AND gcc.code_combination_id = gje.code_combination_id
AND mta.reference_account = gje.code_combination_id
AND TRUNC(mta.transaction_date) BETWEEN glp.START_DATE AND glp.END_DATE
and mta.request_id=mmt.request_id
and mta.inventory_item_id=mmt.inventory_item_id
AND gje.reference_1 = mta.gl_batch_id
AND gje.gl_sl_link_table = 'MTA'
AND mtt.transaction_type_id = mmt.transaction_type_id
AND glp.period_name = gjh.period_name
AND glp.period_set_name = 'OVT_US_CAL'
When gl_je_lines have multiple line this script on the same transaction_id it will get wrong information. By setup all wip_transaction_accounts.GL_SL_Lind_id and mtl_transaction_accounts.GL_SL_Lind_id is null
Anyone can help?Hello.
How are you reaching the inconsistencies ? Are you comparing report's results?
Octavio -
Tool for viewing the relation between tables.
Hi,
I imported the schema dump in Oracle 10g R2 DB, there are about 800 plus tables in that schema. I would like to know the relataion between tables.So,What tools are available for viewing the relation between tables?. I have TOAD, and Oracles SQL Developer tolls, if there are any free tools for the same, please let me know the URLs.
Regards,
Sabdar Syed.Hmmm, for free, except what gave Eric earlier, not easy...
Here already discuss about that :
Re: Table Dependencies
Nicolas. -
Displaying Relations Between Tables In Oracle 10.2.0.3
Hi Everyone;
I am in urgent need to display all the relations between tables of a Dbase in Oracle 10.2.0.3 version dbase. I use a server 2003 R2 machine and a developer tool TOAD for oracle v9.7 as ODT. If anyone have a clue please i need it.Sincerely
Best Regards
Ömer KAYAHi Ömer
You can with those tools read the configuration and get the actual ERD model from the database, so you will be able to see the relation in the tables.
Please try that tool
http://www.download32.com/modelright-3-for-oracle-i38008.html
Product stands "Do you need to design, visualize or document your Oracle database?"
In TOAD tool you are also able to do it: Reverse engineer already existing database structures and see the existing database structure in form of a diagram.
Regards,
Hubert
P.S. looking forward to get your "precious" points ;-)
Edited by: Hub on Oct 27, 2008 2:28 PM
Edited by: Hub on Oct 27, 2008 2:35 PM
Edited by: Hub on Oct 27, 2008 2:54 PM -
Hi experts,
How can I find the relation between tables? I mean, I can go to se 11 and compare each field of 2 tables manually, but it's very time consuming. Is there any possibilty to compare tables and find all the fields that can be found in both table?Go to SQVI transaction... Create a qucik view.. ztest.. give desc..etc
Select data source as table join.... enter
now one screen will come with blank data (blue scrren)
in that application toolbar second button .. click that.. enter VBAK..
click that again.. enter VBAP.. now an image will come with links b/w vbak and vbap.. you can use any no. of tables there.... -
The relation between table mbew and mbewh
MORNING!
I wanna know the relation between table mbew and mbewh.
I finded some materials in table mbewh have total valuated stock , but these materials don't have value .
Thanks a lot !Hi Roy, please check this link.
http://www.sapfans.com/forums/viewtopic.php?p=4330&sid=a1b0e2c950bb90aa410b796d9ce0a13c
REgards,
Rich Heilman -
How to find the tcode for relation between tables
Hi all
Just wanted to know the tcode that will show/give graphycal/ nongraphycal relation between tables if there is any..
Very urgent, please.Transaction code to find relation between tables(Very urgent.)
Please do NOT open duplicate posts.
Regards,
Ravi
Note - Please mark the helpful answers -
How to get the relation between tables.
Hi all,
Sorry in my previous message I forgot to include the table CABN.
I would like to retrieve data from the tables BDCP,and characteristics tables KSS,INOB,AUSP and CABN.
I am given the values BDCP-TABNAME,BDCP-FLDNAME,BDCP-KEY,BDCP-CRETIME,BDCP-CDOBJCL.
BDCP-CDOBJID is nothing but Material number.I want to retrieve category(AUSP-ATWRT) and subcategory(AUSP-ATWRT) for that material BDCP-CDOBJID.
So first of all how to proceed.Can anyone give idea?I heard that there is transaction,where we can find relations between tables.
Thanks,
Balaji
Pages: 1U could try with SQVI Tcode. just give table names try to link.
For your requirement there are several functional modules availalbe.
Try where used list on AUSP table and find Function modules. Test them first then use in the program. -
DBAdapter Creating Relations between tables not having PF-FK relationship
I am writing a process which has to pull data from three tables.
SELLER_HEADER (inv_Num is Primary Key)
SELLER_LINE_ITEMS ( no PK but has inv_num and line_number which together are unique)
BUYER_LINE_ITEMS (no PK but has cust_num, cust_PO_num and line_num that are unique)
I want to create a DB Adapter which would take in an invoice number, customerNumber and customerPONumber
and fetch me data whose XSD is roughly in this structure
One Node of Type Header
---- Column 1 of the Header Table
---- Column 2 of the Header Table
---- Column 3 of the Header Table
... and so on
Multiple Nodes of
---- Column 1 of the Seller Table
---- Column 2 of the Seller Table
---- Column 3 of the Seller Table
and
---- Column 1 of the Buyer Table
---- Column 2 of the Buyer Table
---- Column 3 of the Buyer Table
I tried some combinations and found that if you have a 1:M mapping for Header - Seller Line Item
and a 1:1 mapping between Seller Line Item and Buyer Line Item then i get the desired XSD
So, I created a 1:M relation between header and Seller lineItems. However i cannot create a one to one mapping between Seller Line Items and Buyer line items. Nor can i create a 1 :M mapping between Seller Header and Buyer Line Items. That is why the generated XSD shows
<SomeCollectionName>
<SellerHeader>
<BuyerLineItems>
<SellerLineItems>
</SomeCollectionName>
Any pointers for this? How do i make a relation based on the input values to the DBAdapterDoes the CORE_BUSINESS schema have REFERENCES and SELECT privileges on the table you are trying to reference with the foreign key constraint?
-
The Relation between tables and views in oracle financial
Dears
I am work in oracle e business r12
and i need to build report as xml
when run my select its need big time to view data i have a huge of data so i need to clear the relation of this tables if there is miss and if there another technique in select statement
this is my select statement
select
j_hdr.je_header_id je_header_id,
hdr.VENDOR_NAME supplier,
SEGMENT1||'-'||SEGMENT2||'-'||SEGMENT3||'-'||SEGMENT4||'-'||SEGMENT5||'-'||SEGMENT6||'-'||SEGMENT7||'-'||SEGMENT8||'-'||SEGMENT9 Account_number,
hdr.gl_date gl_date,
j_hdr.CURRENCY_CODE CURRENCY_CODE,
inv_lin.DESCRIPTION DESCRIPTION,
j_lin.ENTERED_DR ENTERED_DR,
j_lin.ENTERED_CR ENTERED_CR,
j_lin.ACCOUNTED_DR ACCOUNTED_DR,
j_lin.ACCOUNTED_CR ACCOUNTED_CR,
j_hdr.JE_SOURCE JE_SOURCE,
j_hdr.DEFAULT_EFFECTIVE_DATE Transaction_DATE,
hdr.INVOICE_NUM INVOICE_NUM,
QUICK_PO_NUMBER PO_NUMBER,
null ASSET_CATEGORY_ID,
hdr.VENDOR_ID VENDOR_ID
from gl_je_headers j_hdr,gl_je_lines_v j_lin,ap_invoice_distributions dist,ap_invoices_v hdr,ap_invoice_lines_v inv_lin
where code_combination_id = DIST_CODE_COMBINATION_ID
and hdr.invoice_id = inv_lin.INVOICE_ID
and dist.invoice_id = inv_lin.INVOICE_ID
and j_hdr.JE_HEADER_ID = j_lin.JE_HEADER_ID
and j_hdr.status = 'P'
and nvl(:P_SOURCE,'Payables') = 'Payables'
and je_source = 'Payables'
and j_lin.CODE_COMBINATION_ID between ( select CODE_COMBINATION_ID
from gl_code_combinations_kfv
where CONCATENATED_SEGMENTS = :P_FROM_COMBINATION_CODE)
and ( select CODE_COMBINATION_ID
from gl_code_combinations_kfv
where CONCATENATED_SEGMENTS = :P_TO_COMBINATION_CODE)
AND TRUNC(dEFAULT_EFFECTIVE_DATE) BETWEEN NVL(:P_FROM_DATE, DEFAULT_EFFECTIVE_DATE) AND NVL(:P_to_DATE, DEFAULT_EFFECTIVE_DATE)
Thanks in advanceWelcome to the world of complicated Oracle Application queries. Didn't fully understand your question, so a few guesses -
I think that you are asking how to make your query faster? I would reference the FAQ section on how to post a question regarding performance.
Your title indicates you want to understand the relationship between tables and views. In general, Oracle Applications uses views for 2 reasons - to join data from multiple tables for display, and to differentiate data from different organizations. (I am still on 11i and have heard organizations are handled differently in 12 so I can't speak to that for sure).
To understand the relationship between tables in a view, you can access the view's source code, either through a development tool such as PL/SQL Developer or TOAD (I'm guessing Oracle's tool does this also, but have never used it), or by querying the source from the dba_source table.
select * from dba_source where name = (name of view) and type = 'VIEW' order by line;without the ( ) just the view name, in all capital letters i.e. , 'GL_JE_LINES_V'
Good luck! -
Mapping or relation between tables
Hello
I have a application, that I installed on top of Oracle 11G. this database has more than 200 tables all linked based on keys. Sorry my terminology may not be so good since am not a dba.
I would like to study the relationships between tables to better understand the application.
Is there a tool that allows me to view the relationship between the tables or provides me a mapping between the tables, very similar to UML mapping that shows relationships between classes.
Thanks;column contacts.contact should only contain values which exist in persons.id or companys.id.
if i put two foreign key constraints on table contacts witch reference persons.id and companys.id i get a error when inserting any value into contacts.
example:
table persons:
id | name
99 | john
insert into contacts
values(1,2,99);
here i get the error.
i think its because the second fk-constraint does not accept this value. -
IC - how to make relation between e-mails from BPs and BPs
Hello,
In IC Win when I send email to BP system saves it in relation to BP (so I can later search it in CRM). But what about
e-mails from BPs. How I can relate them to BPs? Or how CRM can make relation automatically?
Regards
RadekHello Radek,
You can implement GW and transfer emails from GroupWare into CRM. Onc we transfer emails into CRM, you can create activities/attach emails to the BPs.
Regards,
Paparao -
is there any relation ship between ausp and mara
AUSP holds the characteristc values for a given material for which MARA is the master tables.
MARA-MATNR = AUSP-OBJEK.
Note :Please close the thread if the question is answered and mark all the helpful answers
Regards,
Ravi -
How to find the relation between tables
Hi
I am working in Oracle R12
How to find the relationship between these tables INV_MIN_MAX_TEMP,po_requisition_lines_all and Per_all_people_f
These two table i have joined with po_requisition_lines_all and Per_all_people_f To_person_id from PO and Person from hr table but i cant able to join this table with other tables INV_MIN_MAX_TEMP
regards
SrikkanthHi;
Please check e-trm site for table relation,integration,explanation etc..
etrm.oracle.com/
Regard
Helios -
Relation between tables BSEG and COEP
Hi,
I am developing a report where I want to know the relationship between BSEG and COEP or COBK table is there any field or other way to know.
Thanks in Advance.
Regards,
KiranBSEG contains is the line items of the Accounting Docs ( header is BKPF) . This are primary costing data.
On the other hand COEP is the line item data for secondary costing data. COBK is the header table for COBK.
Though you will find BELNR in both BKPF - BSEG and COBK-COEP, but if you look at the data elements, they are BELNR_D and CO_BELNR respectively.
Maybe you are looking for
-
Media encoder not showing in cloud apps
media encoder not showing in cloud apps - I receive an error opening it and I want to reinstall but it is not in the download list
-
Unable to sign to Apps store after updating to ios7
Is anybody else having problem while signing in to apps store.At first I was unable to see my purchase history,so I signed out,now I am unable to signin
-
Trouble connecting to DB using AMFPHP
Hi I am testing out a service using AMFPHP, which connects to a database and returns the table info. in flash when you run the swf. For some reason my connection using PHP isn't working. I am sure I have all of the correct information in the code whi
-
Finder file info again stopped showing
iMac 7,1; Mac OSX 10.6.8 My user preferences have become modified/corrupted at least twice recently, and I'm wondering what is the cause. Back on 5 March 2015 I posted that finder had stopped showing file info Finder stopped showing file info, and wh
-
Why are my YouTube login credentials not accepted by Captivate?
I am trying to publish my Captivate project as a video on YouTube. A popup screen appears asking for my YouTube username and password, but when entered I am told that "Login failed. Specify the correct username and password, and try again." The same