11.支持实际世界中复杂的,多层次,多组织 的交易关系。
oracel ebs R12 TCA 架构该帖主要是介绍TCA的架构 是入门的绝佳文章,后面的帖子会进行简单技术分析
转 http://www.oracleappshub.com/accounts-receivable/oracle-tca/trading-community-architecture-tca-101/
Trading Community Architecture (TCA) is a structure which was based out of R11 Customer Model designed to support complex trading relationships to cater additional need which further extended in R12 with Supplier and Bank. So, TCA is a data model that allows you to manage complex information about the parties, or customers or suppliers or bank who belong to your commercial community, including organizations, locations, and the network of hierarchical relationships among them.
what is TCA?
What is TCA, the Trading Community Architecture? Is TCA an Oracle Applications module? Is it functionality within an Oracle module? These are few common question, and there are often many answers given.
The TCA is a data model that supports the entry and management of entities that you interact with. So lets revisit the concept.
Trading Community Architecture is a Very flexible, very robust model which defines the components involve in trading within in E-business Suite.
The implementation of technology and applications to allow users to create and maintain relationships among entities
The universal data schema for customers, prospects, suppliers, distributors, resellers, consortiums, bank across all Oracle EBS applications
TCA not only allows for the tracking of relationships between the implementing organization and its trading partners, but also tracks relationships between the trading partners themselves.
You should also note, TCA is neither an Oracle Applications module nor requires separate license.
If you see TCA guide, you can find these are the key features of TCA
Here are Technical details for R12 Supplier in TCA. You can also refer old post for more details.
HZ_PARTIES
The HZ_PARTIES table stores basic information about parties that can be shared with any relationship that the party might establish with another party. Although a record in the HZ_PARTIES table represents a unique party, multiple parties can have the same name. The parties can be one of four types:
{{"bul:1"}}Organization-for example, Oracle Corporation
{{"bul:1"}}Person-for example, Jane Doe
{{"bul:1"}}Group-for example, World Wide Web Consortium
{{"bul:1"}}Relationship-for example, Jane Doe at Oracle Corporation.
{{"bodytext"}}Party records can be created and updated using third party data sources such as Dun & Bradstreet's Global Data Products. The HZ_PARTIES table contains denormalized information from the HZ_LOCATIONS, HZ_PERSON_PROFILES, HZ_CONTACT_POINTS, HZ_ORGANIZATION_PROFILES, and HZ_PERSON_LANGUAGE tables. The identifying address contained in the HZ_PARTIES table is denormalized from the HZ_LOCATIONS table.
.
The primary key for this table is PARTY_ID.
HZ_ORGANIZATION_PROFILES
The HZ_ORGANIZATION_PROFILES table stores a variety of information about a party. This table gets populated when a party of the Organization type is created. This table also contains data retrieved from Dun & Bradstreet using either the Dun & Bradstreet online or batch download methods. Historical data for the organization can also be stored in this table. Each time organization information is changed, the effective end date column for the original record is updated and a new record that contains the updated information is created.
.
The primary key for this table is ORGANIZATION_PROFILE_ID.
HZ_PERSON_PROFILES
The HZ_PERSON_PROFILES table stores personal and family information about a party of the Person type. For example, this table could contain the correct spelling and phonetic pronunciation of the person's name. Note that some information in this table may also be entered into the HZ_PARTIES table.
.
The primary key for this table is PERSON_PROFILE_ID.
HZ_CODE_ASSIGNMENTS
The HZ_CODE_ASSIGNMENTS table is an intersection table that links the classification codes in the FND_LOOKUP_VALUES table to the names of parties or other entities stored in the table identified in the OWNER_TABLE_NAME column. For example, the classification code for databases can be linked to Oracle Corporation.
.
The primary key for this table is CODE_ASSIGNMENT_ID.
HZ_PARTY_USG_ASSIGNMENTS
Stores information about party usage assignments.
SELECT party_usg_assignment_id,
party_usage_code,
effective_start_date
FROM hz_party_usg_assignments
WHERE party_id = p_party_id
AND status_flag = 'A'
AND trunc(sysdate) between
effective_start_date and effective_end_date;
-- load party usages
CURSOR c_party_usages IS
SELECT party_usage_code,
party_usage_type,
status_flag,
restrict_manual_assign_flag,
restrict_manual_update_flag,
created_by
FROM hz_party_usages_b;
-- load rules
CURSOR c_exist_exclusive_rules IS
SELECT null
FROM hz_party_usage_rules
WHERE (party_usage_rule_type = 'EXCLUSIVE' OR
party_usage_rule_type = 'CANNOT_COEXIST')
AND trunc(sysdate) between
effective_start_date AND effective_end_date
AND rownum = 1;
CURSOR c_party_usage_rules IS
SELECT party_usage_rule_type||'##'||
party_usage_code||'##'||
related_party_usage_code
FROM hz_party_usage_rules
WHERE trunc(sysdate) between
effective_start_date AND effective_end_date;
HZ_ORG_CONTACTS
The HZ_ORG_CONTACTS table stores information about the position of the contact for a party or party site. The records in this table provide information about a contact position such as JOB_TITLE, RANK, and general contact information. This table is not used to store information about a specific person or organization, such as name and identification codes. That information is stored in the HZ_PARTIES table. For example, this table may include a record for the position of vice president of manufacturing that indicates that the contact is a senior executive, but it would not include the name of the person in that position.
.
The primary key for this table is ORG_CONTACT_ID.
HZ_ORIG_SYS_REFERENCES
The HZ_ORIG_SYSTEM_REFERENCES table stores the mapping between source system references and the owner tables. The source system reference is an identifier for the record that the data came from the source system and the owner table is the TCA table, which stores that data. A record with an Active status means the cross-reference mapping between TCA and source system is vaild. An Inactive status means the cross-referencing mapping is no longer valid.
HZ_RELATIONSHIPS
The HZ_RELATIONSHIPS table stores information about relationships between one party and another party. The SUBJECT_ID and OBJECT_ID columns specify the relationship that exists between two parties. For example, if the party relationship is of the Parent Of type, a holding company could be the SUBJECT_ID in the relationship while one of its subsidiaries could be the OBJECT_ID. Creating a party contact causes a party relationship to be created. A party can have different relationships with one or more other parties. A party relationship can be specified with specific start and end dates so that the subject or object of a relationship can change over time.
.
The primary key for this table is RELATIONSHIP_ID.
HZ_RELATIONSHIP_TYPES
The HZ_RELATIONSHIP_TYPES table defines the business rules that are associated with a relationship type. A non-directional relationship type consists of a single record with the same forward (FORWARD_REL_CODE) and backward (BACKWARD_REL_CODE) relationship codes. A directional relationship type consists of two records: one for the parent (DIRECTION_CODE is P) and the other for a child (DIRECTION_CODE is C) of that parent. Forward and backward relationship codes are validated against the PARTY_RELATIONS_TYPE lookup type.
.
The primary key for this table is RELATIONSHIP_TYPE_ID.
.
The RELATIONSHIP_TYPE_ID is used as the foreign key to the HZ_CODE_ASSIGNMENTS table, in the OWNER_TABLE_ID column. You can define a relationship type as part of a relationship type group in
the HZ_CODE_ASSIGNMENTS table.
HZ_ORG_CONTACT_ROLES
The HZ_ORG_CONTACT_ROLES table stores information about the role of the contact position that is specified in the HZ_ORG_CONTACTS table. Contacts may have multiple roles. For example, a vice president of manufacturing may have a custom-defined role as a member of a capital expenditures review board.
.
The primary key for this table is ORG_CONTACT_ROLE_ID.
HZ_CUST_ACCOUNTS
The HZ_CUST_ACCOUNTS table stores information about customer accounts , or business relationships that the deploying company establishes with a party of type Organization or Person. This table focuses on business relationships and how transactions are conducted in the relationship.
Since a party can have multiple customer accounts, this table might contain several records for a single party. For example, an individual person can establish a personal account, family account, and a professional account for a consulting practice.
HZ_CUST_ACCOUNT_ROLES
The HZ_CUST_ACCOUNT_ROLES table stores information about a role or function that a party performs in relation to a customer account. For example, Jane Doe might be a legal contact for Vision Corporation.
.
The primary key for this table is CUST_ACCOUNT_ROLE_ID.
select b.person_first_name||' '||b.person_last_name
from hz_cust_account_roles a,
hz_parties b,
hz_relationships c
where a.cust_account_role_id = v_contact_id
and c.party_id =a.party_id
and c.subject_id = b.party_id
and c.subject_table_name = 'HZ_PARTIES'
and c.object_table_name = 'HZ_PARTIES'
and c.directional_flag = 'F';
HZ_PARTY_SITES
The HZ_PARTY_SITES table links a party (see HZ_PARTIES) and a location (see HZ_LOCATIONS) and stores location-specific party information such as MAILSTOP and ADDRESSEE. One party can optionally have one or more party sites. One location can optionally be used by one or more parties. For example, 500 Oracle Parkway can be specified as a party site for Oracle Corporation. This party site can then be used for multiple customer accounts within the same party.
.
The primary key for this table is PARTY_SITE_ID.
整理的R12 TCA 的一些查询逻辑及语句
1.--查看HZ_Party的成员类型
SELECT ptypelu.lookup_type
,ptypelu.lookup_code
,ptypelu.meaning
,ptypelu.description
FROM fnd_lookup_values ptypelu
WHERE ptypelu.view_application_id(+) = 222
AND ptypelu.lookup_type(+) = 'PARTY_TYPE'
AND ptypelu.LANGUAGE(+) = userenv('LANG');
2.--查看成员关系
SELECT rolelu.lookup_type
,rolelu.lookup_code
,rolelu.meaning
,rolelu.description
FROM fnd_lookup_values rolelu
where rolelu.view_application_id = 222
AND rolelu.lookup_type = 'HZ_RELATIONSHIP_ROLE'
AND rolelu.LANGUAGE = userenv('LANG');
3.hz_code_assignments(branchcp)和hz_parties关联一般是根据 hz_code_assignments和其他表
关联主要是通过class_category、owner_table_name、owner_table_id莱进行的。
AND (branchca.class_category(+) = 'BANK_INSTITUTION_TYPE') --类型
AND hca.primary_flag = 'Y' --主要分配
AND hca.status = 'A'; --分配有效
AND (branchca.owner_table_name(+) = 'HZ_PARTIES') --主要表
AND (branchca.owner_table_id) --HZ_PARTIES表中对应的party_id,如果是银行可以是银行的账户或者银行,或者客户,根据不同类型,对应不同的party类型party_id,这三个条件就可以关联整理出这两个表,从而得到当前的party类型hz_code_assignments.class_code;
4.hz_contact_points(branchcp)和hz_parties关联一般是根据
AND (branchcp.contact_point_type(+) = 'EFT') ---类型,例如电话就是'PHONE',邮箱就是'EMAIL'
AND (nvl(branchcp.status(+),'A') = 'A') ---状态
AND (branchcp.owner_table_name(+) = 'HZ_PARTIES') ---主要表
AND (branchcp.owner_table_id(+) = eb.branch_id) ---HZ_PARTIES表中对应的party_id,如果是银行可以是银行的账户或者银行,或者客户,根据不同类型,对应不同的party类型party_id,也可以是与HZ_PARTIES.party_id 相对应的party_id 例如银行账户ID,银行ID
5.
SELECT hzp.party_name 客户名称
,hzp.party_number 客户标示
,hzcacc.account_name 客户账户名称
,bp.party_name 银行名称 --银行
,br.party_name 银行分行 --分行
,eb.bank_account_num 银行帐号 --银行帐号
,eb.currency_code 币种
,iepa.org_id 业务实体
,hzcacc.creation_date 客户账户创建日期
,iepa.creation_date 付款人创建日期
,ow.creation_date 账户所属创建日期
,eb.creation_date 账户创建日期
,ipiua.creation_date 付款手段日期创建时间
FROM iby_external_payers_all iepa
,iby_pmt_instr_uses_all ipiua
,hz_parties hzp
,hz_cust_accounts hzcacc
,hz_organization_profiles bapr
,hz_organization_profiles brpr
,hz_parties bp --银行
,hz_party_sites s
,iby_account_owners ow
,hz_parties br --分行
,hz_parties op
,iby_ext_bank_accounts eb
,hz_code_assignments branchca
,hz_contact_points branchcp
WHERE eb.bank_id = bp.party_id(+)
AND eb.bank_id = bapr.party_id(+)
AND eb.branch_id = br.party_id(+)
AND eb.branch_id = brpr.party_id(+)
AND eb.ext_bank_account_id = ow.ext_bank_account_id(+)
AND ow.primary_flag(+) = 'Y'
AND nvl(ow.end_date,
SYSDATE + 10) > SYSDATE
AND ow.account_owner_party_id = op.party_id(+)
AND (br.party_id = s.party_id(+))
AND (s.identifying_address_flag(+) = 'Y')
AND (branchcp.owner_table_name(+) = 'HZ_PARTIES')
AND (branchcp.owner_table_id(+) = eb.branch_id)
AND (branchcp.contact_point_type(+) = 'EFT')
AND (nvl(branchcp.status(+),
'A') = 'A')
AND (branchca.class_category(+) = 'BANK_INSTITUTION_TYPE')
AND (branchca.owner_table_name(+) = 'HZ_PARTIES')
AND (branchca.owner_table_id(+) = eb.branch_id)
AND SYSDATE BETWEEN nvl(trunc(bapr.effective_start_date),
SYSDATE - 1) AND nvl(trunc(bapr.effective_end_date),
SYSDATE + 1)
AND SYSDATE BETWEEN nvl(trunc(brpr.effective_start_date),
SYSDATE - 1) AND nvl(trunc(brpr.effective_end_date),
SYSDATE + 1)
AND iepa.payment_function = 'CUSTOMER_PAYMENT'
AND eb.ext_bank_account_id = ipiua.instrument_id
AND ipiua.instrument_type = 'BANKACCOUNT'
AND ipiua.ext_pmt_party_id = iepa.ext_payer_id
AND ipiua.payment_function = 'CUSTOMER_PAYMENT'
AND hzp.party_id = iepa.party_id
AND hzcacc.party_id = iepa.party_id
AND hzcacc.cust_account_id = iepa.cust_account_id
AND hzp.party_name LIKE '汉森%';
6.hz_relationships(hzr)和hz_party(hp)关联
AND hp.party_id = hzr.subject_id --和主表联系
AND hzr.relationship_type = 'CONTACT' --关系类型
AND hzr.relationship_code = 'CONTACT_OF' --关系代码
AND hzr.subject_type = 'PERSON' --被关联者
AND hzr.object_type = 'ORGANIZATION' --主关联者
AND hzr.status = 'A' --关联是否有效
eg:获取银行数据
SELECT hop.party_id,
hop.bank_or_branch_number,
hop.organization_name,
hop.home_country
FROM hz_organization_profiles hop,
hz_parties hp,
hz_relationships hr
WHERE hr.object_id = p_bank_rec.organization_rec.party_rec.party_id
AND hr.relationship_type = 'BANK_AND_BRANCH'
AND hr.relationship_code = 'HAS_BRANCH'
AND hr.object_type = 'ORGANIZATION'
AND hr.object_table_name = 'HZ_PARTIES'
AND hr.subject_type = 'ORGANIZATION'
AND hr.subject_table_name = 'HZ_PARTIES'
AND SYSDATE BETWEEN hr.start_date AND NVL(hr.end_date, SYSDATE + 1)
AND hr.status = 'A'
AND hop.party_id = hr.subject_id
AND SYSDATE BETWEEN TRUNC(hop.effective_start_date)
AND NVL(hop.effective_end_date, SYSDATE+1)
AND hp.party_id = hop.party_id
AND hp.status = 'A';
7.hz_organization_profiles(hop)和hz_party(hp)关联 hz_organization_profiles和外表关联主要
是使用party_id和effective_start_date,effective_end_date来实现的。
SELECT hop.bank_or_branch_number, --根据类型获取相应的数据
hop.organization_name,
hop.home_country
FROM hz_organization_profiles hop,
hz_parties hp
WHERE hop.party_id = p_bank_id --主party_id
AND SYSDATE BETWEEN TRUNC(hop.effective_start_date)
AND NVL(hop.effective_end_date, SYSDATE+1)
AND hp.party_id = hop.party_id
AND hp.status='A';
8查看客户信站点信息
SELECT hl.address1 --地点地址
,hcsu.location --地点
,hzp.party_name --客户名称
,hca.cust_account_id --
,hcsu.site_use_code --
FROM hz_cust_accounts hca
,hz_cust_site_uses hcsu
,hz_cust_acct_sites hcas
,hz_party_sites hps
,hz_locations hl
,hz_parties hzp
WHERE hl.location_id = hps.location_id
AND hps.party_site_id = hcas.party_site_id
AND hcas.cust_account_id = hca.cust_account_id
AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id
AND hcsu.site_use_code = 'BILL_TO'
AND hzp.party_id = hca.party_id
AND hcas.status = 'A'
AND hcsu.status = 'A'
AND hcsu.org_id = 122
AND hca.cust_account_id = 35041;
--9获取客户银行账户
SELECT hzp.party_name 客户名称
,hzp.party_number 客户标示
,hzcacc.account_name 客户账户名称
,ibybanks.bank_name 银行名称 --银行
,ibybanks.bank_branch_name 银行分行 --分行
,ibybanks.bank_account_num_electronic 银行帐号 --银行帐号
,iepa.org_id 账户
,ipiua.creation_date 付款手段日期创建时间
FROM iby_external_payers_all iepa
,iby_pmt_instr_uses_all ipiua
,iby_ext_bank_accounts_v ibybanks
,hz_parties hzp
,hz_cust_accounts hzcacc
WHERE iepa.payment_function = 'CUSTOMER_PAYMENT'
AND ibybanks.bank_account_id = ipiua.instrument_id
AND ipiua.instrument_type = 'BANKACCOUNT'
AND ipiua.ext_pmt_party_id = iepa.ext_payer_id
AND ipiua.payment_function = 'CUSTOMER_PAYMENT'
AND hzp.party_id = iepa.party_id
AND hzcacc.party_id = iepa.party_id
AND hzcacc.cust_account_id = iepa.cust_account_id;
and iepa.cust_account_id = --客户帐户ID