216: SELECT rr.LAST_UPDATE_DATE lud, rr.CUST_ACCOUNT_ROLE_ID parent_id, rr.RESPONSIBILITY_ID child_id,
217: nvl(car.cust_acct_site_id, car.cust_account_id) car_parent_id,
218: decode(car.cust_acct_site_id, null, 'HZ_CUST_ACCOUNTS', 'HZ_CUST_ACCT_SITES_ALL') car_parent_entity,
219: decode(car.cust_acct_site_id, null, 'CUST_ACCT', 'CUST_ACCT_SITE') car_parent_bo
220: FROM HZ_ROLE_RESPONSIBILITY rr, HZ_CUST_ACCOUNT_ROLES car
221: WHERE rr.RESPONSIBILITY_ID = P_RESPONSIBILITY_ID
222: AND rr.cust_account_role_id = car.cust_account_role_id
223: AND car.cust_account_id > 0;
224:
278: ( POPULATED_FLAG, CHILD_OPERATION_FLAG, CHILD_ID, CHILD_ENTITY_NAME, CHILD_BO_CODE,
279: LAST_UPDATE_DATE, CREATION_DATE, PARENT_ENTITY_NAME, PARENT_ID, PARENT_BO_CODE
280: ) VALUES (
281: 'N', p_operation, l_child_id, 'HZ_ROLE_RESPONSIBILITY', NULL,
282: l_lud, l_lud, 'HZ_CUST_ACCOUNT_ROLES', l_parent_id, 'CUST_ACCT_CONTACT');
283:
284: -- if record not existing for customer account contact, insert into hz_bus_obj_tracking
285: pop_parent_record(p_child_id => l_parent_id,
286: p_lud => l_lud,
283:
284: -- if record not existing for customer account contact, insert into hz_bus_obj_tracking
285: pop_parent_record(p_child_id => l_parent_id,
286: p_lud => l_lud,
287: p_centity_name => 'HZ_CUST_ACCOUNT_ROLES',
288: p_cbo_code => 'CUST_ACCT_CONTACT',
289: p_parent_id => l_car_parent_id,
290: p_pentity_name => l_car_parent_entity,
291: p_pbo_code => l_car_parent_bo);
2555: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2556: END pop_hz_cust_acct_relate_all;
2557:
2558: -----------------------------------------------------------------
2559: -- Procedure name: pop_hz_cust_account_roles()
2560: -- Purpose: populates BOT for HZ_CUST_ACCOUNT_ROLES create or update
2561: -- Scope: internal
2562: -- Called From: V2 API
2563: -- Called By: HZ_CUST_ACCOUNT_ROLES create or update APIs
2556: END pop_hz_cust_acct_relate_all;
2557:
2558: -----------------------------------------------------------------
2559: -- Procedure name: pop_hz_cust_account_roles()
2560: -- Purpose: populates BOT for HZ_CUST_ACCOUNT_ROLES create or update
2561: -- Scope: internal
2562: -- Called From: V2 API
2563: -- Called By: HZ_CUST_ACCOUNT_ROLES create or update APIs
2564: -- Input Parameters:
2559: -- Procedure name: pop_hz_cust_account_roles()
2560: -- Purpose: populates BOT for HZ_CUST_ACCOUNT_ROLES create or update
2561: -- Scope: internal
2562: -- Called From: V2 API
2563: -- Called By: HZ_CUST_ACCOUNT_ROLES create or update APIs
2564: -- Input Parameters:
2565: -- p_operation -- contains I or U. 'I' if create API is calling this otherwise 'U'.
2566: -- p_cust_account_role_id IN NUMBER
2567: --
2565: -- p_operation -- contains I or U. 'I' if create API is calling this otherwise 'U'.
2566: -- p_cust_account_role_id IN NUMBER
2567: --
2568: -- Note:
2569: -- Following are the allowed PARENT and CHILD BO combinations for HZ_CUST_ACCOUNT_ROLES
2570: -- This procedure must ensure that the combination is valid before populating BOT
2571: --
2572: -- PARENT BO: CUST_ACCT :: CHILD BO: CUST_ACCT_CONTACT
2573: -- PARENT BO: CUST_ACCT_SITE :: CHILD BO: CUST_ACCT_CONTACT
2571: --
2572: -- PARENT BO: CUST_ACCT :: CHILD BO: CUST_ACCT_CONTACT
2573: -- PARENT BO: CUST_ACCT_SITE :: CHILD BO: CUST_ACCT_CONTACT
2574: -----------------------------------------------------------------
2575: PROCEDURE pop_hz_cust_account_roles(p_operation IN VARCHAR2, p_cust_account_role_id IN NUMBER) IS
2576:
2577: -- cursor statement to select the info from child table
2578: CURSOR C_child IS
2579: SELECT car.LAST_UPDATE_DATE lud, car.CUST_ACCOUNT_ROLE_ID child_id,
2580: nvl(car.cust_acct_site_id, car.cust_account_id) parent_id,
2581: decode(car.cust_acct_site_id, null, 'CUST_ACCT', 'CUST_ACCT_SITE') parent_bo,
2582: decode(car.cust_acct_site_id, null, 'HZ_CUST_ACCOUNTS', 'HZ_CUST_ACCT_SITES_ALL') parent_entity,
2583: ca.cust_account_id ca_id
2584: FROM HZ_CUST_ACCOUNT_ROLES car, HZ_CUST_ACCOUNTS ca, HZ_PARTIES p
2585: WHERE car.CUST_ACCOUNT_ROLE_ID = P_CUST_ACCOUNT_ROLE_ID
2586: AND car.cust_account_id = ca.cust_account_id
2587: AND ca.party_id = p.party_id
2588: AND p.party_type in ('ORGANIZATION', 'PERSON')
2588: AND p.party_type in ('ORGANIZATION', 'PERSON')
2589: AND car.cust_account_id > 0;
2590:
2591: -- local variables
2592: l_debug_prefix VARCHAR2(40) := 'pop_hz_cust_account_roles';
2593: l_parent_id NUMBER; -- used to store parent entity identifier
2594: l_parent_bo VARCHAR2(30);
2595: l_parent_entity VARCHAR2(30);
2596: l_child_id NUMBER; -- used to store HZ_CUST_ACCOUNT_ROLES identifier
2592: l_debug_prefix VARCHAR2(40) := 'pop_hz_cust_account_roles';
2593: l_parent_id NUMBER; -- used to store parent entity identifier
2594: l_parent_bo VARCHAR2(30);
2595: l_parent_entity VARCHAR2(30);
2596: l_child_id NUMBER; -- used to store HZ_CUST_ACCOUNT_ROLES identifier
2597: l_lud DATE; -- used to store the child last update date
2598: l_child_rec_exists_no NUMBER;
2599: l_ca_id NUMBER;
2600: l_pop_flag VARCHAR2(1);
2597: l_lud DATE; -- used to store the child last update date
2598: l_child_rec_exists_no NUMBER;
2599: l_ca_id NUMBER;
2600: l_pop_flag VARCHAR2(1);
2601: l_cen VARCHAR2(30) := 'HZ_CUST_ACCOUNT_ROLES';
2602: BEGIN
2603: hz_utility_v2pub.DEBUG(p_message=>'pop_hz_cust_account_roles+',
2604: p_prefix=>l_debug_prefix,
2605: p_msg_level=>fnd_log.level_procedure);
2599: l_ca_id NUMBER;
2600: l_pop_flag VARCHAR2(1);
2601: l_cen VARCHAR2(30) := 'HZ_CUST_ACCOUNT_ROLES';
2602: BEGIN
2603: hz_utility_v2pub.DEBUG(p_message=>'pop_hz_cust_account_roles+',
2604: p_prefix=>l_debug_prefix,
2605: p_msg_level=>fnd_log.level_procedure);
2606:
2607: -- validate p_operation
2607: -- validate p_operation
2608: IF p_operation IN ('I','U') THEN
2609: NULL;
2610: ELSE
2611: hz_utility_v2pub.DEBUG(p_message=> 'incorrect operation flag sent to pop_hz_cust_account_roles',
2612: p_prefix=>l_debug_prefix,
2613: p_msg_level=>fnd_log.level_procedure);
2614: RAISE FND_API.G_EXC_ERROR;
2615: END IF;
2650: INSERT INTO HZ_BUS_OBJ_TRACKING
2651: ( POPULATED_FLAG, CHILD_OPERATION_FLAG, CHILD_ID, CHILD_ENTITY_NAME, CHILD_BO_CODE,
2652: LAST_UPDATE_DATE, CREATION_DATE, PARENT_ENTITY_NAME, PARENT_ID, PARENT_BO_CODE
2653: ) VALUES (
2654: 'N', p_operation, l_child_id, 'HZ_CUST_ACCOUNT_ROLES', 'CUST_ACCT_CONTACT',
2655: l_lud, l_lud, l_parent_entity, l_parent_id, l_parent_bo);
2656: END ; -- anonymous block end
2657: END LOOP;
2658:
2655: l_lud, l_lud, l_parent_entity, l_parent_id, l_parent_bo);
2656: END ; -- anonymous block end
2657: END LOOP;
2658:
2659: hz_utility_v2pub.DEBUG(p_message=>'pop_hz_cust_account_roles-',
2660: p_prefix=>l_debug_prefix,
2661: p_msg_level=>fnd_log.level_procedure);
2662: EXCEPTION
2663: WHEN OTHERS THEN
2664: hz_utility_v2pub.DEBUG(p_message=> SQLERRM,
2665: p_prefix=>l_debug_prefix,
2666: p_msg_level=>fnd_log.level_procedure);
2667: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2668: END pop_hz_cust_account_roles;
2669:
2670: -----------------------------------------------------------------
2671: -- Procedure name: pop_hz_cust_accounts()
2672: -- Purpose: populates BOT for HZ_CUST_ACCOUNTS create or update