////////// CREATE CUSTOMER ACCOUNT(PERSON)///////////
_________________________________________________________________________________
DECLARE
p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
p_person_rec HZ_PARTY_V2PUB.PERSON_REC_TYPE;
p_customer_profile_rec HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE ;
x_cust_account_id NUMBER;
x_account_number VARCHAR2 ( 2000 ) ;
x_party_id NUMBER;
x_party_number VARCHAR2 ( 2000 ) ;
x_profile_id NUMBER;
x_return_status VARCHAR2 ( 2000 ) ;
x_msg_count NUMBER;
x_msg_data VARCHAR2 ( 2000 ) ;
BEGIN
p_cust_account_rec.account_name := 'ABCXYZ';
p_cust_account_rec.created_by_module := 'TCA_V2_API';
p_person_rec.person_first_name := 'ABC';
p_person_rec.person_last_name := 'XYZ';
mo_global.init ( 'AR' ) ;
mo_global.set_org_context ( 204, NULL, 'AR' ) ;
fnd_global.set_nls_context ( 'AMERICAN' ) ;
mo_global.set_policy_context ( 'S', 204 ) ;
hz_cust_account_v2pub.create_cust_account ( p_init_msg_list => 'T' ,
p_cust_account_rec => p_cust_account_rec ,
p_person_rec => p_person_rec ,
p_customer_profile_rec => p_customer_profile_rec ,
p_create_profile_amt => 'F' ,
x_cust_account_id => x_cust_account_id ,
x_account_number => x_account_number ,
x_party_id => x_party_id ,
x_party_number => x_party_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
);
dbms_output.put_line ( 'x_return_status = '||SUBSTR ( x_return_status, 1, 255 ) ) ;
dbms_output.put_line ( 'x_msg_count = '||TO_CHAR ( x_msg_count ) ) ;
dbms_output.put_line ( 'Party Id = '||TO_CHAR ( x_party_id ) ) ;
dbms_output.put_line ( 'Party Number = '||x_party_number ) ;
dbms_output.put_line ( 'Profile Id = '||TO_CHAR ( x_profile_id ) ) ;
dbms_output.put_line ( 'x_msg_data = '|| SUBSTR ( x_msg_data, 1, 255 ) ) ;
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line ( I||'.'||SUBSTR ( FND_MSG_PUB.Get ( p_encoded=> FND_API.G_FALSE ), 1, 255 ) ) ;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error: '||SQLERRM ) ;
END;
/
COMMIT;
------------------------------------------------------------------------------------------------------------------------
////////////// FOR VERIFY OF CREATED CUSTOMER//////////////////////////////////////////////////////////
SELECT cust_account_id
, party_id
, account_number
, account_name
FROM hz_cust_accounts
WHERE party_id = 554754;
SELECT party_id
,party_number
,party_name
,party_type
FROM hz_parties
WHERE party_id = 554754;
SELECT person_profile_id
,party_id
,person_first_name
,person_last_name
FROM hz_person_profiles
WHERE party_id = 554754;
SELECT cust_account_profile_id
,cust_account_id
,profile_class_id
,collector_id
FROM hz_customer_profiles
WHERE cust_account_id = 189744;
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
///////////////////// CREATE LOCATION///////////////////////////////////////////////////////////////////
_____________________________________________________________________________________________________
DECLARE
P_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
X_location_id NUMBER;
X_return_status VARCHAR2(2000);
X_msg_count NUMBER;
X_msg_data VARCHAR2(2000);
BEGIN
p_location_rec.country := 'US';
p_location_rec.address1 := '1229';
p_location_rec.address2 := 'South Harlem Ave';
p_location_rec.city := 'Berwyn';
p_location_rec.postal_code := '60169';
p_location_rec.state := 'IL';
p_location_rec.created_by_module := 'TCA_V2_API';
hz_location_v2pub.create_location(
p_init_msg_list => 'T' ,
p_location_rec => p_location_rec ,
x_location_id => x_location_id ,
x_return_status => x_return_status ,
x_msg_count => x_msg_count ,
x_msg_data => x_msg_data
);
dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255));
dbms_output.put_line('x_msg_count = ' ||TO_CHAR(x_msg_count));
dbms_output.put_line('Location Id = ' ||TO_CHAR(x_location_id));
dbms_output.put_line('Country = ' || SUBSTR(p_location_rec.country,1,255));
dbms_output.put_line('Address1 = ' || SUBSTR(p_location_rec.Address1,1,255));
dbms_output.put_line('State = ' || SUBSTR(p_location_rec.state,1,255));
dbms_output.put_line('Created By = ' || SUBSTR(p_location_rec.created_by_module,1,255));
dbms_output.put_line('x_msg_data = ' || SUBSTR(x_msg_data,1,255));
dbms_output.put_line('x_location_id = '||x_location_id );
IF x_msg_count > 1
THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'.'||SUBSTR( FND_MSG_PUB.Get(
p_encoded => FND_API.G_FALSE )
,1, 255
)
);
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('Error: '||SQLERRM);
END;
/
COMMIT;
------------------------------------------------------------------------------------------------------------------------
////////////// FOR VERIFY OF CREATED LOCATION/////////////////////////////////////////////////////////////
SELECT address1,
address2,
county ,
object_version_number
FROM hz_locations
WHERE location_id = 29266;
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
//////////////////// CREATE PARTY SITE ////////////////////////////////////////////
DECLARE
p_party_site_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_REC_TYPE;
x_party_site_id NUMBER;
x_party_site_number VARCHAR2(2000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_party_site_rec.party_id := 409691;
p_party_site_rec.location_id := 26478;
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module := 'TCA_V2_API';
hz_party_site_v2pub.create_party_site(
'T',
p_party_site_rec,
x_party_site_id,
x_party_site_number,
x_return_status,
x_msg_count,
x_msg_data);
dbms_output.put_line(SubStr('x_return_status = '||x_return_status,1,255));
dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count));
dbms_output.put_line(SubStr('x_msg_data = '||x_msg_data,1,255));
dbms_output.put_line('PARTY_SITE_ID = '||x_party_site_id );
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF;
END;
/
COMMIT;
--------------------------------------------------------------------------------
////////// VERIFY FOR CREATED PARTY SITE ///////////////
SELECT * FROM hz_party_sites
WHERE PARTY_ID=409691;
--------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
/////////////////////////////// CREATE party_site_use_rec//////////////////////////////////
------------------------------------------------------------------
DECLARE
p_party_site_use_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_USE_REC_TYPE;
x_party_site_use_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_party_site_use_rec.site_use_type := 'SHIP_TO';
p_party_site_use_rec.party_site_id := 225634;
p_party_site_use_rec.created_by_module := 'TCA_V2_API';
hz_party_site_v2pub.create_party_site_use(
'T',
p_party_site_use_rec,
x_party_site_use_id,
x_return_status,
x_msg_count,
x_msg_data);
dbms_output.put_line(SubStr('x_return_status = '||x_return_status,1,255));
dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count));
dbms_output.put_line(SubStr('x_msg_data = '||x_msg_data,1,255));
dbms_output.put_line('x_party_site_use_id ='||x_party_site_use_id);
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF;
END;
COMMIT;
-----------------------------------------------------------------------------------------------------
///////////////////// VERIFY FOR CREATED party_site_use_rec///////////////////////
select party_site_use_id, party_site_id, site_use_type, primary_per_type
from hz_party_site_uses
where party_site_use_id = 235055;
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
////////////////////// create contact point //////////////////////////////////////
DECLARE
p_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
p_edi_rec HZ_CONTACT_POINT_V2PUB.EDI_REC_TYPE;
p_email_rec HZ_CONTACT_POINT_V2PUB.EMAIL_REC_TYPE;
p_phone_rec HZ_CONTACT_POINT_V2PUB.PHONE_REC_TYPE;
p_telex_rec HZ_CONTACT_POINT_V2PUB.TELEX_REC_TYPE;
p_web_rec HZ_CONTACT_POINT_V2PUB.WEB_REC_TYPE;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
x_contact_point_id NUMBER;
BEGIN
-- Setting the Context --
mo_global.init('AR');
fnd_global.apps_initialize ( user_id => 1013455
,resp_id => 21623
,resp_appl_id => 222);
mo_global.set_policy_context('S',204);
fnd_global.set_nls_context('AMERICAN');
-- Initializing the Mandatory API parameters
p_contact_point_rec.contact_point_type := 'PHONE';
p_contact_point_rec.owner_table_name := 'HZ_PARTIES';
p_contact_point_rec.owner_table_id := 409691; --THIS IS PARTY_ID
p_contact_point_rec.primary_flag := 'Y';
p_contact_point_rec.contact_point_purpose := 'BUSINESS';
p_contact_point_rec.created_by_module := 'TCA_V2_API';
p_phone_rec.phone_area_code := NULL;
p_phone_rec.phone_country_code := '1';
p_phone_rec.phone_number := '856-784-521';
p_phone_rec.phone_line_type := 'MOBILE';
DBMS_OUTPUT.PUT_LINE('Calling the API hz_contact_point_v2pub.create_contact_point');
HZ_CONTACT_POINT_V2PUB.CREATE_CONTACT_POINT
(
p_init_msg_list => FND_API.G_TRUE,
p_contact_point_rec => p_contact_point_rec,
p_edi_rec => p_edi_rec,
p_email_rec => p_email_rec,
p_phone_rec => p_phone_rec,
p_telex_rec => p_telex_rec,
p_web_rec => p_web_rec,
x_contact_point_id => x_contact_point_id,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data
);
IF x_return_status = fnd_api.g_ret_sts_success THEN
COMMIT;
DBMS_OUTPUT.PUT_LINE('Creation of Contact Point is Successful ');
DBMS_OUTPUT.PUT_LINE('Output information ....');
DBMS_OUTPUT.PUT_LINE('x_contact_point_id = '||x_contact_point_id);
ELSE
DBMS_OUTPUT.put_line ('Creation of Contact Point got failed:'||x_msg_data);
ROLLBACK;
FOR i IN 1 .. x_msg_count
LOOP
x_msg_data := fnd_msg_pub.get( p_msg_index => i, p_encoded => 'F');
dbms_output.put_line( i|| ') '|| x_msg_data);
END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('Completion of API');
END;
-------------------------------------------------------------------------------------------------------------
///////////////////////// VERIFY CONTACT POINT ////////////////////////////
select *
from hz_contact_points
where contact_point_id = 262892;
-------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
////////////////////////// CREATE CUSTOMER ACCOUNT SITE ID////////////////////////////////////////
DECLARE
p_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;
x_return_status VARCHAR2 ( 2000 ) ;
x_msg_count NUMBER;
x_msg_data VARCHAR2 ( 2000 ) ;
x_cust_acct_site_id NUMBER;
BEGIN
p_cust_acct_site_rec.cust_account_id := 118742;
p_cust_acct_site_rec.party_site_id := 225635;
--p_cust_acct_site_rec.language := 'US';
--The Above Language Column is Obsolete in R12
p_cust_acct_site_rec.created_by_module := 'TCA_V2_API';
mo_global.init ( 'AR' ) ;
mo_global.set_org_context ( 204, NULL, 'AR' ) ;
fnd_global.set_nls_context ( 'AMERICAN' ) ;
mo_global.set_policy_context ( 'S', 204 ) ;
hz_cust_account_site_v2pub.create_cust_acct_site ( 'T' ,
p_cust_acct_site_rec ,
x_cust_acct_site_id ,
x_return_status ,
x_msg_count ,
x_msg_data
) ;
dbms_output.put_line ( 'x_return_status = '||SUBSTR ( x_return_status, 1, 255 ) ) ;
dbms_output.put_line ( 'x_msg_count = '||TO_CHAR ( x_msg_count ) ) ;
dbms_output.put_line ( 'Customer Account Site Id is = '||TO_CHAR ( x_cust_acct_site_id ) ) ;
dbms_output.put_line ( 'x_msg_data = '|| SUBSTR ( x_msg_data, 1, 255 ) ) ;
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line ( I||'.'||SUBSTR ( FND_MSG_PUB.Get ( p_encoded=> FND_API.G_FALSE ), 1, 255 ) ) ;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error: '||SQLERRM ) ;
END;
/
COMMIT;
---------------------------------------------------------------------------------------------------------------------
///////////////////////////////////// VERIFY ACCOUNT SITE ID//////////////////////////////////////////////
SELECT *
FROM hz_cust_acct_sites_all
WHERE cust_acct_site_id = 11297;
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
//////////////////////////////////////TCA Create Location Assignment API /////////////////////////////////
Name of the API : UPDATE CUSTOMER PROFILE
Base Tables Affected : HZ_LOC_ASSIGNMENTS
PL/SQL Procedure used : CREATE_LOC_ASSIGNMENT
Package Used : HZ_TAX_ASSIGNMENT_V2PUB
--------------------------------------------
DECLARE
p_location_id NUMBER;
p_created_by_module VARCHAR2 ( 500 ) ;
p_application_id NUMBER;
x_return_status VARCHAR2 ( 2000 ) ;
x_msg_count NUMBER;
x_msg_data VARCHAR2 ( 2000 ) ;
x_loc_id NUMBER;
BEGIN
p_location_id := 26478;
p_created_by_module := 'TCA_V2_API';
mo_global.init ( 'AR' ) ;
mo_global.set_org_context ( 204, NULL, 'AR' ) ;
fnd_global.set_nls_context ( 'AMERICAN' ) ;
mo_global.set_policy_context ( 'S', 204 ) ;
hz_tax_assignment_v2pub.create_loc_assignment ( 'T', p_location_id, 'T', p_created_by_module, p_application_id, x_return_status, x_msg_count, x_msg_data, x_loc_id );
dbms_output.put_line ( 'x_return_status = '||SUBSTR ( x_return_status, 1, 255 ) ) ;
dbms_output.put_line ( 'Location Id = '||TO_CHAR ( p_location_id ) ) ;
dbms_output.put_line ( 'Created By Moudle = '|| SUBSTR ( p_created_by_module, 1, 30 ) ) ;
dbms_output.put_line ( 'x_msg_count = '||TO_CHAR ( x_msg_count ) ) ;
dbms_output.put_line ( 'x_msg_data = '|| SUBSTR ( x_msg_data, 1, 255 ) ) ;
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line ( I||'.'||SUBSTR ( FND_MSG_PUB.Get ( p_encoded=> FND_API.G_FALSE ), 1, 255 ) ) ;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error: '||SQLERRM ) ;
END;
-------------------------------------------------------------------------------------------
//////////////////////// VERIFY LOCATION ASSIGNMENT//////////////////////////////////////
SELECT *
FROM hz_loc_assignments
WHERE location_id = 26478;
--------------------------------------------------------------------------
DECLARE
p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
p_person_rec HZ_PARTY_V2PUB.PERSON_REC_TYPE;
p_customer_profile_rec HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE ;
x_cust_account_id NUMBER;
x_account_number VARCHAR2 ( 2000 ) ;
x_party_id NUMBER;
x_party_number VARCHAR2 ( 2000 ) ;
x_profile_id NUMBER;
x_return_status VARCHAR2 ( 2000 ) ;
x_msg_count NUMBER;
x_msg_data VARCHAR2 ( 2000 ) ;
BEGIN
p_cust_account_rec.account_name := 'ABCXYZ';
p_cust_account_rec.created_by_module := 'TCA_V2_API';
p_person_rec.person_first_name := 'ABC';
p_person_rec.person_last_name := 'XYZ';
mo_global.init ( 'AR' ) ;
mo_global.set_org_context ( 204, NULL, 'AR' ) ;
fnd_global.set_nls_context ( 'AMERICAN' ) ;
mo_global.set_policy_context ( 'S', 204 ) ;
hz_cust_account_v2pub.create_cust_account ( p_init_msg_list => 'T' ,
p_cust_account_rec => p_cust_account_rec ,
p_person_rec => p_person_rec ,
p_customer_profile_rec => p_customer_profile_rec ,
p_create_profile_amt => 'F' ,
x_cust_account_id => x_cust_account_id ,
x_account_number => x_account_number ,
x_party_id => x_party_id ,
x_party_number => x_party_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
);
dbms_output.put_line ( 'x_return_status = '||SUBSTR ( x_return_status, 1, 255 ) ) ;
dbms_output.put_line ( 'x_msg_count = '||TO_CHAR ( x_msg_count ) ) ;
dbms_output.put_line ( 'Party Id = '||TO_CHAR ( x_party_id ) ) ;
dbms_output.put_line ( 'Party Number = '||x_party_number ) ;
dbms_output.put_line ( 'Profile Id = '||TO_CHAR ( x_profile_id ) ) ;
dbms_output.put_line ( 'x_msg_data = '|| SUBSTR ( x_msg_data, 1, 255 ) ) ;
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line ( I||'.'||SUBSTR ( FND_MSG_PUB.Get ( p_encoded=> FND_API.G_FALSE ), 1, 255 ) ) ;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error: '||SQLERRM ) ;
END;
/
COMMIT;
------------------------------------------------------------------------------------------------------------------------
////////////// FOR VERIFY OF CREATED CUSTOMER//////////////////////////////////////////////////////////
SELECT cust_account_id
, party_id
, account_number
, account_name
FROM hz_cust_accounts
WHERE party_id = 554754;
SELECT party_id
,party_number
,party_name
,party_type
FROM hz_parties
WHERE party_id = 554754;
SELECT person_profile_id
,party_id
,person_first_name
,person_last_name
FROM hz_person_profiles
WHERE party_id = 554754;
SELECT cust_account_profile_id
,cust_account_id
,profile_class_id
,collector_id
FROM hz_customer_profiles
WHERE cust_account_id = 189744;
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
///////////////////// CREATE LOCATION///////////////////////////////////////////////////////////////////
_____________________________________________________________________________________________________
DECLARE
P_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
X_location_id NUMBER;
X_return_status VARCHAR2(2000);
X_msg_count NUMBER;
X_msg_data VARCHAR2(2000);
BEGIN
p_location_rec.country := 'US';
p_location_rec.address1 := '1229';
p_location_rec.address2 := 'South Harlem Ave';
p_location_rec.city := 'Berwyn';
p_location_rec.postal_code := '60169';
p_location_rec.state := 'IL';
p_location_rec.created_by_module := 'TCA_V2_API';
hz_location_v2pub.create_location(
p_init_msg_list => 'T' ,
p_location_rec => p_location_rec ,
x_location_id => x_location_id ,
x_return_status => x_return_status ,
x_msg_count => x_msg_count ,
x_msg_data => x_msg_data
);
dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255));
dbms_output.put_line('x_msg_count = ' ||TO_CHAR(x_msg_count));
dbms_output.put_line('Location Id = ' ||TO_CHAR(x_location_id));
dbms_output.put_line('Country = ' || SUBSTR(p_location_rec.country,1,255));
dbms_output.put_line('Address1 = ' || SUBSTR(p_location_rec.Address1,1,255));
dbms_output.put_line('State = ' || SUBSTR(p_location_rec.state,1,255));
dbms_output.put_line('Created By = ' || SUBSTR(p_location_rec.created_by_module,1,255));
dbms_output.put_line('x_msg_data = ' || SUBSTR(x_msg_data,1,255));
dbms_output.put_line('x_location_id = '||x_location_id );
IF x_msg_count > 1
THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'.'||SUBSTR( FND_MSG_PUB.Get(
p_encoded => FND_API.G_FALSE )
,1, 255
)
);
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('Error: '||SQLERRM);
END;
/
COMMIT;
------------------------------------------------------------------------------------------------------------------------
////////////// FOR VERIFY OF CREATED LOCATION/////////////////////////////////////////////////////////////
SELECT address1,
address2,
county ,
object_version_number
FROM hz_locations
WHERE location_id = 29266;
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
//////////////////// CREATE PARTY SITE ////////////////////////////////////////////
DECLARE
p_party_site_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_REC_TYPE;
x_party_site_id NUMBER;
x_party_site_number VARCHAR2(2000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_party_site_rec.party_id := 409691;
p_party_site_rec.location_id := 26478;
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module := 'TCA_V2_API';
hz_party_site_v2pub.create_party_site(
'T',
p_party_site_rec,
x_party_site_id,
x_party_site_number,
x_return_status,
x_msg_count,
x_msg_data);
dbms_output.put_line(SubStr('x_return_status = '||x_return_status,1,255));
dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count));
dbms_output.put_line(SubStr('x_msg_data = '||x_msg_data,1,255));
dbms_output.put_line('PARTY_SITE_ID = '||x_party_site_id );
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF;
END;
/
COMMIT;
--------------------------------------------------------------------------------
////////// VERIFY FOR CREATED PARTY SITE ///////////////
SELECT * FROM hz_party_sites
WHERE PARTY_ID=409691;
--------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
/////////////////////////////// CREATE party_site_use_rec//////////////////////////////////
------------------------------------------------------------------
DECLARE
p_party_site_use_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_USE_REC_TYPE;
x_party_site_use_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_party_site_use_rec.site_use_type := 'SHIP_TO';
p_party_site_use_rec.party_site_id := 225634;
p_party_site_use_rec.created_by_module := 'TCA_V2_API';
hz_party_site_v2pub.create_party_site_use(
'T',
p_party_site_use_rec,
x_party_site_use_id,
x_return_status,
x_msg_count,
x_msg_data);
dbms_output.put_line(SubStr('x_return_status = '||x_return_status,1,255));
dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count));
dbms_output.put_line(SubStr('x_msg_data = '||x_msg_data,1,255));
dbms_output.put_line('x_party_site_use_id ='||x_party_site_use_id);
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF;
END;
COMMIT;
-----------------------------------------------------------------------------------------------------
///////////////////// VERIFY FOR CREATED party_site_use_rec///////////////////////
select party_site_use_id, party_site_id, site_use_type, primary_per_type
from hz_party_site_uses
where party_site_use_id = 235055;
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
////////////////////// create contact point //////////////////////////////////////
DECLARE
p_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
p_edi_rec HZ_CONTACT_POINT_V2PUB.EDI_REC_TYPE;
p_email_rec HZ_CONTACT_POINT_V2PUB.EMAIL_REC_TYPE;
p_phone_rec HZ_CONTACT_POINT_V2PUB.PHONE_REC_TYPE;
p_telex_rec HZ_CONTACT_POINT_V2PUB.TELEX_REC_TYPE;
p_web_rec HZ_CONTACT_POINT_V2PUB.WEB_REC_TYPE;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
x_contact_point_id NUMBER;
BEGIN
-- Setting the Context --
mo_global.init('AR');
fnd_global.apps_initialize ( user_id => 1013455
,resp_id => 21623
,resp_appl_id => 222);
mo_global.set_policy_context('S',204);
fnd_global.set_nls_context('AMERICAN');
-- Initializing the Mandatory API parameters
p_contact_point_rec.contact_point_type := 'PHONE';
p_contact_point_rec.owner_table_name := 'HZ_PARTIES';
p_contact_point_rec.owner_table_id := 409691; --THIS IS PARTY_ID
p_contact_point_rec.primary_flag := 'Y';
p_contact_point_rec.contact_point_purpose := 'BUSINESS';
p_contact_point_rec.created_by_module := 'TCA_V2_API';
p_phone_rec.phone_area_code := NULL;
p_phone_rec.phone_country_code := '1';
p_phone_rec.phone_number := '856-784-521';
p_phone_rec.phone_line_type := 'MOBILE';
DBMS_OUTPUT.PUT_LINE('Calling the API hz_contact_point_v2pub.create_contact_point');
HZ_CONTACT_POINT_V2PUB.CREATE_CONTACT_POINT
(
p_init_msg_list => FND_API.G_TRUE,
p_contact_point_rec => p_contact_point_rec,
p_edi_rec => p_edi_rec,
p_email_rec => p_email_rec,
p_phone_rec => p_phone_rec,
p_telex_rec => p_telex_rec,
p_web_rec => p_web_rec,
x_contact_point_id => x_contact_point_id,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data
);
IF x_return_status = fnd_api.g_ret_sts_success THEN
COMMIT;
DBMS_OUTPUT.PUT_LINE('Creation of Contact Point is Successful ');
DBMS_OUTPUT.PUT_LINE('Output information ....');
DBMS_OUTPUT.PUT_LINE('x_contact_point_id = '||x_contact_point_id);
ELSE
DBMS_OUTPUT.put_line ('Creation of Contact Point got failed:'||x_msg_data);
ROLLBACK;
FOR i IN 1 .. x_msg_count
LOOP
x_msg_data := fnd_msg_pub.get( p_msg_index => i, p_encoded => 'F');
dbms_output.put_line( i|| ') '|| x_msg_data);
END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('Completion of API');
END;
-------------------------------------------------------------------------------------------------------------
///////////////////////// VERIFY CONTACT POINT ////////////////////////////
select *
from hz_contact_points
where contact_point_id = 262892;
-------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
////////////////////////// CREATE CUSTOMER ACCOUNT SITE ID////////////////////////////////////////
DECLARE
p_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;
x_return_status VARCHAR2 ( 2000 ) ;
x_msg_count NUMBER;
x_msg_data VARCHAR2 ( 2000 ) ;
x_cust_acct_site_id NUMBER;
BEGIN
p_cust_acct_site_rec.cust_account_id := 118742;
p_cust_acct_site_rec.party_site_id := 225635;
--p_cust_acct_site_rec.language := 'US';
--The Above Language Column is Obsolete in R12
p_cust_acct_site_rec.created_by_module := 'TCA_V2_API';
mo_global.init ( 'AR' ) ;
mo_global.set_org_context ( 204, NULL, 'AR' ) ;
fnd_global.set_nls_context ( 'AMERICAN' ) ;
mo_global.set_policy_context ( 'S', 204 ) ;
hz_cust_account_site_v2pub.create_cust_acct_site ( 'T' ,
p_cust_acct_site_rec ,
x_cust_acct_site_id ,
x_return_status ,
x_msg_count ,
x_msg_data
) ;
dbms_output.put_line ( 'x_return_status = '||SUBSTR ( x_return_status, 1, 255 ) ) ;
dbms_output.put_line ( 'x_msg_count = '||TO_CHAR ( x_msg_count ) ) ;
dbms_output.put_line ( 'Customer Account Site Id is = '||TO_CHAR ( x_cust_acct_site_id ) ) ;
dbms_output.put_line ( 'x_msg_data = '|| SUBSTR ( x_msg_data, 1, 255 ) ) ;
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line ( I||'.'||SUBSTR ( FND_MSG_PUB.Get ( p_encoded=> FND_API.G_FALSE ), 1, 255 ) ) ;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error: '||SQLERRM ) ;
END;
/
COMMIT;
---------------------------------------------------------------------------------------------------------------------
///////////////////////////////////// VERIFY ACCOUNT SITE ID//////////////////////////////////////////////
SELECT *
FROM hz_cust_acct_sites_all
WHERE cust_acct_site_id = 11297;
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
//////////////////////////////////////TCA Create Location Assignment API /////////////////////////////////
Name of the API : UPDATE CUSTOMER PROFILE
Base Tables Affected : HZ_LOC_ASSIGNMENTS
PL/SQL Procedure used : CREATE_LOC_ASSIGNMENT
Package Used : HZ_TAX_ASSIGNMENT_V2PUB
--------------------------------------------
DECLARE
p_location_id NUMBER;
p_created_by_module VARCHAR2 ( 500 ) ;
p_application_id NUMBER;
x_return_status VARCHAR2 ( 2000 ) ;
x_msg_count NUMBER;
x_msg_data VARCHAR2 ( 2000 ) ;
x_loc_id NUMBER;
BEGIN
p_location_id := 26478;
p_created_by_module := 'TCA_V2_API';
mo_global.init ( 'AR' ) ;
mo_global.set_org_context ( 204, NULL, 'AR' ) ;
fnd_global.set_nls_context ( 'AMERICAN' ) ;
mo_global.set_policy_context ( 'S', 204 ) ;
hz_tax_assignment_v2pub.create_loc_assignment ( 'T', p_location_id, 'T', p_created_by_module, p_application_id, x_return_status, x_msg_count, x_msg_data, x_loc_id );
dbms_output.put_line ( 'x_return_status = '||SUBSTR ( x_return_status, 1, 255 ) ) ;
dbms_output.put_line ( 'Location Id = '||TO_CHAR ( p_location_id ) ) ;
dbms_output.put_line ( 'Created By Moudle = '|| SUBSTR ( p_created_by_module, 1, 30 ) ) ;
dbms_output.put_line ( 'x_msg_count = '||TO_CHAR ( x_msg_count ) ) ;
dbms_output.put_line ( 'x_msg_data = '|| SUBSTR ( x_msg_data, 1, 255 ) ) ;
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line ( I||'.'||SUBSTR ( FND_MSG_PUB.Get ( p_encoded=> FND_API.G_FALSE ), 1, 255 ) ) ;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error: '||SQLERRM ) ;
END;
-------------------------------------------------------------------------------------------
//////////////////////// VERIFY LOCATION ASSIGNMENT//////////////////////////////////////
SELECT *
FROM hz_loc_assignments
WHERE location_id = 26478;
--------------------------------------------------------------------------
Excellent....
ReplyDelete