64: p_module =>'ei_cpp');
65: END IF;
66: /*
67: Following entities are parents of HZ_CONTACT_PREFERENCE
68: 1. HZ_CONTACT_POINTS (Ph, Web, EFT, Email, SMS, TLX, EDI)
69: 2. HZ_PARTIES (Org, Person, OrgContact)
70: 3. HZ_PARTY_SITES
71:
72: Contact Point has following parents
159: To do this, "inner select" uses case statement on parent_entity_name.
160: Some times, an embedded SQL is necessary to fgure out this.
161: Example:
162: Child is HZ_CONTACT_PREFERENCE.
163: Parent is HZ_CONTACT_POINTS and it's parent is Party.
164: To figure out the grand parent bo code, SQL is necessary to run against
165: hz_parties to figure out the party_type based on owner_table_id of the
166: hz_contact_points table.
167: */
162: Child is HZ_CONTACT_PREFERENCE.
163: Parent is HZ_CONTACT_POINTS and it's parent is Party.
164: To figure out the grand parent bo code, SQL is necessary to run against
165: hz_parties to figure out the party_type based on owner_table_id of the
166: hz_contact_points table.
167: */
168:
169: INSERT INTO HZ_BUS_OBJ_TRACKING
170: (CHILD_ENTITY_NAME, CHILD_ID,
186: ,RANK()
187: OVER (PARTITION BY PARENT_ENTITY_NAME, PARENT_ID, CHILD_BO_CODE, PARENT_BO_CODE
188: ORDER BY LAST_UPDATE_DATE) as cprank
189: ,CASE PARENT_ENTITY_NAME
190: WHEN 'HZ_CONTACT_POINTS' THEN -- identify GrandParentEntityName when CP is the parent of CPP
191: (SELECT
192: CASE OWNER_TABLE_NAME
193: WHEN 'HZ_PARTIES' THEN -- identify GrandParentEntityName when CP is the parent of CPP, Party is parent of CP
194: (SELECT
203: WHEN 'HZ_PARTY_SITES' THEN -- identify GrandParentEntityName when CP is parent of CPP, PS is parent of CP
204: 'HZ_PARTY_SITES'
205: ELSE NULL
206: END
207: FROM HZ_CONTACT_POINTS
208: WHERE contact_point_id = PARENT_ID)
209: WHEN 'HZ_PARTIES' THEN -- identify GrandParentEntityName when Party is parent of CPP
210: NULL
211: WHEN 'HZ_PARTY_SITES' THEN -- identify GrandParentEntityName when PS is parent of CPP
225: ELSE
226: NULL
227: END parent_entity_name, -- this is the grand parent entity name of cont pref - written as parent entity
228: CASE PARENT_ENTITY_NAME
229: WHEN 'HZ_CONTACT_POINTS' THEN -- identify GrandParentEntityId when CP is parent of CPP
230: (SELECT
231: CASE OWNER_TABLE_NAME
232: WHEN 'HZ_PARTIES' THEN -- identify GrandParentEntityId when CP is parent of CPP, party is parentOf CP
233: (SELECT
247: WHERE p.party_id = owner_table_id)
248: WHEN 'HZ_PARTY_SITES' THEN OWNER_TABLE_ID -- identify GrandParentEntityId when CP is parent of CPP, PS parentOf CP
249: ELSE NULL
250: END
251: FROM HZ_CONTACT_POINTS
252: WHERE contact_point_id = PARENT_ID)
253: WHEN 'HZ_PARTIES' THEN -- identify GrandParentEntityId when Party is parent of CPP
254: NULL
255: WHEN 'HZ_PARTY_SITES' THEN -- identify GrandParentEntityId when PS is parent of CPP
279: AND object_type = 'ORGANIZATION')
280: ELSE NULL
281: END parent_id, -- this is the grand parent id of cont pref - written as parent id
282: CASE PARENT_ENTITY_NAME -- this case is for identifying the grand parent BO
283: WHEN 'HZ_CONTACT_POINTS' THEN -- identify GrandParentBO when CP is parent of CPP
284: (SELECT
285: CASE OWNER_TABLE_NAME
286: WHEN 'HZ_PARTIES' THEN -- identify GrandParentBO when CP is parent of CPP, party is parentOf CP
287: (SELECT
296: WHEN 'HZ_PARTY_SITES' THEN -- identify GrandParentBO when CP is parent of CPP, PS is parentOf CP
297: 'PARTY_SITE'
298: ELSE NULL
299: END
300: FROM HZ_CONTACT_POINTS
301: WHERE contact_point_id = PARENT_ID)
302: WHEN 'HZ_PARTIES' THEN -- identify GrandParentBO when Party is parent of CPP
303: NULL
304: WHEN 'HZ_PARTY_SITES' THEN -- identify GrandParentBO when PS is parent of CPP
2900: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2901: END ei_HZ_CUSTOMER_PROFILES;
2902: -----------------------------------------------------------------
2903: /*
2904: Procedure name: PROCEDURE ei_HZ_CONTACT_POINTS()
2905: Purpose: Writes the parent node record for HZ_CONTACT_POINTS in BOT
2906: Scope: internal
2907: Called From: This pkg
2908: Called By: populate_missing_links()
2901: END ei_HZ_CUSTOMER_PROFILES;
2902: -----------------------------------------------------------------
2903: /*
2904: Procedure name: PROCEDURE ei_HZ_CONTACT_POINTS()
2905: Purpose: Writes the parent node record for HZ_CONTACT_POINTS in BOT
2906: Scope: internal
2907: Called From: This pkg
2908: Called By: populate_missing_links()
2909: */
2908: Called By: populate_missing_links()
2909: */
2910: -----------------------------------------------------------------
2911:
2912: PROCEDURE ei_HZ_CONTACT_POINTS IS
2913:
2914: -- local variables
2915: l_debug_prefix VARCHAR2(40) := 'EI_HZ_CONTACT_POINTS';
2916: l_module VARCHAR2(30) := 'ei_cp';
2911:
2912: PROCEDURE ei_HZ_CONTACT_POINTS IS
2913:
2914: -- local variables
2915: l_debug_prefix VARCHAR2(40) := 'EI_HZ_CONTACT_POINTS';
2916: l_module VARCHAR2(30) := 'ei_cp';
2917: BEGIN
2918: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2919: hz_utility_v2pub.DEBUG
2916: l_module VARCHAR2(30) := 'ei_cp';
2917: BEGIN
2918: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2919: hz_utility_v2pub.DEBUG
2920: (p_message=>'ei_HZ_CONTACT_POINTS+',
2921: p_prefix=>l_debug_prefix,
2922: p_msg_level=>fnd_log.level_procedure,
2923: p_module_prefix => 'HZ_BES_BO_UTIL_PKG',
2924: p_module =>'ei_cp');
2924: p_module =>'ei_cp');
2925: END IF;
2926:
2927: /*
2928: Following entities are parents of HZ_CONTACT_POINTS
2929: 1. HZ_PARTIES (Org, Person, OrgContact)
2930: 2. HZ_PARTY_SITES
2931:
2932: Party Site has following parents
2936: The different combinations of (parent, grand parent) are :
2937: 1. (Org, null) 2. (Person, null) 3. (OrgContact, Org) 4. (PS, Org) 5. (PS, Person)
2938: 6. (PS, OrgContact)
2939:
2940: The following SQL gets the Parent and Grand parent info of each HZ_CONTACT_POINTS
2941: record that was not already processed in BOT.
2942:
2943: Test Cases for the following SQL are:
2944: Create HZ_CONTACT_POINTS rec in BOT with (Parent, Grand Parent)
2940: The following SQL gets the Parent and Grand parent info of each HZ_CONTACT_POINTS
2941: record that was not already processed in BOT.
2942:
2943: Test Cases for the following SQL are:
2944: Create HZ_CONTACT_POINTS rec in BOT with (Parent, Grand Parent)
2945: combinations existing in TCA data model
2946: 1. (Org, null) -- tested
2947: 2. (Person, null) -- tested
2948: 3. (OrgContact, Org) -- tested
2978:
2979: example:
2980:
2981: child record:
2982: child_id: 123, child_entity_name: HZ_CONTACT_POINTS,
2983: child_bo: Phone, parent_bo: PS, parent_entity_name: PS,
2984: parent_id: 234
2985:
2986: The "inner select" fetches above record from BOT and identifies
3002: and grand parent, grand parent identifier or grand parent entity name.
3003: To do this, "inner select" uses case statement on parent_entity_name.
3004: Some times, an embedded SQL is necessary to fgure out this.
3005: Example:
3006: Child is HZ_CONTACT_POINTS.
3007: Parent is PS and it's parent is Party.
3008: To figure out the grand parent bo code, SQL is necessary to run against
3009: HZ_PARTIES to figure out the PARTY_TYPE based on PARTY_ID of the
3010: HZ_PARTY_SITES table.
3097: WHERE party_site_id = PARENT_ID))
3098: ELSE NULL
3099: END parent_bo_code -- this is the grand parent bo, written as parent
3100: FROM HZ_BUS_OBJ_TRACKING
3101: WHERE CHILD_ENTITY_NAME = 'HZ_CONTACT_POINTS'
3102: AND event_id IS NULL) temp
3103: WHERE NOT EXISTS
3104: (SELECT 1 FROM HZ_BUS_OBJ_TRACKING bot --select to exclude the parents that were already written to BOT
3105: WHERE bot.event_id IS NULL
3113: -- save the records populated
3114: COMMIT;
3115: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3116: hz_utility_v2pub.DEBUG
3117: (p_message=>'ei_HZ_CONTACT_POINTS-',
3118: p_prefix=>l_debug_prefix,
3119: p_msg_level=>fnd_log.level_procedure,
3120: p_module_prefix => 'HZ_BES_BO_UTIL_PKG',
3121: p_module =>'ei_cp');
3122: END IF;
3123:
3124: EXCEPTION
3125: WHEN OTHERS THEN
3126: LOG( message => 'ei_HZ_CONTACT_POINTS:'||SQLERRM,
3127: p_prefix =>l_debug_prefix,
3128: p_module => l_module);
3129: ROLLBACK;
3130: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3127: p_prefix =>l_debug_prefix,
3128: p_module => l_module);
3129: ROLLBACK;
3130: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3131: END ei_HZ_CONTACT_POINTS;
3132: ------------------------------------------------------------------------------
3133: PROCEDURE set_prof_var IS
3134: BEGIN
3135: IF G_BO_PROF_VAL IS NULL THEN
3423: 1. HZ_CONTACT_PREFERENCES
3424: 2. HZ_PER_PROFILES_EXT_VL
3425: 3. HZ_PERSON_PROFILES
3426: 4. HZ_PARTY_SITE_USES
3427: 5. HZ_CONTACT_POINTS
3428: 6. HZ_PARTY_SITES_EXT_VL
3429: 7. HZ_LOCATIONS_EXT_VL
3430: 8. HZ_LOCATIONS
3431: 9. HZ_PARTY_SITES
3501: p_module =>'pop_missing_lnks');
3502: END IF;
3503:
3504: ei_HZ_PARTY_SITE_USES;
3505: -- 5. HZ_CONTACT_POINTS
3506: /* LOG(
3507: message => 'bfr calling ei_HZ_CONTACT_POINTS()',
3508: p_prefix =>l_debug_prefix,
3509: p_module => l_module);
3503:
3504: ei_HZ_PARTY_SITE_USES;
3505: -- 5. HZ_CONTACT_POINTS
3506: /* LOG(
3507: message => 'bfr calling ei_HZ_CONTACT_POINTS()',
3508: p_prefix =>l_debug_prefix,
3509: p_module => l_module);
3510: */
3511: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3509: p_module => l_module);
3510: */
3511: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3512: hz_utility_v2pub.DEBUG
3513: (p_message=>'bfr calling ei_HZ_CONTACT_POINTS()',
3514: p_prefix=>l_debug_prefix,
3515: p_msg_level=>fnd_log.level_procedure,
3516: p_module_prefix => 'HZ_BES_BO_UTIL_PKG',
3517: p_module =>'pop_missing_lnks');
3516: p_module_prefix => 'HZ_BES_BO_UTIL_PKG',
3517: p_module =>'pop_missing_lnks');
3518: END IF;
3519:
3520: ei_HZ_CONTACT_POINTS;
3521: -- 6. HZ_PARTY_SITES_EXT_VL
3522: /* LOG(
3523: message => 'bfr calling ei_HZ_PARTY_SITES_EXT_VL()',
3524: p_prefix =>l_debug_prefix,