The following lines contain the word 'select', 'insert', 'update' or 'delete':
IF OE_GLOBALS.G_UPDATE_ON_ID THEN
oe_debug_pub.add('OE_GLOBALS.G_UPDATE_ON_ID : TRUE');
oe_debug_pub.add('OE_GLOBALS.G_UPDATE_ON_ID : FALSE');
3.If customer_id is sent then see if value is aslo sent and try to update the value on the id ig OE_GLOBALS.G_UPDATE_ON_ID is true
4.If customer_id could not be resolved till step 3,create the customer
5. Check for minimum required fields
6.Validate customer related fields
7. call TCA API to create the customer
*/
IF l_sold_to_cust_found
THEN
IF l_debug_level > 0 THEN
oe_debug_pub.add('l_sold_to_customer_rec.customer_id :'||l_sold_to_customer_rec.customer_id);
oe_msg_pub.delete_msg(oe_msg_pub.g_msg_count);
AND OE_GLOBALS.G_UPDATE_ON_ID
THEN
Update_Customer (p_customer_rec => l_sold_to_customer_rec
, x_return_status =>x_return_status
);
3.If customer_id is sent then see if value is aslo sent and try to update the value on the id ig OE_GLOBALS.G_UPDATE_ON_ID is true
4.If customer_id could not be resolved till step 3,create the customer
5. Check for minimum required fields
6.Validate customer related fields
7. call TCA API to create the customer
*/
IF l_ship_to_cust_found
THEN
IF l_debug_level > 0 THEN
oe_debug_pub.add('l_ship_to_customer_rec.customer_id :'||l_ship_to_customer_rec.customer_id);
oe_msg_pub.delete_msg(oe_msg_pub.g_msg_count);
AND OE_GLOBALS.G_UPDATE_ON_ID
THEN
Update_Customer (p_customer_rec => l_ship_to_customer_rec
, x_return_status =>x_return_status
);
oe_debug_pub.add('Update_Customer failed ,returning');
oe_msg_pub.delete_msg(oe_msg_pub.g_msg_count);
AND OE_GLOBALS.G_UPDATE_ON_ID
THEN
Update_Customer (p_customer_rec => l_bill_to_customer_rec
, x_return_status =>x_return_status
);
oe_debug_pub.add('Update_Customer failed ,returning');
oe_msg_pub.delete_msg(oe_msg_pub.g_msg_count);
AND OE_GLOBALS.G_UPDATE_ON_ID
THEN
Update_Customer (p_customer_rec => l_deliver_to_customer_rec
, x_return_status =>x_return_status
);
oe_debug_pub.add('Update_Customer failed ,returning');
SELECT party_site_id,location_id
FROM hz_party_sites
WHERE party_id = p_party_id;
SELECT cust_acct_site_id
INTO x_cust_acct_site_id
FROM hz_cust_acct_sites
WHERE party_site_id = p_party_site_id
AND cust_account_id = p_cust_account_id
AND ROWNUM =1;
SELECT loc.location_id
INTO l_location_id
FROM hz_cust_acct_sites acct_site,
hz_party_sites party_site,
hz_locations loc
WHERE acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
AND acct_site.cust_acct_site_id = p_cust_acct_site_id ;
oe_msg_pub.delete_msg(oe_msg_pub.g_msg_count);
--Update Address logic to go here
IF IS_BOTH_ID_VAL_PASSED( p_address_rec => l_addr_rec )
AND OE_GLOBALS.G_UPDATE_ON_ID
THEN
Update_Location (p_address_rec => l_addr_rec
, p_site_use_id => l_addr_rec.site_use_id
, p_site_usage_code => p_address_usage
, x_return_status =>x_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
);
oe_debug_pub.add('Update_Location :x_return_status'||x_return_status);
oe_debug_pub.add('Update_Location :x_msg_count'||x_msg_count);
oe_debug_pub.add('Update_Location :x_msg_data'||x_msg_data);
oe_msg_pub.delete_msg(oe_msg_pub.g_msg_count);
select party_id
into l_party_id
from hz_cust_accounts
where cust_account_id = p_cust_acct_id;
/* This procedure is used to update a address location.This will be called from create_address procedure if
bot ID and Value are passed for address related fields and OE_GLOBALS.G_UPDATE_ON_ID is TRUE
*/
Procedure Update_Location ( p_address_rec IN OE_ORDER_PUB.CUSTOMER_INFO_REC_TYPE
, p_site_use_id IN NUMBER
, p_site_usage_code IN VARCHAR2
, x_return_status OUT NOCOPY VARCHAR2
, x_msg_count OUT NOCOPY NUMBER
, x_msg_data OUT NOCOPY VARCHAR2
) IS
l_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
HZ_LOCATION_V2PUB.UPDATE_LOCATION (
p_init_msg_list => FND_API.G_TRUE,
p_location_rec => l_location_rec,
p_object_version_number => x_ver_number,
x_return_status =>x_return_status,
x_msg_count =>x_msg_count,
x_msg_data =>x_msg_data
);
, 'Update_Location'
);
END Update_Location;
which will be passed to the TCA APIS in case of updates*/
FUNCTION Get_obj_version_number( p_location_id IN NUMBER DEFAULT NULL
,p_cust_account_id IN NUMBER DEFAULT NULL
,p_party_id IN NUMBER DEFAULT NULL ) RETURN NUMBER
IS
l_version_num NUMBER;
select object_version_number
into l_version_num
from hz_locations
where location_id = p_location_id;
SELECT OBJECT_VERSION_NUMBER
into l_version_num
FROM HZ_CUST_ACCOUNTS
WHERE CUST_ACCOUNT_ID = p_cust_account_id;
SELECT OBJECT_VERSION_NUMBER
into l_version_num
FROM HZ_PARTIES
WHERE party_id = p_party_id;
SELECT loc.location_id
INTO l_location_id
FROM hz_cust_site_uses site_uses,
hz_cust_acct_sites acct_site,
hz_party_sites party_site,
hz_locations loc
WHERE site_uses.cust_acct_site_id = acct_site.cust_acct_site_id
AND acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
AND site_uses.site_use_code = p_site_usage_code
AND site_uses.site_use_id = p_site_use_id;
for customer fields and OE_GLOBALS.G_UPDATE_ON_ID is TRUE. This API can update Customer_name,
Account_Description,Account_number,Email contact point,Phone contact point*/
Procedure Update_Customer ( p_customer_rec IN OE_ORDER_PUB.CUSTOMER_INFO_REC_TYPE
, x_return_status OUT NOCOPY VARCHAR2 ) IS
x_version_number NUMBER;
oe_debug_pub.add('Entering OE_CUSTOMER_INFO_PVT.Update_Customer ');
hz_party_v2pub.update_organization (
p_init_msg_list => FND_API.G_TRUE,
p_organization_rec => l_organization_rec,
p_party_object_version_number => x_version_number,
x_profile_id =>x_profile_id,
x_return_status =>x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data );
hz_party_v2pub.update_person (
p_init_msg_list => FND_API.G_TRUE,
p_person_rec => l_person_rec,
p_party_object_version_number => x_version_number,
x_profile_id =>x_profile_id,
x_return_status =>x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data );
HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT (
p_init_msg_list => FND_API.G_TRUE,
p_cust_account_rec => l_cust_acct_rec,
p_object_version_number => x_version_number,
x_return_status => x_return_status,
x_msg_count =>x_msg_count,
x_msg_data =>x_msg_data
);
oe_debug_pub.add('Update_Customer :x_return_status:'||x_return_status);
oe_debug_pub.add('Update_Customer:x_msg_count:'||x_msg_count);
oe_debug_pub.add('Update_Customer :x_msg_data:'||x_msg_data);
oe_debug_pub.add('Entering OE_CUSTOMER_INFO_PVT.Update_Customer ');
END Update_Customer;
oe_msg_pub.delete_msg(oe_msg_pub.g_msg_count);
--Update Contact logic to go here
IF IS_BOTH_ID_VAL_PASSED( p_contact_rec => l_contact_rec )
AND OE_GLOBALS.G_UPDATE_ON_ID
THEN
Update_Contact (p_contact_rec => l_contact_rec
, x_return_status =>x_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
);
oe_debug_pub.add('Update_Location :x_return_status'||x_return_status);
oe_debug_pub.add('Update_Location :x_msg_count'||x_msg_count);
oe_debug_pub.add('Update_Location :x_msg_data'||x_msg_data);
SELECT 'Y' INTO l_exists
FROM HZ_CUST_ACCT_RELATE
WHERE CUST_ACCOUNT_ID = p_customer_id
AND RELATED_CUST_ACCOUNT_ID = p_rel_customer_id
AND STATUS='A';
select 'Y'
into l_exists
from HZ_PARTIES
Where party_id = p_party_id;
Select p_contact_record.person_last_name
|| DECODE(p_contact_record.person_first_name, NULL, NULL, ', '
|| p_contact_record.PERSON_FIRST_NAME)
|| DECODE(p_contact_record.Person_Name_Suffix, NULL, NULL, ', '
||p_contact_record.Person_Name_Suffix)
Into l_contact_name
From Dual;
SELECT site_uses.site_use_id
INTO x_site_use_id
FROM hz_cust_acct_sites acct_site,
hz_cust_site_uses site_uses,
hz_party_sites party_site,
hz_locations loc
WHERE site_uses.cust_acct_site_id = acct_site.cust_acct_site_id
AND acct_site.party_site_id = party_site.party_site_id
AND loc.location_id = party_site.location_id
AND site_uses.site_use_code = p_site_usage
AND acct_site.CUST_ACCT_SITE_ID = p_cust_acct_site_id
AND site_uses.STATUS = 'A';
select party_type
into l_party_type
from hz_parties
where party_id = p_party_id;
/* Updates the contact information like person name,title,email,phone .Called from create_contact procedure
if both ID and value are passed in contact record and OE_GLOBALS.G_UPDATE_ON_ID is TRUE*/
PROCEDURE Update_Contact ( p_contact_rec IN OE_ORDER_PUB.CUSTOMER_INFO_REC_TYPE
, x_return_status OUT NOCOPY VARCHAR2
, x_msg_count OUT NOCOPY NUMBER
, x_msg_data OUT NOCOPY VARCHAR2
)
IS
l_party_id NUMBER;
oe_debug_pub.add('Entering OE_CUSTOMER_INFO_PVT.Update_Contact ');
SELECT party.party_id,REL_PARTY.party_id
into l_party_id , l_rel_party_id
FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE,
HZ_PARTIES PARTY,
HZ_CUST_ACCOUNTS ACCT,
HZ_RELATIONSHIPS REL,
HZ_ORG_CONTACTS ORG_CONT,
HZ_PARTIES REL_PARTY
WHERE ACCT_ROLE.PARTY_ID = REL.PARTY_ID
AND ACCT_ROLE.ROLE_TYPE = 'CONTACT'
AND ORG_CONT.PARTY_RELATIONSHIP_ID = REL.RELATIONSHIP_ID
AND REL.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
AND REL.OBJECT_TABLE_NAME = 'HZ_PARTIES'
AND REL.SUBJECT_ID = PARTY.PARTY_ID
AND REL.PARTY_ID = REL_PARTY.PARTY_ID
AND REL.OBJECT_ID = ACCT.PARTY_ID
AND ACCT.CUST_ACCOUNT_ID = ACCT_ROLE.CUST_ACCOUNT_ID
AND ACCT_ROLE.CUST_ACCOUNT_ROLE_ID = p_contact_rec.contact_id;
hz_party_v2pub.update_person (
p_init_msg_list => FND_API.G_TRUE,
p_person_rec => l_person_rec,
p_party_object_version_number => x_version_number,
x_profile_id =>x_profile_id,
x_return_status =>x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data );
oe_debug_pub.add('Update_Contact :x_return_status:'||x_return_status);
oe_debug_pub.add('Update_Contact :x_msg_count:'||x_msg_count);
oe_debug_pub.add('Update_Contact :x_msg_data:'||x_msg_data);
oe_debug_pub.add('Entering OE_CUSTOMER_INFO_PVT.Update_Contact ');
, 'Update_Contact'
);
oe_debug_pub.add('Update_Contact Other Errors :'||SQLERRM);
END Update_Contact;