Thursday, 20 September 2018

HZ_RELATIONSHIPS SUBJECT_ID OBJECT_ID Explaination

https://community.oracle.com/thread/574250


Scenario: Relationship between Parties; this relationship is between parties of type ‘PERSON’ and ‘ORGANIZATION’ (John is Employee of Vision)

Before creating relationship, the above party records should exist in TCA. 

Where they exist? 
They exist in HZ_PARTIES table. 
What is the primary key in the HZ_PARTIES to identify these records? 
It is PARTY_ID
Is HZ_PARTIES part of FND_OBJECTS?
Yes

Two records are created in HZ_PARTIES for Vision and John with the PARTY_ID as ‘1234’ and ‘5678’ before you create relationship between them. 

When you create “EMPLOYEE” relationship between them, you have to pass the following values to the API. 


OBJECT_TABLE_NAME = ‘HZ_PARTIES
OBJECT_ID = PARTY_ID i.e.1234
OBJECT_TYPE = ‘ORGANIZATION’ i.e. PARTY TYPE

SUBJECT_TABLE_NAME = ‘HZ_PARTIES
SUBJECT_ID = PARTY_ID i.e.5678
SUBJECT_TYPE = ‘PERSON’ i.e. PARTY TYPE

To answer you question

The purpose of these parameters is to identify the entities and the primary key between which you are creating relationship. Technically, you are creating relationship between 2 database records, which already created and are uniquely identified by a primary key in a table. 

In the above example, the API validates the values ‘1234’ and ‘5678’ against PARTY_ID of HZ_PARTIES and makes sure that those records exist in that table. The reason being, you cannot create relationship between Vision and John if they do not exist. 

The primary key = OBJECT_ID/SUBJECT_ID 
Table name = OBJECT_TABLE_NAME/SUBJECT_TABLE_NAME. 

Note that, the above relationship is between the 2 records existing in HZ_PARTIES table.

You can also use other entities records to create relationship if those entities are defined in FND_OBJECTS. It is normal practice that mostly relationships are created between parties ('ORGANIZATION’/‘PERSON’ and ‘PERSON’/’PERSON’. )

To create relationship between other entities you have to do some setups. 

Hope this helps.

Ram

1 comment:

  1. How to query HZ_RELATIONSHIPS table in Oracle??

    ReplyDelete